Fix for history logging.

pull/479/head
Louis Vézina 6 years ago
parent daa6d87e76
commit bc321392f2

@ -505,7 +505,7 @@ def series_download_subtitles(no):
message = result[0]
path = result[1]
forced = result[5]
language_code = result[2] + ":forced" if forced else ""
language_code = result[2] + ":forced" if forced else result[2]
provider = result[3]
score = result[4]
store_subtitles(path_replace(episode[0]))
@ -547,7 +547,7 @@ def episode_download_subtitles(no):
message = result[0]
path = result[1]
forced = result[5]
language_code = result[2] + ":forced" if forced else ""
language_code = result[2] + ":forced" if forced else result[2]
provider = result[3]
score = result[4]
store_subtitles(path_replace(episode[0]))
@ -636,7 +636,7 @@ def wanted_download_subtitles(path, l, count_episodes):
message = result[0]
path = result[1]
forced = result[5]
language_code = result[2] + ":forced" if forced else ""
language_code = result[2] + ":forced" if forced else result[2]
provider = result[3]
score = result[4]
store_subtitles(path_replace(episode[0]))
@ -905,7 +905,7 @@ def upgrade_subtitles():
message = result[0]
path = result[1]
forced = result[5]
language_code = result[2] + ":forced" if forced else ""
language_code = result[2] + ":forced" if forced else result[2]
provider = result[3]
score = result[4]
store_subtitles(path_replace(episode[0]))

@ -1835,7 +1835,7 @@ def get_subtitle():
message = result[0]
path = result[1]
forced = result[5]
language_code = result[2] + ":forced" if forced else ""
language_code = result[2] + ":forced" if forced else result[2]
provider = result[3]
score = result[4]
history_log(1, sonarrSeriesId, sonarrEpisodeId, message, path, language_code, provider, score)
@ -1893,7 +1893,7 @@ def manual_get_subtitle():
message = result[0]
path = result[1]
forced = result[5]
language_code = result[2] + ":forced" if forced else ""
language_code = result[2] + ":forced" if forced else result[2]
provider = result[3]
score = result[4]
history_log(2, sonarrSeriesId, sonarrEpisodeId, message, path, language_code, provider, score)

@ -15,10 +15,6 @@ def history_log(action, sonarrSeriesId, sonarrEpisodeId, description, video_path
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = db.cursor()
if forced:
language = language + ":forced"
# Get Sonarr API URL from database config table
history = c.execute(
'''INSERT INTO table_history(action, sonarrSeriesId, sonarrEpisodeId, timestamp, description, video_path, language, provider, score) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)''',
(action, sonarrSeriesId, sonarrEpisodeId, time.time(), description, video_path, language, provider, score))

Loading…
Cancel
Save