This commit is contained in:
Markos Gogoulos 2025-05-15 22:48:07 +03:00
parent 1fbdb86bac
commit 143834dcbd

View File

@ -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):