From 7b4e7cbb2213e46b18a8550fc3bd7f57490f29fc Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 29 Sep 2018 16:51:31 +0200 Subject: [PATCH] Fix Kodi addons throwing jsonrpc errors (database reset needed) - Fixes #539 --- resources/lib/kodidb_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index 92c0910f..7db833ab 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -301,7 +301,7 @@ class KodiDBMethods(object): query = ''' SELECT %s FROM %s WHERE name = ? COLLATE NOCASE LIMIT 1 ''' % (key, table) - query_id = 'SELECT COALESCE(MAX(%s), -1) FROM %s' % (key, table) + query_id = 'SELECT COALESCE(MAX(%s), 0) FROM %s' % (key, table) query_new = ('INSERT INTO %s(%s, name) values(?, ?)' % (table, key)) entry_ids = [] @@ -508,7 +508,7 @@ class KodiDBMethods(object): actor_id = self.cursor.fetchone()[0] except TypeError: # Not yet in actor DB, add person - self.cursor.execute('SELECT COALESCE(MAX(actor_id),-1) FROM actor') + self.cursor.execute('SELECT COALESCE(MAX(actor_id),0) FROM actor') actor_id = self.cursor.fetchone()[0] + 1 self.cursor.execute('INSERT INTO actor(actor_id, name) ' 'VALUES (?, ?)',