This commit is contained in:
j 2023-10-09 14:10:34 +01:00
parent debe1837a7
commit e84ea31147
4 changed files with 15 additions and 30 deletions

View file

@ -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 <file>.<sitename>.js `pandoractl manage genreate_clips`
i.e. js overlay: `pandoractl manage render`
static/js/home.<sitename>.js
png overly the same i.e.
static/png/icon.<sitename>.png
poster/icon script without <sitename>:
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/<sitename> and run ./install.py

View file

@ -23,7 +23,7 @@ class Command(BaseCommand):
clip = {} clip = {}
durations = [] durations = []
for e in item.models.Item.objects.filter(data__title=i.data['title']): 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] ext = os.path.splitext(source)[1]
type_ = e.data['type'][0].lower() type_ = e.data['type'][0].lower()
target = os.path.join(prefix, type_, i.data['title'] + ext) target = os.path.join(prefix, type_, i.data['title'] + ext)

View file

@ -8,7 +8,7 @@ from ...render import compose, render
class Command(BaseCommand): class Command(BaseCommand):
help = 'generate symlinks to clips and clips.json' help = 'genrate kdenlive porject and render'
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('--prefix', action='store', dest='prefix', default="/srv/t_for_time", help='prefix to build clips in') 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: with open(os.path.join(prefix, "clips.json")) as fd:
clips = json.load(fd) clips = json.load(fd)
scene = compose(clips, target=target, base=base) 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: with open(os.path.join(prefix, 'scene-%s.json' % base), 'w') as fd:
json.dump(scene, fd, indent=2, ensure_ascii=False) json.dump(scene, fd, indent=2, ensure_ascii=False)

View file

@ -6,8 +6,8 @@ import sys
import time import time
import ox import ox
from pi import random from .pi import random
from render_kdenlive import KDEnliveProject from .render_kdenlive import KDEnliveProject
def random_choice(seq, items, pop=False): 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 # 50 % chance to blur original from 0 to 30
if chance(seq, 0.5): if chance(seq, 0.5):
blur = seq() * 3 blur = seq() * 3
scene['back']['V2'][-1]['filter']['blur'] = blur if blur:
scene['back']['V2'][-1]['filter']['blur'] = blur
scene['audio']['A1'].append({ scene['audio']['A1'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['original'], 'src': clip['original'],
@ -109,7 +110,7 @@ def compose(clips, target=150, base=1024):
return scene return scene
def render(root, scene): def render(root, scene, prefix=''):
fps = 24 fps = 24
for timeline, data in scene.items(): for timeline, data in scene.items():
print(timeline) print(timeline)
@ -121,6 +122,5 @@ def render(root, scene):
for clip in clips: for clip in clips:
project.append_clip(track, clip) 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()) fd.write(project.to_xml())