fixes
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 23 Dec 2021 08:20:46 +0000 (09:20 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 23 Dec 2021 08:22:16 +0000 (09:22 +0100)
src/archive/models.py
src/youtube/migrations/0012_move_thumbnail_definitions.py
src/youtube/thumbnail.py

index c8a1dc7..aa84ce4 100644 (file)
@@ -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
index a54cf12..15909f0 100644 (file)
@@ -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']
index e40b552..c64e5b5 100644 (file)
@@ -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()