add title replacement

This commit is contained in:
derchris 2021-12-28 17:22:11 +01:00
parent 208b13cbe6
commit efd5e61a2e

View file

@ -12,24 +12,27 @@ import os
import platform
from shutil import copyfile
titlemap = {
'id': "11404", 'title': "Attacking CPUs with Power Side Channels from Software",
'id': "205", 'title': "Attacking CPUs with Power Side Channels from Software",
}
titlemap = (
{'id': "000000", 'title': "Short title goes here"},
)
# Parse arguments
parser = argparse.ArgumentParser(
description='C3VOC Intro-Outro-Generator - Variant to use with Adobe After Effects Files',
usage="./make-adobe-after-effects.py yourproject/ https://url/to/schedule.xml",
usage="./make-adobe-after-effects.py yourproject/ https://url/to/schedule.xml filename_of_intro.aepx",
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('project', action="store", metavar='Project folder', type=str, help='''
Path to your project folder with After Effects Files (intro.aepx)
Path to your project folder with After Effects Files
''')
parser.add_argument('schedule', action="store", metavar='Schedule-URL', type=str, nargs='?', help='''
URL or Path to your schedule.xml
''')
parser.add_argument('introfile', action="store", metavar='Name of intro source file', default='intro.aepx', type=str, nargs='?', help='''
Filename of the intro source file inside the project folder
''')
parser.add_argument('--debug', action="store_true", default=False, help='''
Run script in debug mode and render with placeholder texts,
not parsing or accessing a schedule. Schedule-URL can be left blank when
@ -224,7 +227,7 @@ def enqueue_job(event):
with open(script_doc, 'w', encoding='utf-8') as fp:
fp.write(scriptstr)
copyfile(args.project+'intro.aepx',work_doc)
copyfile(args.project+args.introfile,work_doc)
if platform.system() == 'Darwin':
copyfile(args.project+'intro.scpt',ascript_doc)
@ -241,7 +244,7 @@ def enqueue_job(event):
run_once(r'C:/Program\ Files/Adobe/Adobe\ After\ Effects\ 2022/Support\ Files/AfterFX.exe -noui -r {scriptpath}',
scriptpath=script_doc)
time.sleep(2)
time.sleep(5)
run(r'C:/Program\ Files/Adobe/Adobe\ After\ Effects\ 2022/Support\ Files/aerender.exe -project {jobpath} -comp "intro" -mfr on 100 -output {locationpath}',
jobpath=work_doc,
@ -321,10 +324,13 @@ for event in events:
print("skipping day %s (%s)" % (event['day'], event['title']))
continue
if str(event['id']) in str(titlemap['id']):
for item in titlemap:
if str(item['id']) == str(event['id']):
title = item['title']
event_print(event, "titlemap replacement")
event['title'] = titlemap['title']
event_print(event, "replacing title %s with %s" % (event['title'], title))
event['title'] = title
event_print(event, "enqueued as " + str(event['id']))
job_id = enqueue_job(event)