jplayer
[wolnelektury.git] / apps / catalogue / models.py
index d615fb6..112ec1b 100644 (file)
@@ -490,7 +490,7 @@ class Book(models.Model):
         cache_key = "Book.short_html/%d/%s"
         for lang, langname in settings.LANGUAGES:
             cache.delete(cache_key % (self.id, lang))
-        cache.delete(cache_key = "Book.mini_box/%d" % (self.id, ))
+        cache.delete("Book.mini_box/%d" % (self.id, ))
         # Fragment.short_html relies on book's tags, so reset it here too
         for fragm in self.fragments.all():
             fragm.reset_short_html()
@@ -513,7 +513,7 @@ class Book(models.Model):
             for ebook_format in self.ebook_formats:
                 if self.has_media(ebook_format):
                     formats.append(u'<a href="%s">%s</a>' % (
-                        "", #self.get_media(ebook_format).url,
+                        self.get_media(ebook_format).url,
                         ebook_format.upper()
                     ))
 
@@ -723,10 +723,10 @@ class Book(models.Model):
                     getattr(settings, "ALL_%s_ZIP" % format_.upper()))
         return result.wait()
 
-    def zip_audiobooks(self):
-        bm = BookMedia.objects.filter(book=self, type='mp3')
+    def zip_audiobooks(self, format_):
+        bm = BookMedia.objects.filter(book=self, type=format_)
         paths = map(lambda bm: (None, bm.file.path), bm)
-        result = create_zip.delay(paths, self.fileid())
+        result = create_zip.delay(paths, "%s_%s" % (self.fileid(), format_))
         return result.wait()
 
     @classmethod