X-Git-Url: https://git.mdrn.pl/audio.git/blobdiff_plain/c175a7540d20336179dfd453183bfe69e6f5827e..3bb77aad08a5558125b1cc80a599135d0e68eeda:/apps/archive/tasks.py diff --git a/apps/archive/tasks.py b/apps/archive/tasks.py index ae73930..1b2be74 100644 --- a/apps/archive/tasks.py +++ b/apps/archive/tasks.py @@ -4,6 +4,7 @@ import mimetypes import os import os.path import pipes +import stat import subprocess from tempfile import NamedTemporaryFile from time import sleep @@ -58,6 +59,7 @@ class AudioFormatTask(Task): ExistingFile(file_name), save=False ) + os.chmod(getattr(audiobook, field).path, stat.S_IREAD|stat.S_IWRITE|stat.S_IRGRP|stat.S_IROTH) Audiobook.objects.filter(pk=audiobook.pk).update( **{field: getattr(audiobook, field)}) @@ -110,7 +112,6 @@ class AudioFormatTask(Task): self.set_status(aid, status.TAGGING) self.set_tags(audiobook, out_file.name) self.set_status(aid, status.SENDING) - self.save(audiobook, out_file.name) if publish: self.put(audiobook, out_file.name) @@ -118,6 +119,8 @@ class AudioFormatTask(Task): else: self.set_status(aid, None) + self.save(audiobook, out_file.name) + def on_failure(self, exc, task_id, args, kwargs, einfo): aid = (args[0], kwargs.get('aid'))[0] self.set_status(aid, None)