From 02b89c06dd8d9635ec5c691f4d7921795f5ae186 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 3 Jun 2021 16:02:22 +0100 Subject: [PATCH] pass item data to icon --- pandora/item/models.py | 11 +++++++++-- pandora/settings.py | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 04ec81dd..0caa0a4f 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1614,8 +1614,15 @@ class Item(models.Model): cmd += ['-l', timeline] if frame: cmd += ['-f', frame] - p = subprocess.Popen(cmd, close_fds=True) - p.wait() + if settings.ITEM_POSTER_DATA: + cmd += '-d', '-' + data = self.json() + data = utils.normalize_dict('NFC', data) + p = subprocess.Popen(cmd, stdin=subprocess.PIPE, close_fds=True) + p.communicate(json.dumps(data, default=to_json).encode('utf-8')) + else: + p = subprocess.Popen(cmd, close_fds=True) + p.wait() # remove cached versions icon = os.path.abspath(os.path.join(settings.MEDIA_ROOT, icon)) for f in glob(icon.replace('.jpg', '*.jpg')): diff --git a/pandora/settings.py b/pandora/settings.py index b2596015..69a76e0b 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -264,6 +264,7 @@ SCRIPT_ROOT = normpath(join(PROJECT_ROOT, '..', 'scripts')) #change script to customize ITEM_POSTER = join(SCRIPT_ROOT, 'poster.py') ITEM_ICON = join(SCRIPT_ROOT, 'item_icon.py') +ITEM_ICON_DATA = False LIST_ICON = join(SCRIPT_ROOT, 'list_icon.py') COLLECTION_ICON = join(SCRIPT_ROOT, 'list_icon.py')