X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_librarian%2Fdownload.py;h=744e1a0273c35f06c5d1489b53796cba9556cf43;hb=12e046208dda7a46efc4b02dde9a1cb507a940ba;hp=7e27561be25f413e8b054d34239c36c2740962bd;hpb=8fdf6aab492482fcacad9ce2ec764bdc5bf76590;p=m_librarian.git diff --git a/m_librarian/download.py b/m_librarian/download.py index 7e27561..744e1a0 100755 --- a/m_librarian/download.py +++ b/m_librarian/download.py @@ -17,11 +17,12 @@ compiled_format = '%(file)s' def _compile_format(): global format, compile_format, compiled_format - if compile_format: - compile_format = False - format = get_config().get('download', 'format') - if not format: - return + if not compile_format: + return + compile_format = False + format = get_config().get('download', 'format') + if not format: + return got_percent = False compiled = [] for c in format: @@ -35,7 +36,7 @@ def _compile_format(): if got_percent: got_percent = False if c == 'a': - new_format = u'%(author)s' + new_format = u'%(author1)s' elif c == 'e': new_format = u'%(extension)s' elif c == 'f': @@ -67,18 +68,18 @@ def download(book, dest_path=None, lib_path=None, a_format=None): if lib_path is None: global _library_path if _library_path is None: - _library_path = get_config().get('library', 'path') or '.' + _library_path = get_config().getpath('library', 'path') lib_path = _library_path global format, compile_format, compiled_format if a_format: - format = a_format compile_format = True + format = a_format _compile_format() if compiled_format[-1] in ('\0', '\\', '/'): raise ValueError('Bad format: "%s"' % compiled_format) bdict = {} - bdict['author'] = book.authors[0].fullname + bdict['author1'] = book.author1 bdict['extension'] = book.extension.name bdict['file'] = book.file genre = book.genres[0]