mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Handle rating and numeric columns for Kobo shelves
Kobo driver: Fix errors when using rating or numerical custom columns to create shelves. Fixes #1253637 [Kobo driver has error when rating column used for shelves](https://bugs.launchpad.net/calibre/+bug/1253637) Convert the category to string in case a numeric column is used. For a rating column, divide the value by two.
This commit is contained in:
parent
58bed7e3de
commit
72e7d29690
@ -161,6 +161,8 @@ class KTCollectionsBookList(CollectionsBookList):
|
|||||||
# debug_print("KTCollectionsBookList:get_collections - val is list=", val)
|
# debug_print("KTCollectionsBookList:get_collections - val is list=", val)
|
||||||
elif fm is not None and fm['datatype'] == 'series':
|
elif fm is not None and fm['datatype'] == 'series':
|
||||||
val = [orig_val]
|
val = [orig_val]
|
||||||
|
elif fm is not None and fm['datatype'] == 'rating':
|
||||||
|
val = [str(orig_val / 2)]
|
||||||
elif fm is not None and fm['datatype'] == 'text' and fm['is_multiple']:
|
elif fm is not None and fm['datatype'] == 'text' and fm['is_multiple']:
|
||||||
if isinstance(orig_val, (list, tuple)):
|
if isinstance(orig_val, (list, tuple)):
|
||||||
val = orig_val
|
val = orig_val
|
||||||
@ -205,7 +207,7 @@ class KTCollectionsBookList(CollectionsBookList):
|
|||||||
if not category:
|
if not category:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
cat_name = category.strip(' ,')
|
cat_name = str(category).strip(' ,')
|
||||||
|
|
||||||
if cat_name not in collections:
|
if cat_name not in collections:
|
||||||
collections[cat_name] = {}
|
collections[cat_name] = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user