get all originals, also get those with only animation player
This commit is contained in:
parent
056bc1e6ba
commit
198934e465
1 changed files with 17 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import os
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
@ -18,9 +19,9 @@ class Command(BaseCommand):
|
|||
def handle(self, **options):
|
||||
prefix = options['prefix']
|
||||
clips = []
|
||||
for i in item.models.Item.objects.filter(data__type__contains="Original"):
|
||||
for i in item.models.Item.objects.filter(sort__type='original'):
|
||||
qs = item.models.Item.objects.filter(data__title=i.data['title']).exclude(id=i.id)
|
||||
if qs.count() >= 2:
|
||||
if qs.count() >= 1:
|
||||
clip = {}
|
||||
durations = []
|
||||
for e in item.models.Item.objects.filter(data__title=i.data['title']):
|
||||
|
@ -41,6 +42,18 @@ class Command(BaseCommand):
|
|||
clip["duration"] = min(durations)
|
||||
clip['tags'] = i.data.get('tags', [])
|
||||
clip['editingtags'] = i.data.get('editingtags', [])
|
||||
name = os.path.basename(clip['original'])
|
||||
|
||||
seqid = re.sub("Hotel Aporia_(\d+)", "S\\1_", name).split('_')[:2]
|
||||
seqid = [b[1:] if b[0] in ('B', 'S') else '0' for b in seqid]
|
||||
seqid[1] = ''.join([b for b in seqid[1] if b.isdigit()])
|
||||
if not seqid[1]:
|
||||
seqid[1] = '0'
|
||||
try:
|
||||
clip['seqid'] = int(''.join(['%06d' % int(b) for b in seqid]))
|
||||
except:
|
||||
print(name, seqid, 'failed')
|
||||
raise
|
||||
if "original" in clip and "foreground" in clip and "background" in clip:
|
||||
clips.append(clip)
|
||||
elif "original" in clip and "animation" in clip:
|
||||
|
@ -51,6 +64,8 @@ class Command(BaseCommand):
|
|||
with open(os.path.join(prefix, 'clips.json'), 'w') as fd:
|
||||
json.dump(clips, fd, indent=2, ensure_ascii=False)
|
||||
|
||||
print("using", len(clips), "clips")
|
||||
|
||||
voice_over = defaultdict(dict)
|
||||
for vo in item.models.Item.objects.filter(
|
||||
data__type__contains="Voice Over",
|
||||
|
|
Loading…
Reference in a new issue