Fix for added episodes and movies not being analyzed for existing subtitles or searched for missing.

pull/684/head
Louis Vézina 5 years ago
parent d3cc56dd95
commit 808f87ca9c

@ -154,7 +154,7 @@ def sync_episodes():
result = database.execute( result = database.execute(
'''INSERT OR IGNORE INTO table_episodes(''' + query.keys_insert + ''') VALUES(''' + query.question_marks + '''INSERT OR IGNORE INTO table_episodes(''' + query.keys_insert + ''') VALUES(''' + query.question_marks +
''')''', query.values) ''')''', query.values)
if result: if result > 0:
altered_episodes.append([added_episode['sonarrEpisodeId'], added_episode['path']]) altered_episodes.append([added_episode['sonarrEpisodeId'], added_episode['path']])
else: else:
logging.debug('BAZARR unable to insert this episode into the database:', logging.debug('BAZARR unable to insert this episode into the database:',

@ -238,7 +238,7 @@ def update_movies():
result = database.execute( result = database.execute(
'''INSERT OR IGNORE INTO table_movies(''' + query.keys_insert + ''') VALUES(''' + '''INSERT OR IGNORE INTO table_movies(''' + query.keys_insert + ''') VALUES(''' +
query.question_marks + ''')''', query.values) query.question_marks + ''')''', query.values)
if result: if result > 0:
altered_movies.append([added_movie['tmdbId'], altered_movies.append([added_movie['tmdbId'],
added_movie['path'], added_movie['path'],
added_movie['radarrId'], added_movie['radarrId'],

@ -137,7 +137,11 @@ class Sqlite3Worker(threading.Thread):
else: else:
try: try:
self.sqlite3_cursor.execute(query, values) self.sqlite3_cursor.execute(query, values)
if query.lower().strip().startswith(("insert", "update")):
self.results[token] = self.sqlite3_cursor.rowcount
except sqlite3.Error as err: except sqlite3.Error as err:
self.results[token] = (
"Query returned error: %s: %s: %s" % (query, values, err))
LOGGER.error( LOGGER.error(
"Query returned error: %s: %s: %s", query, values, err) "Query returned error: %s: %s: %s", query, values, err)
@ -196,7 +200,7 @@ class Sqlite3Worker(threading.Thread):
token = str(uuid.uuid4()) token = str(uuid.uuid4())
# If it's a select we queue it up with a token to mark the results # If it's a select we queue it up with a token to mark the results
# into the output queue so we know what results are ours. # into the output queue so we know what results are ours.
if query.lower().strip().startswith("select"): if query.lower().strip().startswith(("select", "insert", "update")):
self.sql_queue.put((token, query, values, only_one), timeout=5) self.sql_queue.put((token, query, values, only_one), timeout=5)
return self.query_results(token) return self.query_results(token)
else: else:

Loading…
Cancel
Save