Skip to content

Commit

Permalink
Improve logging for pedalboard screenshots
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Nov 10, 2023
1 parent 704ee89 commit 4532204
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mod/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import subprocess
import sys
import logging

from tornado.ioloop import IOLoop
from mod.settings import HTML_DIR, DEV_ENVIRONMENT, DEVICE_KEY, CACHE_DIR
Expand All @@ -27,7 +28,7 @@ def generate_screenshot(bundle_path, callback):
cmd = [os.path.join(cwd, 'mod-pedalboard'), 'take_screenshot', bundle_path, HTML_DIR, CACHE_DIR]
if sys.platform == 'win32':
cmd[0] += ".exe"
print(' '.join(cmd))
logging.debug('[screenshot] now running: %s', ' '.join(cmd))

# regular run
else:
Expand All @@ -44,6 +45,7 @@ def proc_callback():
return

if not os.path.exists(screenshot) or not os.path.exists(thumbnail):
logging.warn('[screenshot] process finished but image files do not exist')
callback()
return

Expand Down Expand Up @@ -94,7 +96,7 @@ def img_callback(thumbnail=None):
try:
generate_screenshot(self.processing, img_callback)
except Exception as ex:
print('ERROR: {0}'.format(ex))
logging.error('[screenshot] %s', ex)
img_callback()

def check_screenshot(self, bundlepath):
Expand Down

0 comments on commit 4532204

Please sign in to comment.