skip more

This commit is contained in:
j 2026-02-02 09:43:14 +01:00
commit 74b1b57951

View file

@ -957,11 +957,13 @@ def generate_clips(options):
prefix = options['prefix'] prefix = options['prefix']
lang, tlang = parse_lang(options["lang"]) lang, tlang = parse_lang(options["lang"])
clips = [] clips = []
skip = []
remove_from_edit = itemlist.models.List.objects.filter(name='Remove from Edit').first() remove_from_edit = itemlist.models.List.objects.filter(name='Remove from Edit').first()
if remove_from_edit: if remove_from_edit:
skip = [i.public_id for i in remove_from_edit.get_items(remove_from_edit.user).all()] skip = [i.public_id for i in remove_from_edit.get_items(remove_from_edit.user).all()]
else: not_yet = itemlist.models.List.objects.filter(name='Not yet').first()
skip = [] if not_yet:
skip += [i.public_id for i in not_yet.get_items(not_yet.user).all()]
for i in item.models.Item.objects.filter(sort__type='source'): for i in item.models.Item.objects.filter(sort__type='source'):
if i.public_id in skip: if i.public_id in skip:
continue continue
@ -1210,6 +1212,13 @@ def fragment_statistics():
with open(os.path.join(prefix, "clips.json")) as fd: with open(os.path.join(prefix, "clips.json")) as fd:
clips = json.load(fd) clips = json.load(fd)
skip = []
remove_from_edit = itemlist.models.List.objects.filter(name='Remove from Edit').first()
if remove_from_edit:
skip += [i.public_id for i in remove_from_edit.get_items(remove_from_edit.user).all()]
not_yet = itemlist.models.List.objects.filter(name='Not yet').first()
if not_yet:
skip += [i.public_id for i in not_yet.get_items(not_yet.user).all()]
for l in itemlist.models.List.objects.filter(status='featured').order_by('name'): for l in itemlist.models.List.objects.filter(status='featured').order_by('name'):
if l.name.split(' ')[0].isdigit(): if l.name.split(' ')[0].isdigit():
@ -1246,6 +1255,8 @@ def fragment_statistics():
duration[fragment_id] = ai_duration[fragment_id] = 0 duration[fragment_id] = ai_duration[fragment_id] = 0
for item in l.get_items(l.user).all(): for item in l.get_items(l.user).all():
if item.public_id in skip:
continue
item_tags = [t.lower().strip() for t in item.get('tags')] item_tags = [t.lower().strip() for t in item.get('tags')]
if set(item_tags) & set(fragment['anti-tags']): if set(item_tags) & set(fragment['anti-tags']):
continue continue
@ -1253,7 +1264,11 @@ def fragment_statistics():
if tag in item_tags: if tag in item_tags:
stats[fragment_id][tag] += 1 stats[fragment_id][tag] += 1
duration[fragment_id] += item.sort.duration duration[fragment_id] += item.sort.duration
for ai in Item.objects.filter(data__title=item.data['title']).filter(data__type__icontains='ai:'): for ai in Item.objects.filter(
data__title=item.data['title']
).filter(data__type__icontains='ai:').exclude(
public_id__in=skip
):
ai_duration[fragment_id] += ai.sort.duration ai_duration[fragment_id] += ai.sort.duration
with open("/srv/pandora/static/power/fragments.txt", "w") as fd: with open("/srv/pandora/static/power/fragments.txt", "w") as fd:
for fragment, data in stats.items(): for fragment, data in stats.items():