fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
05b916d
)
volume and imprint for isbn/csv
author
Jan Szejko
<janek37@gmail.com>
Tue, 9 May 2017 09:27:28 +0000
(11:27 +0200)
committer
Jan Szejko
<janek37@gmail.com>
Tue, 9 May 2017 09:27:28 +0000
(11:27 +0200)
src/catalogue/management/commands/eisbn_csv.py
patch
|
blob
|
history
diff --git
a/src/catalogue/management/commands/eisbn_csv.py
b/src/catalogue/management/commands/eisbn_csv.py
index
ec13332
..
3c46ea6
100644
(file)
--- a/
src/catalogue/management/commands/eisbn_csv.py
+++ b/
src/catalogue/management/commands/eisbn_csv.py
@@
-32,11
+32,42
@@
PRODUCT_FORMS_2 = {
'MOBI': 'E127',
}
'MOBI': 'E127',
}
+VOLUME_NUMBERS = {
+ u'pierwszy': 1,
+ u'drugi': 2,
+ u'trzeci': 3,
+ u'czwarty': 4,
+ u'piąty': 5,
+ u'szósty': 6,
+ u'I': 1,
+ u'II': 2,
+ u'III': 3,
+ u'IV': 4,
+ u'V': 5,
+ u'VI': 6,
+}
+
def is_institution(name):
return name.startswith(u'Zgromadzenie Ogólne')
def is_institution(name):
return name.startswith(u'Zgromadzenie Ogólne')
+VOLUME_SEPARATOR = ', tom '
+
+
+def get_volume(title):
+ if VOLUME_SEPARATOR not in title:
+ return title, ''
+ else:
+ vol_idx = title.index(VOLUME_SEPARATOR)
+ stripped = title[:vol_idx]
+ vol_name = title[vol_idx + len(VOLUME_SEPARATOR):]
+ if vol_name in VOLUME_NUMBERS:
+ return stripped, VOLUME_NUMBERS[vol_name]
+ else:
+ return title, ''
+
+
class Command(BaseCommand):
@staticmethod
def dc_values(desc, tag):
class Command(BaseCommand):
@staticmethod
def dc_values(desc, tag):
@@
-48,11
+79,11
@@
class Command(BaseCommand):
desc = book.wldocument().edoc.find('.//' + RDFNS('Description'))
formats = FORMATS_WITH_CHILDREN if book.children.exists() else FORMATS
for file_format in formats:
desc = book.wldocument().edoc.find('.//' + RDFNS('Description'))
formats = FORMATS_WITH_CHILDREN if book.children.exists() else FORMATS
for file_format in formats:
- imprint = u'Fundacja Nowoczesna Polska'
- title = book.title
+ # imprint = u'Fundacja Nowoczesna Polska'
+ imprint = '; '.join(self.dc_values(desc, 'publisher'))
+ title, volume = get_volume(book.title)
subtitle = ''
year = ''
subtitle = ''
year = ''
- volume = ''
publication_date = localtime(book.created_at).date().isoformat()
info_date = publication_date
author = '; '.join(self.dc_values(desc, 'creator'))
publication_date = localtime(book.created_at).date().isoformat()
info_date = publication_date
author = '; '.join(self.dc_values(desc, 'creator'))