Fix existing rating not being removed when using Polish Books or Embed Metadata tools on EPUB files. Fixes #1534597 [Polish Books not updating Ratings](https://bugs.launchpad.net/calibre/+bug/1534597)

This commit is contained in:
Kovid Goyal 2016-01-16 09:33:17 +05:30
parent ebbdf4e704
commit 9187c1e82b

View File

@ -1276,9 +1276,9 @@ class OPF(object): # {{{
'isbn', 'tags', 'category', 'comments', 'book_producer',
'pubdate', 'user_categories', 'author_link_map'):
val = getattr(mi, attr, None)
is_null = val is None or val in ((), [], (None, None), {})
is_null = val is None or val in ((), [], (None, None), {}) or (attr == 'rating' and val < 0.1)
if is_null:
if apply_null and attr in {'series', 'tags', 'isbn', 'comments', 'publisher'}:
if apply_null and attr in {'series', 'tags', 'isbn', 'comments', 'publisher', 'rating'}:
setattr(self, attr, ([] if attr == 'tags' else None))
else:
setattr(self, attr, val)