| 2094 | } |
| 2095 | |
| 2096 | def _operations_to_media_refs( |
| 2097 | self, |
| 2098 | operations: List[Dict[str, Any]], |
| 2099 | ) -> List[Dict[str, str]]: |
| 2100 | media_refs: List[Dict[str, str]] = [] |
| 2101 | for operation in operations or []: |
| 2102 | if not isinstance(operation, dict): |
| 2103 | continue |
| 2104 | operation_body = operation.get("operation") or {} |
| 2105 | media_name = ( |
| 2106 | operation.get("mediaName") |
| 2107 | or operation.get("name") |
| 2108 | or operation_body.get("name") |
| 2109 | ) |
| 2110 | project_id = ( |
| 2111 | operation.get("projectId") |
| 2112 | or operation.get("project_id") |
| 2113 | or operation_body.get("projectId") |
| 2114 | ) |
| 2115 | if isinstance(media_name, str) and media_name.strip() and isinstance(project_id, str) and project_id.strip(): |
| 2116 | media_refs.append({ |
| 2117 | "name": media_name.strip(), |
| 2118 | "projectId": project_id.strip(), |
| 2119 | }) |
| 2120 | return media_refs |
| 2121 | |
| 2122 | async def generate_video_text( |
| 2123 | self, |