From e84ea31147e5d484d8698200a02341d2c5aaf55d Mon Sep 17 00:00:00 2001 From: j Date: Mon, 9 Oct 2023 14:10:34 +0100 Subject: [PATCH] tweaks --- README.md | 26 +++++--------------------- management/commands/generate_clips.py | 2 +- management/commands/render.py | 5 +++-- render.py | 12 ++++++------ 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index ea8db61..44984c2 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,10 @@ -# pan.do/ra site config overlay +# pan.do/ra overlay for t-for-time -fork this repo into pandora_sitename and add your pan.do/ra customizations +pandora settings and render pipeline. -place your config as config.jsonc, add custom files to static/js, poster scripts to scripts +`apt install melt kdenlive ladspa-sdk xvfb` -custom files should be in the form ..js +`pandoractl manage genreate_clips` -i.e. js overlay: +`pandoractl manage render` - static/js/home..js - -png overly the same i.e. - - static/png/icon..png - -poster/icon script without : - script/item_icon.py - script/list_icon.py - script/potser.py - -if you need a custom django module, touch __init__.py and install.py will take care of that too. - -to use js pages from other sites, add them to overwrite in install.py - -to deploy, checkout your fork into /srv/pandora/pandora/ and run ./install.py diff --git a/management/commands/generate_clips.py b/management/commands/generate_clips.py index cd51f07..4922d53 100644 --- a/management/commands/generate_clips.py +++ b/management/commands/generate_clips.py @@ -23,7 +23,7 @@ class Command(BaseCommand): clip = {} durations = [] for e in item.models.Item.objects.filter(data__title=i.data['title']): - source = i.files.all()[0].data.path + source = e.files.all()[0].data.path ext = os.path.splitext(source)[1] type_ = e.data['type'][0].lower() target = os.path.join(prefix, type_, i.data['title'] + ext) diff --git a/management/commands/render.py b/management/commands/render.py index 5ae57a1..b43dbc9 100644 --- a/management/commands/render.py +++ b/management/commands/render.py @@ -8,7 +8,7 @@ from ...render import compose, render class Command(BaseCommand): - help = 'generate symlinks to clips and clips.json' + help = 'genrate kdenlive porject and render' def add_arguments(self, parser): parser.add_argument('--prefix', action='store', dest='prefix', default="/srv/t_for_time", help='prefix to build clips in') @@ -23,6 +23,7 @@ class Command(BaseCommand): with open(os.path.join(prefix, "clips.json")) as fd: clips = json.load(fd) scene = compose(clips, target=target, base=base) - render(prefix, scene) + render(prefix, scene, 'scene-%s-' % base) with open(os.path.join(prefix, 'scene-%s.json' % base), 'w') as fd: json.dump(scene, fd, indent=2, ensure_ascii=False) + diff --git a/render.py b/render.py index 65cd41a..cdb70eb 100644 --- a/render.py +++ b/render.py @@ -6,8 +6,8 @@ import sys import time import ox -from pi import random -from render_kdenlive import KDEnliveProject +from .pi import random +from .render_kdenlive import KDEnliveProject def random_choice(seq, items, pop=False): @@ -97,7 +97,8 @@ def compose(clips, target=150, base=1024): # 50 % chance to blur original from 0 to 30 if chance(seq, 0.5): blur = seq() * 3 - scene['back']['V2'][-1]['filter']['blur'] = blur + if blur: + scene['back']['V2'][-1]['filter']['blur'] = blur scene['audio']['A1'].append({ 'duration': clip['duration'], 'src': clip['original'], @@ -109,7 +110,7 @@ def compose(clips, target=150, base=1024): return scene -def render(root, scene): +def render(root, scene, prefix=''): fps = 24 for timeline, data in scene.items(): print(timeline) @@ -121,6 +122,5 @@ def render(root, scene): for clip in clips: project.append_clip(track, clip) - with open(os.path.join(prefix, "%s.kdenlive" % timeline), 'w') as fd: + with open(os.path.join(root, prefix + "%s.kdenlive" % timeline), 'w') as fd: fd.write(project.to_xml()) -