fix V1/V2 naming, handle animation players, don't use blank, results in white

This commit is contained in:
j 2023-10-28 15:03:35 +02:00
parent 4058ac84c1
commit ff752a1818
3 changed files with 49 additions and 25 deletions

View file

@ -10,6 +10,18 @@ import item.models
import itemlist.models import itemlist.models
def resolve_roman(s):
extra = re.compile('^\d+(.*?)$').findall(s)
if extra:
extra = extra[0].lower()
new = {
'i': '1', 'ii': '2', 'iii': '3', 'iv': '4', 'v': '5',
'vi': '6', 'vii': 7, 'viii': '8', 'ix': '9', 'x': '10'
}.get(extra, extra)
return s.replace(extra, new)
return s
class Command(BaseCommand): class Command(BaseCommand):
help = 'generate symlinks to clips and clips.json' help = 'generate symlinks to clips and clips.json'
@ -44,8 +56,12 @@ class Command(BaseCommand):
clip['editingtags'] = i.data.get('editingtags', []) clip['editingtags'] = i.data.get('editingtags', [])
name = os.path.basename(clip['original']) name = os.path.basename(clip['original'])
seqid = re.sub("Hotel Aporia_(\d+)", "S\\1_", name).split('_')[:2] seqid = re.sub("Hotel Aporia_(\d+)", "S\\1_", name)
seqid = re.sub("Night March_(\d+)", "S\\1_", seqid)
seqid = re.sub("_(\d+)H_(\d+)", "_S\\1\\2_", seqid)
seqid = seqid.split('_')[:2]
seqid = [b[1:] if b[0] in ('B', 'S') else '0' for b in seqid] seqid = [b[1:] if b[0] in ('B', 'S') else '0' for b in seqid]
seqid[1] = resolve_roman(seqid[1])
seqid[1] = ''.join([b for b in seqid[1] if b.isdigit()]) seqid[1] = ''.join([b for b in seqid[1] if b.isdigit()])
if not seqid[1]: if not seqid[1]:
seqid[1] = '0' seqid[1] = '0'

View file

@ -111,12 +111,9 @@ def compose(clips, target=150, base=1024, voice_over=None):
if "foreground" not in clip and "animation" in clip: if "foreground" not in clip and "animation" in clip:
fg = clip['animation'] fg = clip['animation']
transparancy = 1
else: else:
fg = clip['foreground'] fg = clip['foreground']
if 'foley' in clip:
foley = clip['foley']
else:
foley = fg
if 'foreground2' in clip: if 'foreground2' in clip:
if 'foreground3' in clip: if 'foreground3' in clip:
n = seq() n = seq()
@ -128,12 +125,16 @@ def compose(clips, target=150, base=1024, voice_over=None):
clip['foreground3'] clip['foreground3']
elif chance(seq, 0.5): elif chance(seq, 0.5):
fg = clip['foreground2'] fg = clip['foreground2']
transparancy = seq() / 10
scene['front']['V1'].append({ if 'foley' in clip:
foley = clip['foley']
else:
foley = fg
scene['front']['V2'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': fg, 'src': fg,
"filter": { "filter": {
'transparency': seq() / 10, 'transparency': transparancy,
} }
}) })
@ -145,15 +146,16 @@ def compose(clips, target=150, base=1024, voice_over=None):
else: else:
transparency_back = transparency transparency_back = transparency
transparency_front = 0 transparency_front = 0
transparency_original = seq() / 10
if "background" in clip: if "background" in clip:
scene['front']['V2'].append({ scene['front']['V1'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['background'], 'src': clip['background'],
"filter": { "filter": {
'transparency': transparency_front 'transparency': transparency_front
} }
}) })
scene['back']['V1'].append({ scene['back']['V2'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['background'], 'src': clip['background'],
"filter": { "filter": {
@ -161,27 +163,33 @@ def compose(clips, target=150, base=1024, voice_over=None):
} }
}) })
else: else:
scene['front']['V2'].append({ scene['front']['V1'].append({
'blank': True,
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['animation'],
"filter": {
'transparency': 0,
}
}) })
scene['back']['V1'].append({ scene['back']['V2'].append({
'blank': True,
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['original'],
"filter": {
'transparency': 0,
}
}) })
scene['back']['V2'].append({ scene['back']['V1'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['original'], 'src': clip['original'],
"filter": { "filter": {
'transparency': seq() / 10, 'transparency': transparency_original,
} }
}) })
# 50 % chance to blur original from 0 to 30 # 50 % chance to blur original from 0 to 30
if chance(seq, 0.5): if chance(seq, 0.5):
blur = seq() * 3 blur = seq() * 3
if blur: if blur:
scene['back']['V2'][-1]['filter']['blur'] = blur scene['back']['V1'][-1]['filter']['blur'] = blur
scene['audio']['A1'].append({ scene['audio']['A1'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['original'], 'src': clip['original'],

View file

@ -235,9 +235,9 @@ class KDEnliveProject:
["disable", "1"], ["disable", "1"],
]), ]),
]), ]),
v2 := self.get_element("playlist", children=[ v1 := self.get_element("playlist", children=[
]), ]),
v2e := self.get_element("playlist", children=[ v1e := self.get_element("playlist", children=[
]), ]),
t2 := self.get_element("tractor", attrib={ t2 := self.get_element("tractor", attrib={
"in": "00:00:00.000", "in": "00:00:00.000",
@ -249,12 +249,12 @@ class KDEnliveProject:
["kdenlive:thumbs_format", None], ["kdenlive:thumbs_format", None],
["kdenlive:audio_rec", None], ["kdenlive:audio_rec", None],
["kdenlive:locked_track", None], ["kdenlive:locked_track", None],
self.get_element("track", attrib={"hide": "audio", "producer": v2.attrib["id"]}), self.get_element("track", attrib={"hide": "audio", "producer": v1.attrib["id"]}),
self.get_element("track", attrib={"hide": "audio", "producer": v2e.attrib["id"]}), self.get_element("track", attrib={"hide": "audio", "producer": v1e.attrib["id"]}),
]), ]),
v1 := self.get_element("playlist", children=[ v2 := self.get_element("playlist", children=[
]), ]),
v1e := self.get_element("playlist", children=[ v2e := self.get_element("playlist", children=[
]), ]),
t3 := self.get_element("tractor", attrib={ t3 := self.get_element("tractor", attrib={
"in": "00:00:00.000" "in": "00:00:00.000"
@ -265,8 +265,8 @@ class KDEnliveProject:
["kdenlive:thumbs_format", None], ["kdenlive:thumbs_format", None],
["kdenlive:audio_rec", None], ["kdenlive:audio_rec", None],
["kdenlive:locked_track", None], ["kdenlive:locked_track", None],
self.get_element("track", attrib={"hide": "audio", "producer": v1.attrib["id"]}), self.get_element("track", attrib={"hide": "audio", "producer": v2.attrib["id"]}),
self.get_element("track", attrib={"hide": "audio", "producer": v1e.attrib["id"]}), self.get_element("track", attrib={"hide": "audio", "producer": v2e.attrib["id"]}),
]), ]),
sequence := self.get_element("tractor", [ sequence := self.get_element("tractor", [
["kdenlive:uuid", self._uuid], ["kdenlive:uuid", self._uuid],