fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
procent
[wolnelektury.git]
/
src
/
catalogue
/
models
/
book.py
diff --git
a/src/catalogue/models/book.py
b/src/catalogue/models/book.py
index
b14269f
..
10e9d22
100644
(file)
--- a/
src/catalogue/models/book.py
+++ b/
src/catalogue/models/book.py
@@
-331,6
+331,9
@@
class Book(models.Model):
total += app_settings.GET_MP3_LENGTH(media.file.path)
return int(total)
total += app_settings.GET_MP3_LENGTH(media.file.path)
return int(total)
+ def get_time(self):
+ return round(self.xml_file.size / 1000 * 40)
+
def has_media(self, type_):
if type_ in Book.formats:
return bool(getattr(self, "%s_file" % type_))
def has_media(self, type_):
if type_ in Book.formats:
return bool(getattr(self, "%s_file" % type_))
@@
-594,7
+597,7
@@
class Book(models.Model):
@classmethod
def from_text_and_meta(cls, raw_file, book_info, overwrite=False, dont_build=None, search_index=True,
@classmethod
def from_text_and_meta(cls, raw_file, book_info, overwrite=False, dont_build=None, search_index=True,
- remote_gallery_url=None, days=0, findable=True, logo=None, logo_mono=None):
+ remote_gallery_url=None, days=0, findable=True, logo=None, logo_mono=None
, logo_alt=None
):
from catalogue import tasks
if dont_build is None:
from catalogue import tasks
if dont_build is None:
@@
-646,6
+649,8
@@
class Book(models.Model):
extra['logo'] = logo
if logo_mono:
extra['logo_mono'] = logo_mono
extra['logo'] = logo
if logo_mono:
extra['logo_mono'] = logo_mono
+ if logo_alt:
+ extra['logo_alt'] = logo_alt
book.extra_info = json.dumps(extra)
book.load_abstract()
book.load_toc()
book.extra_info = json.dumps(extra)
book.load_abstract()
book.load_toc()