]> git.phdru.name Git - m_librarian.git/commitdiff
Feat(db): Add book.author_list property
authorOleg Broytman <phd@phdru.name>
Mon, 11 Jun 2018 13:13:08 +0000 (16:13 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 11 Jun 2018 13:54:59 +0000 (16:54 +0300)
Comma-separated full names.

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

index 000e680212dfc9f272f660ce7829b3764ad73682..d8d707c88b9c8a287af86a7cc91f1a9a76ee0166 100644 (file)
@@ -32,14 +32,16 @@ use_in_books_list = 1
 author = fullname count
 # Full list of book columns:
 # book = title series ser_no archive file size lib_id deleted date
-#        author1
+#        author1 author_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
 # Default column is just title
 book = ser_no title
 
 [download]
 # Download formats:
-# %a - author1 (one of)
+# %A - authors (comma-separated fullnames)
+# %a - author1 (one of, fullname)
 # %e - file extension
 # %f - file name in archive
 # %G - genre (one of), name
index 9081a422e0389b0da6f60c7cb94487b8ca3ed061..0350aaed08218525160589058d34c47b42b48483 100755 (executable)
@@ -76,6 +76,10 @@ class Book(SQLObject):
     def author1(self):
         return self.authors[0].fullname
 
+    @property
+    def author_list(self):
+        return u', '.join([a.fullname for a in self.authors])
+
 
 class BookGenre(SQLObject):
     class sqlmeta:
index 744e1a0273c35f06c5d1489b53796cba9556cf43..4cbf35b8bdd1f9850ee743db05e9765e8636ee58 100755 (executable)
@@ -37,6 +37,8 @@ def _compile_format():
                 got_percent = False
                 if c == 'a':
                     new_format = u'%(author1)s'
+                elif c == 'A':
+                    new_format = u'%(authors)s'
                 elif c == 'e':
                     new_format = u'%(extension)s'
                 elif c == 'f':
@@ -80,6 +82,7 @@ def download(book, dest_path=None, lib_path=None, a_format=None):
         raise ValueError('Bad format: "%s"' % compiled_format)
     bdict = {}
     bdict['author1'] = book.author1
+    bdict['authors'] = book.author_list
     bdict['extension'] = book.extension.name
     bdict['file'] = book.file
     genre = book.genres[0]
index 536ad1042f36c58052aef0d20444f76e18487436..8e5cee0cf805db4600b43a084744050744d6241f 100644 (file)
Binary files a/m_librarian/translations/ru.mo and b/m_librarian/translations/ru.mo differ
index f332a28236b44c9004847ddaee3d69ffd31623d2..aff9316430bcc1d73c7baedd973ac1d1fed35567 100644 (file)
@@ -105,3 +105,6 @@ msgstr "Дата"
 
 msgid "author1"
 msgstr "Автор"
+
+msgid "author_list"
+msgstr "Авторы"