more models

This commit is contained in:
j 2026-01-29 16:59:45 +01:00
commit de484af2ae
2 changed files with 237 additions and 22 deletions

View file

@ -1112,3 +1112,27 @@ def update_unused():
l.add(i)
for i in l.items.filter(public_id__in=set(used)):
l.remove(i)
def unused_tags():
import itemlist.models
import item.models
prefix = default_prefix
with open(os.path.join(prefix, "clips.json")) as fd:
clips = json.load(fd)
with open(os.path.join(prefix, "voice_over.json")) as fd:
voice_over = json.load(fd)
fragments = get_fragments(clips, voice_over, prefix)
tags = []
for fragment in fragments:
tags += fragment['tags']
used_tags = set(tags)
all_tags = {t.value for t in item.models.Facet.objects.filter(key='tags').distinct()}
unused_tags = all_tags - used_tags
unused_items = itemlist.models.List.objects.get(name='Unused Material').items.all()
with open("/srv/pandora/static/power/unused-tags.txt", "w") as fd:
for tag in sorted(unused_tags):
count = unused_items.filter(data__tags__contains=tag).count()
fd.write("%s (%d unused video clips)\n" % (tag, count))