mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Fix #4739 (Setting author_sort to the same as author)
This commit is contained in:
parent
8b4b85ab34
commit
c86155a177
@ -16,3 +16,12 @@ defaults.
|
|||||||
# next - Next available number
|
# next - Next available number
|
||||||
# const - Assign the number 1 always
|
# const - Assign the number 1 always
|
||||||
series_index_auto_increment = 'next'
|
series_index_auto_increment = 'next'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# The algorithm used to copy author to author_sort
|
||||||
|
# Possible values are:
|
||||||
|
# invert: use "fn ln" -> "ln, fn" (the original algorithm)
|
||||||
|
# copy : copy author to author_sort without modification
|
||||||
|
# comma : use 'copy' if there is a ',' in the name, otherwise use 'invert'
|
||||||
|
author_sort_copy_method = 'invert'
|
||||||
|
@ -10,9 +10,10 @@ import os, mimetypes, sys, re
|
|||||||
from urllib import unquote, quote
|
from urllib import unquote, quote
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
|
||||||
from calibre import relpath
|
from calibre import relpath
|
||||||
|
|
||||||
|
from calibre.utils.config import tweaks
|
||||||
|
|
||||||
_author_pat = re.compile(',?\s+(and|with)\s+', re.IGNORECASE)
|
_author_pat = re.compile(',?\s+(and|with)\s+', re.IGNORECASE)
|
||||||
def string_to_authors(raw):
|
def string_to_authors(raw):
|
||||||
raw = raw.replace('&&', u'\uffff')
|
raw = raw.replace('&&', u'\uffff')
|
||||||
@ -27,6 +28,9 @@ def authors_to_string(authors):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
def author_to_author_sort(author):
|
def author_to_author_sort(author):
|
||||||
|
method = tweaks['author_sort_copy_method']
|
||||||
|
if method == 'copy' or (method == 'comma' and author.count(',') > 0):
|
||||||
|
return author
|
||||||
tokens = author.split()
|
tokens = author.split()
|
||||||
tokens = tokens[-1:] + tokens[:-1]
|
tokens = tokens[-1:] + tokens[:-1]
|
||||||
if len(tokens) > 1:
|
if len(tokens) > 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user