From 3a91ed8660e54416988eb738b36534da7d5d6925 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 2 Oct 2017 14:39:36 +0200 Subject: [PATCH] fix import, pass prefix to render_mlt.py too --- render.py | 2 +- render_mlt.py | 52 +++++++++++++++++++++++++++++++-------------------- subtitles.py | 15 ++++++++------- 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/render.py b/render.py index b4142a8..9556cf5 100755 --- a/render.py +++ b/render.py @@ -458,5 +458,5 @@ if __name__ == '__main__': fd.write(current) if render_xml: if current != old or os.path.getmtime(tjson) < os.path.getmtime('render_mlt.py'): - subprocess.call(['./render_mlt.py', tjson]) + subprocess.call(['./render_mlt.py', '--prefix', prefix, tjson]) #subprocess.call(['./render_audio.py', tjson]) diff --git a/render_mlt.py b/render_mlt.py index ee05b39..4e06fb0 100755 --- a/render_mlt.py +++ b/render_mlt.py @@ -1,14 +1,26 @@ #!/usr/bin/python -import os -import time -import sys +from argparse import ArgumentParser import json +import os import subprocess +import sys +import time import ox import mlt from PyQt5 import QtWidgets +usage = "usage: %(prog)s [options] json" +parser = ArgumentParser(usage=usage) +parser.add_argument('-p', '--prefix', dest='prefix', help='version prefix', default='.') +parser.add_argument('files', metavar='path', type=str, nargs='*', help='json files') +opts = parser.parse_args() + +if opts.prefix.endswith('performance'): + version = 'performance' +else: + version = 'main' + # Avoid segfault in webvfx app = QtWidgets.QApplication(sys.argv) @@ -198,24 +210,24 @@ save_xml(drones, target_drones) save_xml(music, target_music) -# render gongs -subprocess.call([ - # offset in pi, duration, number of tracks, target - './render_gongs.py', - str(data['gongs']['offset']), - str(duration), - str(data['gongs']['tracks']), - gongs_wav -]) -# load gongs -add_audio_clip(gongs, gongs_wav, int(duration * fps), int(5*fps)) +if version == 'performance': + # render gongs + subprocess.call([ + # offset in pi, duration, number of tracks, target + './render_gongs.py', + str(data['gongs']['offset']), + str(duration), + str(data['gongs']['tracks']), + gongs_wav + ]) + # load gongs + add_audio_clip(gongs, gongs_wav, int(duration * fps), int(5*fps)) - -# mix drones + music -#mtractor = mix_audio_tracks(drones, music, 0.3) - -# mix gongs + music -mtractor = mix_audio_tracks(gongs, music, 0.3) + # mix gongs + music + mtractor = mix_audio_tracks(gongs, music, 0.3) +else: + # mix drones + music + mtractor = mix_audio_tracks(drones, music, 0.3) norm = mlt.Filter(profile, "volume") # lower volume diff --git a/subtitles.py b/subtitles.py index df26709..77a7593 100755 --- a/subtitles.py +++ b/subtitles.py @@ -1,13 +1,14 @@ #!/usr/bin/python3 -import os -import sys -import json -import re -import subprocess +from argparse import ArgumentParser from collections import defaultdict -import string -from glob import glob from copy import deepcopy +from glob import glob +import json +import os +import re +import string +import subprocess +import sys import ox import ox.web.auth