From 8d76bc53e5af082365fa8698510cb65c6955dbb7 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 13 May 2018 12:31:54 +0200 Subject: [PATCH] Fix rare library sync errors - Fixes #462 --- resources/lib/kodidb_functions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index 36edad66..c45df6e4 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -303,7 +303,11 @@ class KodiDBMethods(object): # Add all new entries that haven't already been added query = 'INSERT INTO %s VALUES (?, ?, ?)' % link_table for entry_id in entry_ids: - self.cursor.execute(query, (entry_id, kodi_id, kodi_type)) + try: + self.cursor.execute(query, (entry_id, kodi_id, kodi_type)) + except IntegrityError: + LOG.info('IntegrityError: skipping entry %s for table %s', + entry_id, link_table) # Delete all outdated references in the link table. Also check whether # we need to delete orphaned entries in the master table query = '''