calibredb list: Allow outputting the languages field as well. Fixes #1445853 [Calibredb list does not export languages](https://bugs.launchpad.net/calibre/+bug/1445853)

This commit is contained in:
Kovid Goyal 2015-04-25 13:55:02 +05:30
parent 13c5fdb2be
commit 0dd3fc7f2e

View File

@ -21,10 +21,11 @@ from calibre.ebooks.metadata.opf2 import OPFCreator, OPF
from calibre.utils.date import isoformat
from calibre.utils.localization import canonicalize_lang
FIELDS = set(['title', 'authors', 'author_sort', 'publisher', 'rating',
'timestamp', 'size', 'tags', 'comments', 'series', 'series_index',
'formats', 'isbn', 'uuid', 'pubdate', 'cover', 'last_modified',
'identifiers'])
FIELDS = {
'title', 'authors', 'author_sort', 'publisher', 'rating', 'timestamp',
'size', 'tags', 'comments', 'series', 'series_index', 'formats', 'isbn',
'uuid', 'pubdate', 'cover', 'last_modified', 'identifiers', 'languages'
}
do_notify = True
def send_message(msg=''):
@ -203,8 +204,8 @@ List the books available in the calibre database.
def command_list(args, dbpath):
pre = get_parser('')
pargs = [x for x in args if x.startswith('--with-library') or x.startswith('--library-path')
or not x.startswith('-')]
pargs = [x for x in args if x.startswith('--with-library') or x.startswith('--library-path') or
not x.startswith('-')]
opts = pre.parse_args(sys.argv[:1] + pargs)[0]
db = get_db(dbpath, opts)
parser = list_option_parser(db=db)
@ -1318,6 +1319,7 @@ def command_restore_database(args, dbpath):
dbpath = dbpath.decode(preferred_encoding)
class Progress(object):
def __init__(self):
self.total = 1
@ -1555,4 +1557,3 @@ def main(args=sys.argv):
if __name__ == '__main__':
sys.exit(main())