This commit is contained in:
j 2026-01-30 08:38:05 +01:00
commit d40666408e
2 changed files with 23 additions and 19 deletions

View file

@ -418,17 +418,17 @@ def get_fragments(clips, voice_over, prefix):
if "conditions" in con:
for sub in con["conditions"]:
if sub['key'] == "tags" and sub['operator'] == '==':
fragment['tags'].append(sub['value'])
fragment['tags'].append(sub['value'].lower().strip())
elif sub['key'] == "tags" and sub['operator'] == '!=':
fragment['tags'].append(sub['value'])
fragment['tags'].append(sub['value'].lower().strip())
elif sub['key'] == 'type' and sub['value'] in ('source', ''):
pass
else:
print(l.name, 'unknown sub condition', sub)
elif con.get('key') == "tags" and con['operator'] == '==':
fragment['tags'].append(con['value'])
fragment['tags'].append(con['value'].lower().strip())
elif con.get('key') == "tags" and con['operator'] == '!=':
fragment['anti-tags'].append(con['value'])
fragment['anti-tags'].append(con['value'].lower().strip())
fragment["id"] = int(fragment['name'].split(' ')[0])
sources = []
@ -729,7 +729,7 @@ def render_all(options):
join_subtitles(base_prefix, options)
print("Duration - Target: %s Actual: %s" % (target_position, position))
print(json.dumps(dict(stats), sort_keys=True, indent=2))
#print(json.dumps(dict(stats), sort_keys=True, indent=2))
with open(_cache, "w") as fd:
json.dump(_CACHE, fd)
@ -983,7 +983,7 @@ def generate_clips(options):
continue
cd = format_duration(clip["duration"], fps)
clip["duration"] = cd
clip['tags'] = i.data.get('tags', [])
clip['tags'] = [t.lower().strip() for t in i.data.get('tags', [])]
adjust_volume = i.data.get('adjustvolume', '')
if adjust_volume:
clip['volume'] = float(adjust_volume)
@ -1126,13 +1126,16 @@ def unused_tags():
voice_over = json.load(fd)
fragments = get_fragments(clips, voice_over, prefix)
tags = []
anti_tags = []
for fragment in fragments:
tags += fragment['tags']
anti_tags += fragment['anti-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
used_anti_tags = set(anti_tags)
all_tags = {t.value.strip().lower() for t in item.models.Facet.objects.filter(key='tags').distinct()}
unused_tags = all_tags - used_tags - used_anti_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):