Fix Kodi addons throwing jsonrpc errors (database reset needed)

- Fixes #539
This commit is contained in:
croneter 2018-09-29 16:51:31 +02:00
parent 7a3016a31b
commit 7b4e7cbb22

View file

@ -301,7 +301,7 @@ class KodiDBMethods(object):
query = ''' query = '''
SELECT %s FROM %s WHERE name = ? COLLATE NOCASE LIMIT 1 SELECT %s FROM %s WHERE name = ? COLLATE NOCASE LIMIT 1
''' % (key, table) ''' % (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(?, ?)' query_new = ('INSERT INTO %s(%s, name) values(?, ?)'
% (table, key)) % (table, key))
entry_ids = [] entry_ids = []
@ -508,7 +508,7 @@ class KodiDBMethods(object):
actor_id = self.cursor.fetchone()[0] actor_id = self.cursor.fetchone()[0]
except TypeError: except TypeError:
# Not yet in actor DB, add person # 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 actor_id = self.cursor.fetchone()[0] + 1
self.cursor.execute('INSERT INTO actor(actor_id, name) ' self.cursor.execute('INSERT INTO actor(actor_id, name) '
'VALUES (?, ?)', 'VALUES (?, ?)',