From: Oleg Broytman Date: Mon, 11 Jun 2018 13:13:08 +0000 (+0300) Subject: Feat(db): Add book.author_list property X-Git-Tag: 0.1.4~3 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=611123d9fc926dfd7803ca12ebbab6511ba4e4c0;p=m_librarian.git Feat(db): Add book.author_list property Comma-separated full names. --- diff --git a/m_librarian.conf.sample b/m_librarian.conf.sample index 000e680..d8d707c 100644 --- a/m_librarian.conf.sample +++ b/m_librarian.conf.sample @@ -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 diff --git a/m_librarian/db.py b/m_librarian/db.py index 9081a42..0350aae 100755 --- a/m_librarian/db.py +++ b/m_librarian/db.py @@ -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: diff --git a/m_librarian/download.py b/m_librarian/download.py index 744e1a0..4cbf35b 100755 --- a/m_librarian/download.py +++ b/m_librarian/download.py @@ -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] diff --git a/m_librarian/translations/ru.mo b/m_librarian/translations/ru.mo index 536ad10..8e5cee0 100644 Binary files a/m_librarian/translations/ru.mo and b/m_librarian/translations/ru.mo differ diff --git a/m_librarian/translations/ru.po b/m_librarian/translations/ru.po index f332a28..aff9316 100644 --- a/m_librarian/translations/ru.po +++ b/m_librarian/translations/ru.po @@ -105,3 +105,6 @@ msgstr "Дата" msgid "author1" msgstr "Автор" + +msgid "author_list" +msgstr "Авторы"