mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-06 07:28:53 -05:00
ref
This commit is contained in:
parent
1fbdb86bac
commit
143834dcbd
@ -1222,17 +1222,17 @@ class Encoding(models.Model):
|
|||||||
|
|
||||||
super(Encoding, self).save(*args, **kwargs)
|
super(Encoding, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def update_size_without_save(self):
|
def update_size_without_save(self):
|
||||||
"""Update the size of an encoding without saving to avoid calling signals"""
|
"""Update the size of an encoding without saving to avoid calling signals"""
|
||||||
if self.media_file:
|
if self.media_file:
|
||||||
cmd = ["stat", "-c", "%s", self.media_file.path]
|
cmd = ["stat", "-c", "%s", self.media_file.path]
|
||||||
stdout = helpers.run_command(cmd).get("out")
|
stdout = helpers.run_command(cmd).get("out")
|
||||||
if stdout:
|
if stdout:
|
||||||
size = int(stdout.strip())
|
size = int(stdout.strip())
|
||||||
size = helpers.show_file_size(size)
|
size = helpers.show_file_size(size)
|
||||||
Encoding.objects.filter(pk=self.pk).update(size=size)
|
Encoding.objects.filter(pk=self.pk).update(size=size)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def set_progress(self, progress, commit=True):
|
def set_progress(self, progress, commit=True):
|
||||||
if isinstance(progress, int):
|
if isinstance(progress, int):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user