self.mp3_status = self.ogg_status = status.WAITING
self.save()
- def publish(self, user):
+ def publish(self, user, publish=True):
from . import tasks
# isn't there a race here?
- self.mp3_task = tasks.Mp3Task.delay(user.id, self.pk, publish).task_id
- self.ogg_task = tasks.OggTask.delay(user.id, self.pk, publish).task_id
- audiobook.save()
+ self.mp3_task = tasks.Mp3Task.delay(user.id, self.pk, publish=publish).task_id
+ self.ogg_task = tasks.OggTask.delay(user.id, self.pk, publish=publish).task_id
+ self.save()
def get_source_sha1(self):
assert self.pk or self.source_sha1
ThumbnailTemplate = apps.get_model('youtube', 'ThumbnailTemplate')
order = 1
for youtube in YouTube.objects.all():
- src_def = yaml.load(youtube.thumbnail_definition)
+ src_def = yaml.safe_load(youtube.thumbnail_definition)
version_lists = [
box['versions']
for box in src_def['boxes']
def create_thumbnail(background_path, defn, context, get_font_path):
img = Image.open(background_path)
- d = yaml.load(defn)
+ d = yaml.safe_load(defn)
for boxdef in d['boxes']:
if not draw_box_with_scaling(img, boxdef, context, get_font_path):
raise ValueError()