mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix #7949 (Plug Board vs Series metadata change - bad behavior in 0.7.34) and have author display tweak affectthe content server as well
This commit is contained in:
commit
a68157c83e
@ -43,17 +43,17 @@ author_sort_copy_method = 'invert'
|
|||||||
|
|
||||||
# Set which author field to display in the tags pane (the list of authors,
|
# Set which author field to display in the tags pane (the list of authors,
|
||||||
# series, publishers etc on the left hand side). The choices are author and
|
# series, publishers etc on the left hand side). The choices are author and
|
||||||
# author_sort. This tweak affects only the tags pane, and only what is displayed
|
# author_sort. This tweak affects only what is displayed under the authors
|
||||||
# under the authors category. Please note that if you set this to author_sort,
|
# category in the tags pane and content server. Please note that if you set this
|
||||||
# it is very possible to see duplicate names in the list becasue although it is
|
# to author_sort, it is very possible to see duplicate names in the list because
|
||||||
# guaranteed that author names are unique, there is no such guarantee for
|
# although it is guaranteed that author names are unique, there is no such
|
||||||
# author_sort values. Showing duplicates won't break anything, but it could
|
# guarantee for author_sort values. Showing duplicates won't break anything, but
|
||||||
# lead to some confusion. When using 'author_sort', the tooltip will show the
|
# it could lead to some confusion. When using 'author_sort', the tooltip will
|
||||||
# author's name.
|
# show the author's name.
|
||||||
# Examples:
|
# Examples:
|
||||||
# tags_pane_use_field_for_author_name = 'author'
|
# categories_use_field_for_author_name = 'author'
|
||||||
# tags_pane_use_field_for_author_name = 'author_sort'
|
# categories_use_field_for_author_name = 'author_sort'
|
||||||
tags_pane_use_field_for_author_name = 'author'
|
categories_use_field_for_author_name = 'author'
|
||||||
|
|
||||||
|
|
||||||
# Set whether boolean custom columns are two- or three-valued.
|
# Set whether boolean custom columns are two- or three-valued.
|
||||||
|
@ -463,6 +463,8 @@ class Metadata(object):
|
|||||||
other_lang = getattr(other, 'language', None)
|
other_lang = getattr(other, 'language', None)
|
||||||
if other_lang and other_lang.lower() != 'und':
|
if other_lang and other_lang.lower() != 'und':
|
||||||
self.language = other_lang
|
self.language = other_lang
|
||||||
|
if not getattr(self, 'series', None):
|
||||||
|
self.series_index = None
|
||||||
|
|
||||||
def format_series_index(self, val=None):
|
def format_series_index(self, val=None):
|
||||||
from calibre.ebooks.metadata import fmt_sidx
|
from calibre.ebooks.metadata import fmt_sidx
|
||||||
|
@ -412,7 +412,7 @@ class TagTreeItem(object): # {{{
|
|||||||
def tag_data(self, role):
|
def tag_data(self, role):
|
||||||
tag = self.tag
|
tag = self.tag
|
||||||
if tag.category == 'authors' and \
|
if tag.category == 'authors' and \
|
||||||
tweaks['tags_pane_use_field_for_author_name'] == 'author_sort':
|
tweaks['categories_use_field_for_author_name'] == 'author_sort':
|
||||||
name = tag.sort
|
name = tag.sort
|
||||||
tt_author = True
|
tt_author = True
|
||||||
else:
|
else:
|
||||||
|
@ -15,7 +15,7 @@ from calibre import isbytestring, force_unicode, fit_image, \
|
|||||||
prepare_string_for_xml as xml
|
prepare_string_for_xml as xml
|
||||||
from calibre.utils.ordered_dict import OrderedDict
|
from calibre.utils.ordered_dict import OrderedDict
|
||||||
from calibre.utils.filenames import ascii_filename
|
from calibre.utils.filenames import ascii_filename
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs, tweaks
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.utils.magick import Image
|
from calibre.utils.magick import Image
|
||||||
from calibre.library.comments import comments_to_html
|
from calibre.library.comments import comments_to_html
|
||||||
@ -151,7 +151,11 @@ def get_category_items(category, items, restriction, datatype, prefix): # {{{
|
|||||||
'<div>{1}</div>'
|
'<div>{1}</div>'
|
||||||
'<div>{2}</div></div>')
|
'<div>{2}</div></div>')
|
||||||
rating, rstring = render_rating(i.avg_rating, prefix)
|
rating, rstring = render_rating(i.avg_rating, prefix)
|
||||||
name = xml(i.name)
|
if i.category == 'authors' and \
|
||||||
|
tweaks['categories_use_field_for_author_name'] == 'author_sort':
|
||||||
|
name = xml(i.sort)
|
||||||
|
else:
|
||||||
|
name = xml(i.name)
|
||||||
if datatype == 'rating':
|
if datatype == 'rating':
|
||||||
name = xml(_('%d stars')%int(i.avg_rating))
|
name = xml(_('%d stars')%int(i.avg_rating))
|
||||||
id_ = i.id
|
id_ = i.id
|
||||||
|
@ -22,6 +22,7 @@ from calibre.library.server.utils import format_tag_string, Offsets
|
|||||||
from calibre import guess_type, prepare_string_for_xml as xml
|
from calibre import guess_type, prepare_string_for_xml as xml
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.utils.ordered_dict import OrderedDict
|
from calibre.utils.ordered_dict import OrderedDict
|
||||||
|
from calibre.utils.config import tweaks
|
||||||
|
|
||||||
BASE_HREFS = {
|
BASE_HREFS = {
|
||||||
0 : '/stanza',
|
0 : '/stanza',
|
||||||
@ -113,8 +114,13 @@ def CATALOG_ENTRY(item, item_kind, base_href, version, updated,
|
|||||||
count = (_('%d books') if item.count > 1 else _('%d book'))%item.count
|
count = (_('%d books') if item.count > 1 else _('%d book'))%item.count
|
||||||
if ignore_count:
|
if ignore_count:
|
||||||
count = ''
|
count = ''
|
||||||
|
if item.category == 'authors' and \
|
||||||
|
tweaks['categories_use_field_for_author_name'] == 'author_sort':
|
||||||
|
name = xml(item.sort)
|
||||||
|
else:
|
||||||
|
name = xml(item.name)
|
||||||
return E.entry(
|
return E.entry(
|
||||||
TITLE(item.name + ('' if not add_kind else ' (%s)'%item_kind)),
|
TITLE(name + ('' if not add_kind else ' (%s)'%item_kind)),
|
||||||
ID(id_),
|
ID(id_),
|
||||||
UPDATED(updated),
|
UPDATED(updated),
|
||||||
E.content(count, type='text'),
|
E.content(count, type='text'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user