mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-07-25 15:03:31 +00:00
feat
This commit is contained in:
@ -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}"
|
||||
|
@ -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"])
|
||||
|
Reference in New Issue
Block a user