add render command
This commit is contained in:
parent
950287a2f7
commit
debe1837a7
5 changed files with 698 additions and 0 deletions
28
management/commands/render.py
Normal file
28
management/commands/render.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import json
|
||||
import os
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
|
||||
from ...render import compose, render
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'generate symlinks to clips and clips.json'
|
||||
|
||||
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('--duration', action='store', dest='duration', default="150", help='target duration in seconds')
|
||||
parser.add_argument('--offset', action='store', dest='offset', default="1024", help='inital offset in pi')
|
||||
|
||||
def handle(self, **options):
|
||||
prefix = options['prefix']
|
||||
target = int(options['duration'])
|
||||
base = int(options['offset'])
|
||||
|
||||
with open(os.path.join(prefix, "clips.json")) as fd:
|
||||
clips = json.load(fd)
|
||||
scene = compose(clips, target=target, base=base)
|
||||
render(prefix, scene)
|
||||
with open(os.path.join(prefix, 'scene-%s.json' % base), 'w') as fd:
|
||||
json.dump(scene, fd, indent=2, ensure_ascii=False)
|
||||
Loading…
Add table
Add a link
Reference in a new issue