not i
This commit is contained in:
parent
ce47e23e18
commit
d40666408e
2 changed files with 23 additions and 19 deletions
23
generate.py
23
generate.py
|
|
@ -741,19 +741,19 @@ def wan_animate_replace(item, character, keep=False):
|
||||||
shutil.rmtree(os.path.dirname(output))
|
shutil.rmtree(os.path.dirname(output))
|
||||||
return ai
|
return ai
|
||||||
|
|
||||||
def ltx_a2v(item, character, prompt=None, keep=False):
|
def ltx_a2v(item, character, prompt=None, first_frame=None, keep=False):
|
||||||
video_url = public_video_url(item)
|
video_url = public_video_url(item)
|
||||||
audio_path = item.streams()[0].file.data.path
|
audio_path = item.streams()[0].file.data.path
|
||||||
character = get_character_document(character)
|
if first_frame is None:
|
||||||
|
character = get_character_document(character)
|
||||||
position = 0
|
position = 0
|
||||||
cid = get_character_document(character).get_id()
|
cid = get_character_document(character).get_id()
|
||||||
first_frame = item.documents.filter(
|
first_frame = item.documents.filter(
|
||||||
data__character=cid,
|
data__character=cid,
|
||||||
data__position=position
|
data__position=position
|
||||||
).order_by('-created').first()
|
).order_by('-created').first()
|
||||||
if not first_frame:
|
if not first_frame:
|
||||||
first_frame = replace_character(item, character, position)
|
first_frame = replace_character(item, character, position)
|
||||||
image_url = public_document_url(first_frame)
|
image_url = public_document_url(first_frame)
|
||||||
prefix = "/srv/pandora/static/power/cache/%s_a2v" % (item.public_id)
|
prefix = "/srv/pandora/static/power/cache/%s_a2v" % (item.public_id)
|
||||||
os.makedirs(prefix, exist_ok=True)
|
os.makedirs(prefix, exist_ok=True)
|
||||||
|
|
@ -788,6 +788,7 @@ def ltx_a2v(item, character, prompt=None, keep=False):
|
||||||
ox.net.save_url(output_url, output, overwrite=True)
|
ox.net.save_url(output_url, output, overwrite=True)
|
||||||
ai = add_ai_variant(item, output, "ai:audio-to-video")
|
ai = add_ai_variant(item, output, "ai:audio-to-video")
|
||||||
ai.data["model"] = model
|
ai.data["model"] = model
|
||||||
|
ai.data["prompt"] = prompt
|
||||||
ai.data["seed"] = result["seed"]
|
ai.data["seed"] = result["seed"]
|
||||||
ai.save()
|
ai.save()
|
||||||
first_frame.add(ai)
|
first_frame.add(ai)
|
||||||
|
|
|
||||||
19
render.py
19
render.py
|
|
@ -418,17 +418,17 @@ def get_fragments(clips, voice_over, prefix):
|
||||||
if "conditions" in con:
|
if "conditions" in con:
|
||||||
for sub in con["conditions"]:
|
for sub in con["conditions"]:
|
||||||
if sub['key'] == "tags" and sub['operator'] == '==':
|
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'] == '!=':
|
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', ''):
|
elif sub['key'] == 'type' and sub['value'] in ('source', ''):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
print(l.name, 'unknown sub condition', sub)
|
print(l.name, 'unknown sub condition', sub)
|
||||||
elif con.get('key') == "tags" and con['operator'] == '==':
|
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'] == '!=':
|
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])
|
fragment["id"] = int(fragment['name'].split(' ')[0])
|
||||||
sources = []
|
sources = []
|
||||||
|
|
@ -729,7 +729,7 @@ def render_all(options):
|
||||||
join_subtitles(base_prefix, options)
|
join_subtitles(base_prefix, options)
|
||||||
|
|
||||||
print("Duration - Target: %s Actual: %s" % (target_position, position))
|
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:
|
with open(_cache, "w") as fd:
|
||||||
json.dump(_CACHE, fd)
|
json.dump(_CACHE, fd)
|
||||||
|
|
||||||
|
|
@ -983,7 +983,7 @@ def generate_clips(options):
|
||||||
continue
|
continue
|
||||||
cd = format_duration(clip["duration"], fps)
|
cd = format_duration(clip["duration"], fps)
|
||||||
clip["duration"] = cd
|
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', '')
|
adjust_volume = i.data.get('adjustvolume', '')
|
||||||
if adjust_volume:
|
if adjust_volume:
|
||||||
clip['volume'] = float(adjust_volume)
|
clip['volume'] = float(adjust_volume)
|
||||||
|
|
@ -1126,13 +1126,16 @@ def unused_tags():
|
||||||
voice_over = json.load(fd)
|
voice_over = json.load(fd)
|
||||||
fragments = get_fragments(clips, voice_over, prefix)
|
fragments = get_fragments(clips, voice_over, prefix)
|
||||||
tags = []
|
tags = []
|
||||||
|
anti_tags = []
|
||||||
|
|
||||||
for fragment in fragments:
|
for fragment in fragments:
|
||||||
tags += fragment['tags']
|
tags += fragment['tags']
|
||||||
|
anti_tags += fragment['anti-tags']
|
||||||
|
|
||||||
used_tags = set(tags)
|
used_tags = set(tags)
|
||||||
all_tags = {t.value for t in item.models.Facet.objects.filter(key='tags').distinct()}
|
used_anti_tags = set(anti_tags)
|
||||||
unused_tags = all_tags - used_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()
|
unused_items = itemlist.models.List.objects.get(name='Unused Material').items.all()
|
||||||
with open("/srv/pandora/static/power/unused-tags.txt", "w") as fd:
|
with open("/srv/pandora/static/power/unused-tags.txt", "w") as fd:
|
||||||
for tag in sorted(unused_tags):
|
for tag in sorted(unused_tags):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue