From 4f116bc8bf81f3642667001a1e2114951a30d663 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sun, 20 Mar 2022 18:11:56 +0100 Subject: [PATCH] Remove calice-score from read books --- caliGraph.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/caliGraph.py b/caliGraph.py index 8748860..4745747 100755 --- a/caliGraph.py +++ b/caliGraph.py @@ -582,10 +582,13 @@ class calibreDB(): sco, rat = cls._requireCaliceColumn() for bookId in tqdm(scores): score = scores[bookId] - if sco: - cls._getTxt('set_custom calice_score '+str(bookId)+' '+str(round(score,5))) - if rat: - cls._getTxt('set_custom calice_rating '+str(bookId)+' '+str(int(round(score)))) + if score == '': + cls._getTxt('set_custom calice_score '+str(bookId)+' ""') + else: + if sco: + cls._getTxt('set_custom calice_score '+str(bookId)+' '+str(round(score,5))) + if rat: + cls._getTxt('set_custom calice_rating '+str(bookId)+' '+str(int(round(score)))) def calice(G): scores = {} @@ -594,6 +597,8 @@ def calice(G): if node['t'] in ['book']: if 'score' in node and node['score'] != None: scores[node['calibreID']] = node['score'] + elif 'rating' in node: + scores[node['calibreID']] = '' calibreDB.writeCaliceColumnMultiple(scores) print('Done.')