34c3 mods
This commit is contained in:
parent
b0ac0b83f4
commit
04a66cb90c
3 changed files with 2692 additions and 110 deletions
2536
GPN17-Fahrplan.XML
Executable file
2536
GPN17-Fahrplan.XML
Executable file
File diff suppressed because it is too large
Load diff
|
@ -41,17 +41,20 @@ parser.add_argument('--id', dest='ids', nargs='+', action="store", type=int, hel
|
|||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def headline(str):
|
||||
print("##################################################")
|
||||
print(str)
|
||||
print("##################################################")
|
||||
print()
|
||||
|
||||
|
||||
def error(str):
|
||||
headline(str)
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if not args.motn:
|
||||
error("The Motion-File is a rquired argument")
|
||||
|
||||
|
@ -72,14 +75,17 @@ if args.debug:
|
|||
else:
|
||||
events = list(renderlib.events(args.schedule))
|
||||
|
||||
|
||||
def describe_event(event):
|
||||
return "#{}: {}".format(event['id'], event['title'])
|
||||
|
||||
|
||||
def event_print(event, message):
|
||||
print("{} – {}".format(describe_event(event), message))
|
||||
|
||||
tempdir = tempfile.TemporaryDirectory()
|
||||
print('working in '+tempdir.name)
|
||||
|
||||
tempdir = '/Users/pkoerner/VOC/34c3_intro_bix'
|
||||
print('working in ' + tempdir)
|
||||
|
||||
|
||||
def fmt_command(command, **kwargs):
|
||||
|
@ -90,10 +96,12 @@ def fmt_command(command, **kwargs):
|
|||
command = command.format(**args)
|
||||
return shlex.split(command)
|
||||
|
||||
|
||||
def run(command, **kwargs):
|
||||
return subprocess.check_call(
|
||||
fmt_command(command, **kwargs))
|
||||
|
||||
|
||||
def run_output(command, **kwargs):
|
||||
return subprocess.check_output(
|
||||
fmt_command(command, **kwargs),
|
||||
|
@ -101,10 +109,45 @@ def run_output(command, **kwargs):
|
|||
stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
def enrich_event(event):
|
||||
print(event)
|
||||
result = {}
|
||||
result.update(event)
|
||||
art = {"red":"1", "green":"1", "blue":"0.20000000298023224"}
|
||||
ccc = {"red":"0.60000002384185791", "green":"0.80000001192092896", "blue":"0"}
|
||||
entertainment = ccc
|
||||
ethics = {"red":"1", "green":"0.20000000298023224", "blue":"1"}
|
||||
hardware = {"red":"1", "green":"0.40000000596046448", "blue":"0"}
|
||||
resilience = {"red":"0.64313727617263794", "green":"0.10980392247438431", "blue":"0.19215686619281769"}
|
||||
science = {"red":"1", "green":"0.40000000596046448", "blue":"0"}
|
||||
security = {"red":"0.4117647111415863", "green":"0", "blue":"0.82745099067687988"}
|
||||
|
||||
if "Art" in event['track']:
|
||||
result.update(art)
|
||||
elif "CCC" in event['track']:
|
||||
result.update(ccc)
|
||||
elif "Entertainment" in event['track']:
|
||||
result.update(entertainment)
|
||||
elif "Ethics" in event['track']:
|
||||
result.update(ethics)
|
||||
elif "Hardware" in event['track']:
|
||||
result.update(hardware)
|
||||
elif "Resilience" in event['track']:
|
||||
result.update(resilience)
|
||||
elif "Science" in event['track']:
|
||||
result.update(science)
|
||||
elif "Security" in event['track']:
|
||||
result.update(security)
|
||||
else:
|
||||
print("Found unrecognized track name %s, assuming CCC track colour" % (event['track']))
|
||||
result.update(ccc)
|
||||
|
||||
return result
|
||||
|
||||
def enqueue_job(event):
|
||||
event_id = str(event['id'])
|
||||
work_doc = os.path.join(tempdir.name, event_id+'.motn')
|
||||
intermediate_clip = os.path.join(tempdir.name, event_id+'.mov')
|
||||
work_doc = os.path.join(tempdir, event_id + '.motn')
|
||||
intermediate_clip = os.path.join(tempdir, event_id + '.mov')
|
||||
|
||||
with open(args.motn, 'r') as fp:
|
||||
xmlstr = fp.read()
|
||||
|
@ -128,6 +171,7 @@ def enqueue_job(event):
|
|||
|
||||
return match.group(1)
|
||||
|
||||
|
||||
def fetch_job_status():
|
||||
compressor_status = run_output('/Applications/Compressor.app/Contents/MacOS/Compressor -monitor')
|
||||
job_status_matches = re.finditer("<jobStatus (.*) \/jobStatus>", compressor_status)
|
||||
|
@ -144,8 +188,6 @@ def fetch_job_status():
|
|||
return status_dict
|
||||
|
||||
|
||||
|
||||
|
||||
def filter_finished_jobs(active_jobs):
|
||||
job_status = fetch_job_status()
|
||||
|
||||
|
@ -170,17 +212,19 @@ def filter_finished_jobs(active_jobs):
|
|||
|
||||
def finalize_job(job_id, event):
|
||||
event_id = str(event['id'])
|
||||
intermediate_clip = os.path.join(tempdir.name, event_id+'.mov')
|
||||
final_clip = os.path.join(os.path.dirname(args.motn), event_id+'.ts')
|
||||
intermediate_clip = os.path.join(tempdir, event_id + '.mov')
|
||||
final_clip = os.path.join(os.path.dirname(args.motn), event_id + '.mov')
|
||||
|
||||
run('ffmpeg -y -hide_banner -loglevel error -i "{input}" -ar 48000 -ac 1 -f s16le -i /dev/zero -map 0:v -c:v mpeg2video -q:v 0 -aspect 16:9 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -shortest -f mpegts "{output}"',
|
||||
# run('ffmpeg -y -hide_banner -loglevel error -i "{input}" -ar 48000 -ac 1 -f s16le -i /dev/zero -map 0:v -c:v mpeg2video -q:v 0 -aspect 16:9 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -shortest -f mpegts "{output}"',
|
||||
# input=intermediate_clip,
|
||||
# output=final_clip)
|
||||
run('mv "{input}" "{output}"',
|
||||
input=intermediate_clip,
|
||||
output=final_clip)
|
||||
|
||||
event_print(event, "finalized intro to " + final_clip)
|
||||
|
||||
|
||||
|
||||
active_jobs = []
|
||||
|
||||
print("enqueuing {} jobs into compressor".format(len(events)))
|
||||
|
@ -188,6 +232,8 @@ for event in events:
|
|||
if args.ids and event['id'] not in args.ids:
|
||||
continue
|
||||
|
||||
event = enrich_event(event)
|
||||
|
||||
job_id = enqueue_job(event)
|
||||
if not job_id:
|
||||
event_print(event, "job was not enqueued successfully, skipping postprocessing")
|
||||
|
@ -207,6 +253,5 @@ while len(active_jobs) > 0:
|
|||
event_print(event, "finalizing job")
|
||||
finalize_job(job_id, event)
|
||||
|
||||
|
||||
print('all done, cleaning up '+tempdir.name)
|
||||
tempdir.cleanup()
|
||||
print('all done, cleaning up ' + tempdir)
|
||||
#tempdir.cleanup()
|
||||
|
|
|
@ -223,6 +223,7 @@ def events(scheduleUrl, titlemap={}):
|
|||
'persons': personnames,
|
||||
'personnames': ', '.join(personnames),
|
||||
'room': room.attrib['name'],
|
||||
'track': event.find('track').text.split(', '),
|
||||
}
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue