final bub2022/__init__.py config
This commit is contained in:
parent
fe5ae00f3a
commit
47309fc242
1 changed files with 102 additions and 81 deletions
|
@ -3,109 +3,130 @@
|
||||||
from renderlib import *
|
from renderlib import *
|
||||||
from easing import *
|
from easing import *
|
||||||
import math
|
import math
|
||||||
|
import logging
|
||||||
|
|
||||||
# URL to Schedule-XML
|
# URL to Schedule-XML
|
||||||
scheduleUrl = 'https://fahrplan22.bits-und-baeume.org/bitsundbaeume/schedule/export/schedule.xml'
|
scheduleUrl = 'https://fahrplan22.bits-und-baeume.org/bitsundbaeume/schedule/export/schedule.xml'
|
||||||
|
|
||||||
# For (really) too long titles
|
# For (really) too long titles
|
||||||
titlemap = {
|
titlemap = {
|
||||||
#708: "Neue WEB-Anwendungen des LGRB Baden-Württemberg im Überblick"
|
#708: "Neue WEB-Anwendungen des LGRB Baden-Württemberg im Überblick"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def outroFrames(p):
|
def outroFrames(p):
|
||||||
frames = 2*fps
|
frames = 2*fps
|
||||||
for i in range(0, frames):
|
for i in range(0, frames):
|
||||||
yield (
|
yield (
|
||||||
('logo', 'style', 'opacity', "%.4f" % easeInCubic(i, 0, 1, frames)),
|
('logo', 'style', 'opacity', "%.4f" % easeInCubic(i, 0, 1, frames)),
|
||||||
('plate', 'style', 'opacity', 0),
|
('plate', 'style', 'opacity', 0),
|
||||||
)
|
)
|
||||||
|
|
||||||
frames = 1*fps
|
frames = 1*fps
|
||||||
for i in range(0, frames):
|
for i in range(0, frames):
|
||||||
yield (
|
yield (
|
||||||
('logo', 'style', 'opacity', 1),
|
('logo', 'style', 'opacity', 1),
|
||||||
('plate', 'style', 'opacity', "%.4f" % easeInCubic(i, 0, 1, frames)),
|
('plate', 'style', 'opacity', "%.4f" % easeInCubic(i, 0, 1, frames)),
|
||||||
)
|
)
|
||||||
|
|
||||||
frames = 2*fps
|
frames = 2*fps
|
||||||
for i in range(0, frames):
|
for i in range(0, frames):
|
||||||
yield (
|
yield (
|
||||||
('logo', 'style', 'opacity', 1),
|
('logo', 'style', 'opacity', 1),
|
||||||
('plate', 'style', 'opacity', 1),
|
('plate', 'style', 'opacity', 1),
|
||||||
)
|
)
|
||||||
|
|
||||||
def introFrames(p):
|
def introFrames(p):
|
||||||
frames = math.floor(1.5*fps)
|
frames = math.floor(1.5*fps)
|
||||||
for i in range(0, frames):
|
for i in range(0, frames):
|
||||||
yield (
|
yield (
|
||||||
('header', 'attr', 'y', 659),
|
('header', 'attr', 'y', 1318),
|
||||||
('text', 'style', 'opacity', 0),
|
('text', 'style', 'opacity', 0),
|
||||||
)
|
)
|
||||||
|
|
||||||
frames = 1*fps
|
frames = 1*fps
|
||||||
for i in range(0, frames):
|
for i in range(0, frames):
|
||||||
yield (
|
yield (
|
||||||
('text', 'style', 'opacity', "%.4f" % easeInCubic(i, 0, 1, frames)),
|
('text', 'style', 'opacity', "%.4f" % easeInCubic(i, 0, 1, frames)),
|
||||||
)
|
)
|
||||||
|
|
||||||
frames = math.ceil(3.5*fps)
|
frames = math.ceil(3.5*fps)
|
||||||
for i in range(0, frames):
|
for i in range(0, frames):
|
||||||
yield (
|
yield (
|
||||||
('text', 'style', 'opacity', 1),
|
('text', 'style', 'opacity', 1),
|
||||||
)
|
)
|
||||||
|
|
||||||
def pauseFrames(p):
|
def pauseFrames(p):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def srtip_event_title(event_title):
|
||||||
|
if len(event_title) > 80:
|
||||||
|
count = 0
|
||||||
|
title = []
|
||||||
|
for word in event_title.split(" "):
|
||||||
|
word_len = len(word)
|
||||||
|
if count + word_len < 80:
|
||||||
|
count += word_len
|
||||||
|
title.append(word)
|
||||||
|
logging.info(count)
|
||||||
|
else:
|
||||||
|
title.append("...")
|
||||||
|
break
|
||||||
|
return " ".join(title)
|
||||||
|
else:
|
||||||
|
return event_title
|
||||||
|
|
||||||
def debug():
|
def debug():
|
||||||
render(
|
render(
|
||||||
'intro.svg',
|
'intro.svg',
|
||||||
'../intro.ts',
|
'../intro.ts',
|
||||||
introFrames,
|
introFrames,
|
||||||
{
|
{
|
||||||
'$id': 6526,
|
'$id': 19990,
|
||||||
'$title': 'Besser steuern durch Daten? - Zur Performativität soziotechnischer Systeme und der Quantifizierung der sozialen Welt',
|
'$title': 'Ein creative commons Repository für medizinische Metadatenmodelle zur Harmonisierung der Gesundheitsversorgung (DE)',
|
||||||
'$subtitle': 'foobar2342',
|
'$personnames': 'Max Blumenstock, Christian Niklas'
|
||||||
'$personnames': 'Judith Hartstein und Anne K. Krüger'
|
}
|
||||||
}
|
)
|
||||||
)
|
# render(
|
||||||
render(
|
# 'outro.svg',
|
||||||
'outro.svg',
|
# '../outro.ts',
|
||||||
'../outro.ts',
|
# outroFrames
|
||||||
outroFrames
|
# )
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def tasks(queue, params, idlist, skiplist):
|
def tasks(queue, params, idlist, skiplist):
|
||||||
# iterate over all events extracted from the schedule xml-export
|
# iterate over all events extracted from the schedule xml-export
|
||||||
for event in events(scheduleUrl):
|
for event in events(scheduleUrl):
|
||||||
if not (idlist==[]):
|
event_title = srtip_event_title(event['title'])
|
||||||
if 000000 in idlist:
|
|
||||||
print("skipping id (%s [%s])" % (event['title'], event['id']))
|
|
||||||
continue
|
|
||||||
if int(event['id']) not in idlist:
|
|
||||||
print("skipping id (%s [%s])" % (event['title'], event['id']))
|
|
||||||
continue
|
|
||||||
|
|
||||||
# generate a task description and put them into the queue
|
if not (idlist==[]):
|
||||||
if int(event['id']) not in skiplist:
|
if 000000 in idlist:
|
||||||
queue.put(Rendertask(
|
print("skipping id (%s [%s])" % (event_title, event['id']))
|
||||||
infile = 'intro.svg',
|
continue
|
||||||
outfile = str(event['id'])+".ts",
|
if int(event['id']) not in idlist:
|
||||||
sequence = introFrames,
|
print("skipping id (%s [%s])" % (event_title, event['id']))
|
||||||
parameters = {
|
continue
|
||||||
'$id': event['id'],
|
|
||||||
'$title': event['title'],
|
|
||||||
'$subtitle': event['subtitle'],
|
|
||||||
'$personnames': event['personnames']
|
|
||||||
}
|
|
||||||
))
|
|
||||||
|
|
||||||
# place a task for the outro into the queue
|
# generate a task description and put them into the queue
|
||||||
if not "out" in skiplist:
|
if int(event['id']) not in skiplist:
|
||||||
queue.put(Rendertask(
|
queue.put(Rendertask(
|
||||||
infile = 'outro.svg',
|
infile = 'intro.svg',
|
||||||
outfile = 'outro.ts',
|
outfile = str(event['id'])+".ts",
|
||||||
sequence = outroFrames
|
sequence = introFrames,
|
||||||
))
|
parameters = {
|
||||||
|
'$id': event['id'],
|
||||||
|
'$title': event_title,
|
||||||
|
'$personnames': event['personnames']
|
||||||
|
}
|
||||||
|
))
|
||||||
|
|
||||||
|
# place a task for the outro into the queue
|
||||||
|
if not "out" in skiplist:
|
||||||
|
queue.put(Rendertask(
|
||||||
|
infile = 'outro.svg',
|
||||||
|
outfile = 'outro.ts',
|
||||||
|
sequence = outroFrames
|
||||||
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue