From bd1c2c3a0a5143c82ce91025bf437dd65d555ea3 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 11 Nov 2018 20:13:10 +0100 Subject: [PATCH] More indicees for Kodi DB to increase sync speed --- resources/lib/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/lib/utils.py b/resources/lib/utils.py index b307d5d9..6cbed1ce 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -498,14 +498,14 @@ def create_kodi_db_indicees(): """ Index the "actors" because we got a TON - speed up SELECT and WHEN """ - return conn = kodi_sql('video') cursor = conn.cursor() - try: - cursor.execute('CREATE UNIQUE INDEX ix_files_2 ON files (idFile);') - except OperationalError: - # Index already exists - pass + commands = ( + 'CREATE UNIQUE INDEX IF NOT EXISTS ix_actor_2 ON actor (actor_id);', + 'CREATE UNIQUE INDEX IF NOT EXISTS ix_files_2 ON files (idFile);', + ) + for cmd in commands: + cursor.execute(cmd) # Already used in Kodi >=17: CREATE UNIQUE INDEX ix_actor_1 ON actor (name) # try: # cursor.execute('CREATE UNIQUE INDEX ix_pkc_actor_index ON actor (name);')