Skip to content

Commit

Permalink
Merge branch 'master' into plugin-store
Browse files Browse the repository at this point in the history
  • Loading branch information
falkTX committed Nov 2, 2023
2 parents f6b4faa + 704ee89 commit ae8d29e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
16 changes: 8 additions & 8 deletions mod/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,32 @@ def generate_screenshot(bundle_path, callback):

# running packaged through cxfreeze
if os.path.isfile(sys.argv[0]):
# TODO this does not work yet
return
cmd = [os.path.join(cwd, 'mod-screenshot'), 'take_screenshot', bundle_path, HTML_DIR, CACHE_DIR]
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))

# regular run
else:
cmd = ['python3', '-m', 'modtools.pedalboard', 'take_screenshot', bundle_path, HTML_DIR, CACHE_DIR]
if not DEV_ENVIRONMENT and DEVICE_KEY: # if using a real MOD, setup niceness
cmd = ['/usr/bin/nice', '-n', '+34'] + cmd

proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=cwd)
proc = subprocess.Popen(cmd, cwd=cwd)
loop = IOLoop.instance()

def proc_callback(fileno, _):
def proc_callback():
if proc.poll() is None:
loop.call_later(0.5, proc_callback)
return
loop.remove_handler(fileno)

if not os.path.exists(screenshot) or not os.path.exists(thumbnail):
return callback()
callback()
return

callback(thumbnail)

loop.add_handler(proc.stdout.fileno(), proc_callback, 16)
loop.call_later(0.5, proc_callback)


class ScreenshotGenerator(object):
Expand Down
2 changes: 1 addition & 1 deletion modtools/pedalboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def _take_screenshot(args):
args = parser.parse_args()
if hasattr(args, 'func'):
args.func(args)
exit(0)
sys.exit(0)
else:
parser.print_usage()

Expand Down
3 changes: 3 additions & 0 deletions utils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ endif

ifeq ($(MODAPP),1)
CXXFLAGS += -DMODAPP
ifneq ($(MACOS)$(WINDOWS),true)
LDFLAGS += -Wl,-rpath,'$$ORIGIN/..'
endif
else ifeq ($(shell pkg-config --exists alsa && echo true), true)
CXXFLAGS += -DHAVE_ALSA
ALSA_CFLAGS = $(shell pkg-config --cflags alsa)
Expand Down

0 comments on commit ae8d29e

Please sign in to comment.