fnp
/
audio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
fbd02d5
)
Conditionally add parent book title on thumbnail.
author
Radek Czajka
<rczajka@rczajka.pl>
Tue, 16 Mar 2021 13:09:13 +0000
(14:09 +0100)
committer
Radek Czajka
<rczajka@rczajka.pl>
Tue, 16 Mar 2021 13:09:13 +0000
(14:09 +0100)
src/youtube/models.py
patch
|
blob
|
history
diff --git
a/src/youtube/models.py
b/src/youtube/models.py
index
df071f1
..
32d5f04
100644
(file)
--- a/
src/youtube/models.py
+++ b/
src/youtube/models.py
@@
-232,12
+232,18
@@
class ThumbnailTemplate(models.Model):
def generate(self, audiobook):
try:
def generate(self, audiobook):
try:
+ title = audiobook.book['title']
+ if audiobook.book.get('parent'):
+ parent_title = audiobook.book['parent']['title']
+ if not title.startswith(parent_title):
+ title = ", ".join((parent_title, title))
+
img = create_thumbnail(
self.background.path,
self.definition,
{
"author": ', '.join((a['name'] for a in audiobook.book['authors'])),
img = create_thumbnail(
self.background.path,
self.definition,
{
"author": ', '.join((a['name'] for a in audiobook.book['authors'])),
- "title":
audiobook.book['title']
,
+ "title":
title
,
"part": (audiobook.youtube_volume or audiobook.part_name).strip(),
},
lambda name: Font.objects.get(name=name).truetype.path
"part": (audiobook.youtube_volume or audiobook.part_name).strip(),
},
lambda name: Font.objects.get(name=name).truetype.path