Skip to content

Commit

Permalink
Merge pull request #934 from AI4Bharat/minorchange01
Browse files Browse the repository at this point in the history
fix a bug in VOTR task completion
  • Loading branch information
aparna-aa authored Nov 12, 2024
2 parents 8afb7f8 + 4d4a045 commit 7a0a6b0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions backend/voiceover/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,23 @@ def integrate_all_audios(file_name, payload, video_duration):
final_audio.export(
file_name + "_" + str(previous_index) + ".ogg", format="ogg"
)
if "time_difference" not in payload["payload"][str(index)]:
start_time = payload["payload"][str(index)]["start_time"]
end_time = payload["payload"][str(index)]["end_time"]
time_difference = (
datetime.strptime(end_time, "%H:%M:%S.%f")
- timedelta(
hours=float(start_time.split(":")[0]),
minutes=float(start_time.split(":")[1]),
seconds=float(start_time.split(":")[-1]),
)
).strftime("%H:%M:%S.%f")
t_d = (
int(time_difference.split(":")[0]) * 3600
+ int(time_difference.split(":")[1]) * 60
+ float(time_difference.split(":")[2])
)
payload["payload"][str(index)]["time_difference"] = t_d
if index == length_payload - 1:
original_time = payload["payload"][str(index)]["time_difference"]
end_time = payload["payload"][str(index)]["end_time"]
Expand Down

0 comments on commit 7a0a6b0

Please sign in to comment.