mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #4620 (swap_author_names revised to eliminate trailing comma and split/swap at first comma or space)
This commit is contained in:
commit
d83a9104fd
@ -134,7 +134,10 @@ def metadata_from_filename(name, pat=None):
|
|||||||
mi.authors = aus
|
mi.authors = aus
|
||||||
if prefs['swap_author_names'] and mi.authors:
|
if prefs['swap_author_names'] and mi.authors:
|
||||||
def swap(a):
|
def swap(a):
|
||||||
parts = a.split()
|
if ',' in a:
|
||||||
|
parts = a.split(',', 1)
|
||||||
|
else:
|
||||||
|
parts = a.split(None, 1)
|
||||||
if len(parts) > 1:
|
if len(parts) > 1:
|
||||||
t = parts[-1]
|
t = parts[-1]
|
||||||
parts = parts[:-1]
|
parts = parts[:-1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user