mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fixed problem with CSV, XML library_name when alternate library is specified
This commit is contained in:
parent
47bcd99264
commit
26e0b8d2ec
@ -56,10 +56,13 @@ class CSV_XML(CatalogPlugin):
|
|||||||
|
|
||||||
self.fmt = path_to_output.rpartition('.')[2]
|
self.fmt = path_to_output.rpartition('.')[2]
|
||||||
self.notification = notification
|
self.notification = notification
|
||||||
|
current_library = current_library_name()
|
||||||
|
if getattr(opts, 'library_path', None):
|
||||||
|
current_library = os.path.basename(opts.library_path)
|
||||||
|
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
opts_dict = vars(opts)
|
opts_dict = vars(opts)
|
||||||
log("%s('%s'): Generating %s" % (self.name, current_library_name(), self.fmt.upper()))
|
log("%s('%s'): Generating %s" % (self.name, current_library, self.fmt.upper()))
|
||||||
if opts.connected_device['is_device_connected']:
|
if opts.connected_device['is_device_connected']:
|
||||||
log(" connected_device: %s" % opts.connected_device['name'])
|
log(" connected_device: %s" % opts.connected_device['name'])
|
||||||
if opts_dict['search_text']:
|
if opts_dict['search_text']:
|
||||||
@ -112,7 +115,7 @@ class CSV_XML(CatalogPlugin):
|
|||||||
if field.startswith('#'):
|
if field.startswith('#'):
|
||||||
item = db.get_field(entry['id'],field,index_is_id=True)
|
item = db.get_field(entry['id'],field,index_is_id=True)
|
||||||
elif field == 'library_name':
|
elif field == 'library_name':
|
||||||
item = current_library_name()
|
item = current_library
|
||||||
elif field == 'title_sort':
|
elif field == 'title_sort':
|
||||||
item = entry['sort']
|
item = entry['sort']
|
||||||
else:
|
else:
|
||||||
@ -219,7 +222,7 @@ class CSV_XML(CatalogPlugin):
|
|||||||
record.append(fmt)
|
record.append(fmt)
|
||||||
|
|
||||||
if 'library_name' in fields:
|
if 'library_name' in fields:
|
||||||
record.append(E.library_name(current_library_name()))
|
record.append(E.library_name(current_library))
|
||||||
|
|
||||||
with open(path_to_output, 'w') as f:
|
with open(path_to_output, 'w') as f:
|
||||||
f.write(etree.tostring(root, encoding='utf-8',
|
f.write(etree.tostring(root, encoding='utf-8',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user