8000 fix: callback data · video-db/videodb-python@d0ed510 · GitHub
[go: up one dir, main page]

Skip to content

Commit d0ed510

Browse files
committed
fix: callback data
1 parent 867249a commit d0ed510

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

videodb/collection.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ def translate_video(
199199
path=f"{ApiPath.collection}/{self.id}/{ApiPath.video}/{video_id}/{ApiPath.translate}",
200200
data={"language_code": language_code, "callback_url": callback_url},
201201
)
202-
return translate_data.get("translated_text")
202+
if translate_data:
203+
return translate_data.get("translated_text")
203204

204205
def generate_image(
205206
self,
@@ -223,7 +224,8 @@ def generate_image(
223224
"callback_url": callback_url,
224225
},
225226
)
226-
return Image(self._connection, **image_data)
227+
if image_data:
228+
return Image(self._connection, **image_data)
227229

228230
def generate_music(
229231
self, prompt: str, duration: int = 5, callback_url: Optional[str] = None
@@ -245,7 +247,8 @@ def generate_music(
245247
"callback_url": callback_url,
246248
},
247249
)
248-
return Audio(self._connection, **audio_data)
250+
if audio_data:
251+
return Audio(self._connection, **audio_data)
249252

250253
def generate_sound_effect(
251254
self, prompt: str, duration: int = 2, callback_url: Optional[str] = None
@@ -267,7 +270,8 @@ def generate_sound_effect(
267270
"callback_url": callback_url,
268271
},
269272
)
270-
return Audio(self._connection, **audio_data)
273+
if audio_data:
274+
return Audio(self._connection, **audio_data)
271275

272276
def generate_text_to_speech(
273277
self, text: str, callback_url: Optional[str] = None
@@ -287,7 +291,8 @@ def generate_text_to_speech(
287291
"callback_url": callback_url,
288292
},
289293
)
290-
return Audio(self._connection, **audio_data)
294+
if audio_data:
295+
return Audio(self._connection, **audio_data)
291296

292297
def dub_video(
293298
self, video_id: str, language_code: str, callback_url: Optional[str] = None
@@ -300,7 +305,8 @@ def dub_video(
300305
"callback_url": callback_url,
301306
},
302307
)
303-
return Video(self._connection, **dub_data)
308+
if dub_data:
309+
return Video(self._connection, **dub_data)
304310

305311
def search(
306312
self,

0 commit comments

Comments
 (0)
0