migration towards command line only based utility

This commit is contained in:
Xevion
2019-11-01 23:45:06 -05:00
parent 7e3cb12513
commit 9c1c05c7d0
2 changed files with 13 additions and 14 deletions

View File

@@ -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

View File

@@ -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