This commit is contained in:
Markos Gogoulos
2025-05-21 19:16:48 +03:00
parent 621d2bfcec
commit 943cb9a807
2 changed files with 12 additions and 18 deletions

View File

@ -464,7 +464,7 @@ def copy_video(original_media, copy_encodings=True, title_suffix="(Trimmed)"):
if copy_encodings:
for encoding in original_media.encodings.filter(chunk=False):
for encoding in original_media.encodings.filter(chunk=False, status="success"):
if encoding.media_file:
with open(encoding.media_file.path, "rb") as f:
myfile = File(f)
@ -472,7 +472,7 @@ def copy_video(original_media, copy_encodings=True, title_suffix="(Trimmed)"):
media_file=myfile,
media=new_media,
profile=encoding.profile,
status=encoding.status,
status="success",
progress=100,
chunk=False,
logs=f"Copied from encoding {encoding.id}"

View File

@ -974,14 +974,11 @@ def video_trim_task(self, trim_request_id):
encoding.delete()
deleted_encodings = handle_pending_running_encodings(target_media)
if deleted_encodings:
# give the chance to run encodings for encodings that didnt make it
target_media.encode(force=False)
trim_request_status = "running"
# TODO: find way to call post_trim_action only after this has finished...
else:
post_trim_action.delay(target_media.friendly_token)
trim_request_status = "success"
# give the chance to run encodings for encodings that didnt make it
target_media.encode(force=False)
trim_request_status = "running"
# TODO: find way to call post_trim_action only after this has finished...
post_trim_action.delay(target_media.friendly_token)
trim_request.status = trim_request_status
trim_request.save(update_fields=["status"])
@ -1001,14 +998,11 @@ def video_trim_task(self, trim_request_id):
encoding.delete()
deleted_encodings = handle_pending_running_encodings(target_media)
if deleted_encodings:
# give the chance to run encodings for encodings that didnt make it
target_media.encode(force=False)
trim_request_status = "running"
# TODO: find way to call post_trim_action only after this has finished...
else:
post_trim_action.delay(target_media.friendly_token)
trim_request_status = "success"
# give the chance to run encodings for encodings that didnt make it
target_media.encode(force=False)
trim_request_status = "running"
# TODO: find way to call post_trim_action only after this has finished...
post_trim_action.delay(target_media.friendly_token)
trim_request.status = trim_request_status
trim_request.save(update_fields=["status"])