def save(self, *args, **kwargs): from tasks import encode_media, upload_media if not self.id: self.file_type = "audio" super(Audio, self).save(*args, **kwargs) if self.encode and (not self.encoded): encode_media.delay(self.id, callback=subtask(upload_media))
def save(self, make_thumbnail=True, *args, **kwargs): from tasks import encode_media, generate_thumbnail, upload_media if not self.id: self.file_type = "video" super(Video, self).save(*args, **kwargs) if self.encode and (not self.encoded): #encode then upload encode_media.delay(self.id, callback=subtask(upload_media)) if self.auto_thumbnail and make_thumbnail: generate_thumbnail.delay(self.id)
def save(self, make_thumbnail=True, *args, **kwargs): from tasks import encode_media, generate_thumbnail, upload_media if not self.id: self.file_type = "video" super(Video, self).save(*args, **kwargs) if self.encode and (not self.encoded): # encode then upload encode_media.delay(self.id, callback=subtask(upload_media)) if self.auto_thumbnail and make_thumbnail: generate_thumbnail.delay(self.id)
def encode_again(self, request, queryset): rows_updated = 0 for media in queryset: if media.encode: rows_updated += 1 encode_media.delay(media.id, callback=subtask(upload_media)) media.encoded = False media.uploaded = False media.encoding = True media.save() if rows_updated == 1: message_bit = "Your file is" elif rows_updated > 1: message_bit = "Your files are" if rows_updated > 0: messages.success(request, "%s being encoded and uploaded. An email notification will be sent when complete." % message_bit)
def encode_again(self, request, queryset): rows_updated = 0 for media in queryset: if media.encode: rows_updated += 1 encode_media.delay(media.id, callback=subtask(upload_media)) media.encoded = False media.uploaded = False media.encoding = True media.save() if rows_updated == 1: message_bit = "Your file is" elif rows_updated > 1: message_bit = "Your files are" if rows_updated > 0: messages.success( request, "%s being encoded and uploaded. An email notification will be sent when complete." % message_bit)