mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-09 00:48:54 -05:00
refactor
This commit is contained in:
parent
8f31320f65
commit
5123ea7f8d
@ -461,7 +461,6 @@ def copy_video(original_media, copy_encodings=True, title_suffix="(Trimmed)"):
|
|||||||
)
|
)
|
||||||
models.Encoding.objects.bulk_create([new_encoding])
|
models.Encoding.objects.bulk_create([new_encoding])
|
||||||
# avoids calling signals
|
# avoids calling signals
|
||||||
update_encoding_size.delay(new_encoding.id)
|
|
||||||
|
|
||||||
# Copy categories and tags
|
# Copy categories and tags
|
||||||
for category in original_media.category.all():
|
for category in original_media.category.all():
|
||||||
|
|||||||
@ -811,7 +811,6 @@ def remove_media_file(media_file=None):
|
|||||||
@task(name="update_encoding_size", queue="short_tasks")
|
@task(name="update_encoding_size", queue="short_tasks")
|
||||||
def update_encoding_size(encoding_id):
|
def update_encoding_size(encoding_id):
|
||||||
"""Update the size of an encoding"""
|
"""Update the size of an encoding"""
|
||||||
logger.info(f"Updating size for encoding {encoding_id}")
|
|
||||||
try:
|
try:
|
||||||
encoding = Encoding.objects.get(id=encoding_id)
|
encoding = Encoding.objects.get(id=encoding_id)
|
||||||
encoding.update_size()
|
encoding.update_size()
|
||||||
@ -933,6 +932,7 @@ def video_trim_task(self, trim_request_id):
|
|||||||
encodings = new_media.encodings.filter(status="success", profile__extension='mp4', chunk=False)
|
encodings = new_media.encodings.filter(status="success", profile__extension='mp4', chunk=False)
|
||||||
for encoding in encodings:
|
for encoding in encodings:
|
||||||
trim_result = trim_video_method(encoding.media_file.path, [timestamp])
|
trim_result = trim_video_method(encoding.media_file.path, [timestamp])
|
||||||
|
update_encoding_size.delay(encoding.id)
|
||||||
|
|
||||||
new_media.set_media_type()
|
new_media.set_media_type()
|
||||||
create_hls.delay(new_media.friendly_token)
|
create_hls.delay(new_media.friendly_token)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user