This commit is contained in:
Kovid Goyal 2016-09-05 00:33:47 +05:30
parent 5c942e80ec
commit 93b727818b
2 changed files with 4 additions and 6 deletions

View File

@ -7,7 +7,6 @@ __docformat__ = 'restructuredtext en'
import hashlib, binascii import hashlib, binascii
from functools import partial from functools import partial
from itertools import repeat
from collections import OrderedDict from collections import OrderedDict
from lxml import etree, html from lxml import etree, html
@ -16,7 +15,7 @@ import cherrypy
import routes import routes
from calibre.constants import __appname__ from calibre.constants import __appname__
from calibre.ebooks.metadata import fmt_sidx from calibre.ebooks.metadata import fmt_sidx, rating_to_stars
from calibre.library.comments import comments_to_html from calibre.library.comments import comments_to_html
from calibre.library.server import custom_fields_to_display from calibre.library.server import custom_fields_to_display
from calibre.library.server.utils import format_tag_string, Offsets from calibre.library.server.utils import format_tag_string, Offsets
@ -168,7 +167,7 @@ def ACQUISITION_ENTRY(item, version, db, updated, CFM, CKEYS, prefix):
extra = [] extra = []
rating = item[FM['rating']] rating = item[FM['rating']]
if rating > 0: if rating > 0:
rating = u''.join(repeat(u'\u2605', int(rating/2.))) rating = rating_to_stars(rating)
extra.append(_('RATING: %s<br />')%rating) extra.append(_('RATING: %s<br />')%rating)
tags = item[FM['tags']] tags = item[FM['tags']]
if tags: if tags:

View File

@ -7,7 +7,6 @@ __docformat__ = 'restructuredtext en'
import hashlib, binascii import hashlib, binascii
from functools import partial from functools import partial
from itertools import repeat
from collections import OrderedDict, namedtuple from collections import OrderedDict, namedtuple
from urllib import urlencode from urllib import urlencode
@ -16,7 +15,7 @@ from lxml.builder import ElementMaker
from calibre.constants import __appname__ from calibre.constants import __appname__
from calibre.db.view import sanitize_sort_field_name from calibre.db.view import sanitize_sort_field_name
from calibre.ebooks.metadata import fmt_sidx, authors_to_string from calibre.ebooks.metadata import fmt_sidx, authors_to_string, rating_to_stars
from calibre.library.comments import comments_to_html from calibre.library.comments import comments_to_html
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
@ -170,7 +169,7 @@ def ACQUISITION_ENTRY(book_id, updated, request_context):
mi = request_context.db.get_metadata(book_id) mi = request_context.db.get_metadata(book_id)
extra = [] extra = []
if mi.rating > 0: if mi.rating > 0:
rating = u''.join(repeat(u'\u2605', int(mi.rating/2.))) rating = rating_to_stars(mi.rating)
extra.append(_('RATING: %s<br />')%rating) extra.append(_('RATING: %s<br />')%rating)
if mi.tags: if mi.tags:
extra.append(_('TAGS: %s<br />')%xml(format_tag_string(mi.tags, None))) extra.append(_('TAGS: %s<br />')%xml(format_tag_string(mi.tags, None)))