From: Radek Czajka Date: Thu, 23 Dec 2021 08:20:46 +0000 (+0100) Subject: fixes X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/fccf7669328b236987c1c49c03e35d3916c0093c?ds=inline;hp=ad43f8a3a57a3bb73edefe7e815328676cabcdb1 fixes --- diff --git a/src/archive/models.py b/src/archive/models.py index c8a1dc7..aa84ce4 100644 --- a/src/archive/models.py +++ b/src/archive/models.py @@ -230,12 +230,12 @@ class Audiobook(models.Model): 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 diff --git a/src/youtube/migrations/0012_move_thumbnail_definitions.py b/src/youtube/migrations/0012_move_thumbnail_definitions.py index a54cf12..15909f0 100644 --- a/src/youtube/migrations/0012_move_thumbnail_definitions.py +++ b/src/youtube/migrations/0012_move_thumbnail_definitions.py @@ -18,7 +18,7 @@ def move_definitions(apps, schema_editor): 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'] diff --git a/src/youtube/thumbnail.py b/src/youtube/thumbnail.py index e40b552..c64e5b5 100644 --- a/src/youtube/thumbnail.py +++ b/src/youtube/thumbnail.py @@ -70,7 +70,7 @@ def draw_box_with_scaling(img, d, context, get_font_path): 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()