이미지 부족 시 duplicate 기능 추가
parent
7b00d21a34
commit
24534ccb3e
|
|
@ -436,6 +436,20 @@ class CreatomateService:
|
|||
return tag_list
|
||||
|
||||
|
||||
def counting_component(
|
||||
self,
|
||||
template : dict,
|
||||
target_template_type : str
|
||||
) -> list:
|
||||
source_elements = template["source"]["elements"]
|
||||
template_component_data = self.parse_template_component_name(source_elements)
|
||||
count = 0
|
||||
|
||||
for _, (_, template_type) in enumerate(template_component_data.items()):
|
||||
if template_type == target_template_type:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
def template_matching_taged_image(
|
||||
self,
|
||||
template : dict,
|
||||
|
|
|
|||
|
|
@ -350,12 +350,18 @@ async def generate_video(
|
|||
# music_url=music_url,
|
||||
# address=store_address
|
||||
taged_image_list = await get_image_tags_by_task_id(task_id)
|
||||
min_image_num = creatomate_service.counting_component(
|
||||
template = template,
|
||||
target_template_type = "image"
|
||||
)
|
||||
duplicate = bool(len(taged_image_list) < min_image_num)
|
||||
logger.info(f"[generate_video] Duplicate : {duplicate} | length of taged_image {len(taged_image_list)}, min_len {min_image_num},- task_id: {task_id}")
|
||||
modifications = creatomate_service.template_matching_taged_image(
|
||||
template = template,
|
||||
taged_image_list = taged_image_list,
|
||||
music_url = music_url,
|
||||
address = store_address,
|
||||
duplicate = False,
|
||||
duplicate = duplicate,
|
||||
)
|
||||
logger.debug(f"[generate_video] Modifications created - task_id: {task_id}")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue