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:
if got_percent:
got_percent = False
if c == 'a':
- new_format = u'%(author)s'
+ new_format = u'%(author1)s'
+ elif c == 'A':
+ new_format = u'%(authors)s'
elif c == 'e':
new_format = u'%(extension)s'
elif c == 'f':
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':
def download(book, dest_path=None, lib_path=None, a_format=None):
+ if dest_path is None:
+ dest_path = get_config().getpath('download', 'path')
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['authors'] = book.author_list
bdict['extension'] = book.extension.name
bdict['file'] = book.file
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