From 013793f98992f3a99062e983fbbd83237a63611d Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sun, 17 May 2020 10:46:48 +0200 Subject: [PATCH] Fix for #1391 (Kobo sync not working if series is given, but no series_index) --- cps/kobo.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cps/kobo.py b/cps/kobo.py index 7a6c2254..e8c14088 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -332,6 +332,9 @@ def get_series(book): return None return book.series[0].name +def get_seriesindex(book): + return book.series_index or 1 + def get_metadata(book): download_urls = [] @@ -386,8 +389,8 @@ def get_metadata(book): name = get_series(book) metadata["Series"] = { "Name": get_series(book), - "Number": book.series_index, # ToDo Check int() ? - "NumberFloat": float(book.series_index), + "Number": get_seriesindex(book), # ToDo Check int() ? + "NumberFloat": float(get_seriesindex(book)), # Get a deterministic id based on the series name. "Id": uuid.uuid3(uuid.NAMESPACE_DNS, name), }