mirror of
https://github.com/Xevion/phototag.git
synced 2025-12-06 03:15:51 -06:00
migration towards command line only based utility
This commit is contained in:
@@ -11,14 +11,10 @@ log.info('Progressbar/Logging ready.')
|
||||
|
||||
|
||||
# Path Constants
|
||||
# ROOT = ''
|
||||
ROOT = sys.path[0]
|
||||
# PROCESSING_PATH = ROOT
|
||||
PROCESSING_PATH = os.path.join(ROOT, 'package', 'processing')
|
||||
# INPUT_PATH = PROCESSING_PATH
|
||||
INPUT_PATH = os.path.join(PROCESSING_PATH, 'input')
|
||||
TEMP_PATH = os.path.join(PROCESSING_PATH, 'temp')
|
||||
OUTPUT_PATH = os.path.join(PROCESSING_PATH, 'output')
|
||||
ROOT = os.path.dirname(os.path.realpath(__file__))
|
||||
INPUT_PATH = ROOT
|
||||
TEMP_PATH = os.path.join(ROOT, 'temp')
|
||||
OUTPUT_PATH = os.path.join(ROOT, 'output')
|
||||
log.info('Path Constants Built.')
|
||||
|
||||
# Extension Constants
|
||||
|
||||
@@ -12,7 +12,7 @@ from google.cloud import vision
|
||||
|
||||
from .xmp import XMPParser
|
||||
from .process import FileProcessor
|
||||
from . import INPUT_PATH, TEMP_PATH, OUTPUT_PATH, PROCESSING_PATH
|
||||
from . import INPUT_PATH, TEMP_PATH, OUTPUT_PATH
|
||||
from . import RAW_EXTS, LOSSY_EXTS
|
||||
|
||||
log = logging.getLogger('app')
|
||||
@@ -23,13 +23,16 @@ def run():
|
||||
# Find files we want to process based on if they have a corresponding .XMP
|
||||
log.info('Locating processable files...')
|
||||
files = os.listdir(INPUT_PATH)
|
||||
select = [file for file in files if os.path.splitext(file)[1] != '.xmp']
|
||||
log.info(f'Found {len(files)} valid files')
|
||||
select = [file for file in files if os.path.splitext(file)[1][1:].lower() in (RAW_EXTS + LOSSY_EXTS)]
|
||||
log.info(f'Found {len(select)} valid files')
|
||||
|
||||
# Create the 'temp' directory
|
||||
log.info('Creating temporary processing directory')
|
||||
os.makedirs(TEMP_PATH)
|
||||
os.makedirs(OUTPUT_PATH)
|
||||
if not os.path.exists(TEMP_PATH):
|
||||
log.info('Creating temporary processing directory')
|
||||
os.makedirs(TEMP_PATH)
|
||||
if not os.path.exists(OUTPUT_PATH):
|
||||
log.info('Creating output processing directory')
|
||||
os.makedirs(OUTPUT_PATH)
|
||||
|
||||
try:
|
||||
# Process files
|
||||
|
||||
Reference in New Issue
Block a user