From 611123d9fc926dfd7803ca12ebbab6511ba4e4c0 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 11 Jun 2018 16:13:08 +0300 Subject: [PATCH] Feat(db): Add book.author_list property Comma-separated full names. --- m_librarian.conf.sample | 6 ++++-- m_librarian/db.py | 4 ++++ m_librarian/download.py | 3 +++ m_librarian/translations/ru.mo | Bin 1667 -> 1716 bytes m_librarian/translations/ru.po | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-) 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 536ad1042f36c58052aef0d20444f76e18487436..8e5cee0cf805db4600b43a084744050744d6241f 100644 GIT binary patch delta 752 zcmX|K3V?N^6#*U{HN8wEdGYIzMHjp0ZMQQN+=1{_=eTDEWhhB>)gH-@=yyEpaf4~hSNBO^~7Bigga{1G$=U+^4JZ%5~ delta 704 zcmXw%F-XHu5Qd*gYOOX^W3Ae1U0kdnA~=fB!KH)X;3R^$2o8d@n-I`Vx=3+zcdh8s zQCwUECqV^q=_EKgxCnlKydM1d-rXg4m-pUncpAp;VW z8m?J>-SQhSOMJ)T2T=9u7LQ>-f7i6cx$zRJ(Uq|c$M8GmKSB-gY<}1BUvPrB$223b z2sPLOk4d-;H9!q&uq_y?&>jnYa0L1BW-+;RN@@_Dt4!xMj7Cv}WZHpr>&|Q3RQ)rr^^$t~1HgnWK>z>% 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 "Авторы" -- 2.39.5