]> git.phdru.name Git - m_librarian.git/commitdiff
Feat(db): Add book.genre_list_* properties
authorOleg Broytman <phd@phdru.name>
Mon, 11 Jun 2018 13:21:05 +0000 (16:21 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 11 Jun 2018 13:54:59 +0000 (16:54 +0300)
Comma-separated names and titles.

m_librarian.conf.sample
m_librarian/db.py
m_librarian/download.py
m_librarian/translations/ru.mo
m_librarian/translations/ru.po

index d8d707c88b9c8a287af86a7cc91f1a9a76ee0166..4b685199ffd9758ab2586c58a62de81086a3d809 100644 (file)
@@ -33,8 +33,10 @@ author = fullname count
 # Full list of book columns:
 # book = title series ser_no archive file size lib_id deleted date
 #        author1 author_list
 # Full list of book columns:
 # book = title series ser_no archive file size lib_id deleted date
 #        author1 author_list
+#        genre1name genre1title genre_name_list genre_title_list
 # author1 is just one author from the list if there are more than 1
 # author_list is a comma-separated list of full names
 # author1 is just one author from the list if there are more than 1
 # author_list is a comma-separated list of full names
+# genre1*/genre_*_list is a (one of/list of) genres (names or titles)
 # Default column is just title
 book = ser_no title
 
 # Default column is just title
 book = ser_no title
 
@@ -46,6 +48,8 @@ book = ser_no title
 # %f - file name in archive
 # %G - genre (one of), name
 # %g - genre (one of), title
 # %f - file name in archive
 # %G - genre (one of), name
 # %g - genre (one of), title
+# %J - genres (comma-separated names)
+# %j - genres (comma-separated titles)
 # %l - language
 # %n - series number (or 0)
 # %s - series
 # %l - language
 # %n - series number (or 0)
 # %s - series
index 0350aaed08218525160589058d34c47b42b48483..88b0b11609632658e18c69eb5be00acf3b2f277e 100755 (executable)
@@ -80,6 +80,22 @@ class Book(SQLObject):
     def author_list(self):
         return u', '.join([a.fullname for a in self.authors])
 
     def author_list(self):
         return u', '.join([a.fullname for a in self.authors])
 
+    @property
+    def genre1name(self):
+        return self.genres[0].name
+
+    @property
+    def genre1title(self):
+        return self.genres[0].title
+
+    @property
+    def genre_name_list(self):
+        return u', '.join([g.name for g in self.genres])
+
+    @property
+    def genre_title_list(self):
+        return u', '.join([g.title for g in self.genres])
+
 
 class BookGenre(SQLObject):
     class sqlmeta:
 
 class BookGenre(SQLObject):
     class sqlmeta:
index 4cbf35b8bdd1f9850ee743db05e9765e8636ee58..281efcaf7a2c81b4f32013da206b71c314ea2f74 100755 (executable)
@@ -47,6 +47,10 @@ def _compile_format():
                     new_format = u'%(gname)s'
                 elif c == 'g':
                     new_format = u'%(gtitle)s'
                     new_format = u'%(gname)s'
                 elif c == 'g':
                     new_format = u'%(gtitle)s'
+                elif c == 'J':
+                    new_format = u'%(gname_list)s'
+                elif c == 'j':
+                    new_format = u'%(gtitle_list)s'
                 elif c == 'l':
                     new_format = u'%(language)s'
                 elif c == 'n':
                 elif c == 'l':
                     new_format = u'%(language)s'
                 elif c == 'n':
@@ -88,6 +92,8 @@ def download(book, dest_path=None, lib_path=None, a_format=None):
     genre = book.genres[0]
     bdict['gname'] = genre.name
     bdict['gtitle'] = genre.title
     genre = book.genres[0]
     bdict['gname'] = genre.name
     bdict['gtitle'] = genre.title
+    bdict['gname_list'] = book.genre_name_list
+    bdict['gtitle_list'] = book.genre_title_list
     bdict['language'] = book.language.name
     bdict['ser_no'] = book.ser_no or 0
     bdict['series'] = book.series
     bdict['language'] = book.language.name
     bdict['ser_no'] = book.ser_no or 0
     bdict['series'] = book.series
index 8e5cee0cf805db4600b43a084744050744d6241f..5794760e7ef0daf1131438c8addd748e7d9c085b 100644 (file)
Binary files a/m_librarian/translations/ru.mo and b/m_librarian/translations/ru.mo differ
index aff9316430bcc1d73c7baedd973ac1d1fed35567..4a7071481d83a7ebf64b6f2eef69a86ac536105c 100644 (file)
@@ -108,3 +108,15 @@ msgstr "Автор"
 
 msgid "author_list"
 msgstr "Авторы"
 
 msgid "author_list"
 msgstr "Авторы"
+
+msgid "genre1name"
+msgstr "Жанр"
+
+msgid "genre1title"
+msgstr "Жанр"
+
+msgid "genre_name_list"
+msgstr "Список жанров"
+
+msgid "genre_title_list"
+msgstr "Список жанров"