clean up start-up messages and validation on ENV. Display error correctly when exif rotater fails

This commit is contained in:
2024-12-07 19:46:15 +11:00
parent 47190a8829
commit bd3ee98328

View File

@@ -49,9 +49,14 @@ import subprocess
# global debug setting
if 'ENV' not in os.environ or os.environ['ENV'] != "production":
if 'ENV' not in os.environ:
DEBUG=True
print("PA job manager starting as non-production -- ENV not set! Please set ENV, I'd rather not guess what to do")
elif os.environ['ENV'] != "production":
DEBUG=True
print(f"PA job manager starting as non-production -- ENV={os.environ['ENV']}")
else:
print("PA job manager starting as Production")
DEBUG=False
# global list of override tables to allow enumeration over them ...
@@ -1933,8 +1938,11 @@ def JobTransformImage(job):
out.save( e.FullPathOnFS() )
else:
AddLogForJob(job, f"INFO: Rotating {e.FullPathOnFS()} by {amt} degrees" )
p = subprocess.run([PA_EXIF_ROTATER, e.FullPathOnFS(), amt ], capture_output=True )
PAprint(p)
p = subprocess.run([PA_EXIF_ROTATER, e.FullPathOnFS(), amt ], capture_output=True, text=True )
if p.stderr:
PAprint(p.stderr)
else:
PAprint(p.stdout)
settings = session.query(Settings).first()
e.file_details.thumbnail, _ , _ = GenThumb( e.FullPathOnFS(), settings.auto_rotate )
e.file_details.hash = md5( job, e )