fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b485e5f
)
Legimi
author
Radek Czajka
<rczajka@rczajka.pl>
Mon, 4 Apr 2022 09:30:40 +0000
(11:30 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Mon, 4 Apr 2022 09:30:40 +0000
(11:30 +0200)
src/depot/legimi.py
patch
|
blob
|
history
diff --git
a/src/depot/legimi.py
b/src/depot/legimi.py
index
01f4ee2
..
a41902a
100644
(file)
--- a/
src/depot/legimi.py
+++ b/
src/depot/legimi.py
@@
-86,11
+86,11
@@
class Legimi:
"Author": ", ".join(p.readable() for p in meta.authors),
"Year": meta.created_at[:4],
"Author": ", ".join(p.readable() for p in meta.authors),
"Year": meta.created_at[:4],
- 'GenreId':
'11', # TODO
+ 'GenreId':
str(self.get_genre(wlbook)),
'Isbn': '',
'LanguageLocale': lang_code_3to2(meta.language),
'Isbn': '',
'LanguageLocale': lang_code_3to2(meta.language),
- 'Description':
description_add
,
+ 'Description':
self.get_description(wlbook)
,
}
if meta.isbn_html:
isbn = meta.isbn_html
}
if meta.isbn_html:
isbn = meta.isbn_html
@@
-101,11
+101,6
@@
class Legimi:
files_data = {}
files_data = {}
- abstract = wlbook.tree.find('.//abstrakt')
- if abstract is not None:
- book_data['Description'] = transform_abstrakt(abstract)
-
-
cover_data = self.upload(
(meta.url.slug + '.jpg', cover.get_file(), 'image/jpeg')
)
cover_data = self.upload(
(meta.url.slug + '.jpg', cover.get_file(), 'image/jpeg')
)
@@
-198,6
+193,25
@@
class Legimi:
description += '</p>'
return description
description += '</p>'
return description
+ def get_genre(self, wlbook):
+ epoch_map = {
+ 'Starożytność': 12,
+ 'Średniowiecze': 16,
+ 'Renesans': 20,
+ 'Barok': 13,
+ 'Oświecenie': 14,
+ 'Romantyzm': 21,
+ 'Pozytywizm': 19,
+ 'Modernizm': 18,
+ 'Dwudziestolecie międzywojenne': 15,
+ 'Współczesność': 17,
+ }
+
+ for epoch in wlbook.meta.epochs:
+ if epoch in epoch_map:
+ return epoch_map[epoch]
+ return 11
+
def create_book(self, book_data, files_data):
data = {
'createValidationTrue': 'true',
def create_book(self, book_data, files_data):
data = {
'createValidationTrue': 'true',