mirror of
https://github.com/morpheus65535/bazarr.git
synced 2024-11-11 01:23:38 +08:00
Added subtitles id to history tables for future usage.
This commit is contained in:
parent
bf5026151f
commit
e14d2f45de
4 changed files with 36 additions and 19 deletions
|
@ -517,7 +517,8 @@ class EpisodesSubtitlesDownload(Resource):
|
|||
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)
|
||||
subs_id = result[6]
|
||||
history_log(1, sonarrSeriesId, sonarrEpisodeId, message, path, language_code, provider, score, subs_id)
|
||||
send_notifications(sonarrSeriesId, sonarrEpisodeId, message)
|
||||
store_subtitles(path, episodePath)
|
||||
else:
|
||||
|
@ -584,7 +585,8 @@ class EpisodesSubtitlesManualDownload(Resource):
|
|||
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)
|
||||
subs_id = result[6]
|
||||
history_log(2, sonarrSeriesId, sonarrEpisodeId, message, path, language_code, provider, score, subs_id)
|
||||
send_notifications(sonarrSeriesId, sonarrEpisodeId, message)
|
||||
store_subtitles(path, episodePath)
|
||||
return result, 201
|
||||
|
@ -917,7 +919,8 @@ class MovieSubtitlesDownload(Resource):
|
|||
language_code = result[2] + ":forced" if forced else result[2]
|
||||
provider = result[3]
|
||||
score = result[4]
|
||||
history_log_movie(1, radarrId, message, path, language_code, provider, score)
|
||||
subs_id = result[6]
|
||||
history_log_movie(1, radarrId, message, path, language_code, provider, score, subs_id)
|
||||
send_notifications_movie(radarrId, message)
|
||||
store_subtitles_movie(path, moviePath)
|
||||
else:
|
||||
|
@ -983,7 +986,8 @@ class MovieSubtitlesManualDownload(Resource):
|
|||
language_code = result[2] + ":forced" if forced else result[2]
|
||||
provider = result[3]
|
||||
score = result[4]
|
||||
history_log_movie(2, radarrId, message, path, language_code, provider, score)
|
||||
subs_id = result[6]
|
||||
history_log_movie(2, radarrId, message, path, language_code, provider, score, subs_id)
|
||||
send_notifications_movie(radarrId, message)
|
||||
store_subtitles_movie(path, moviePath)
|
||||
return result, 201
|
||||
|
|
|
@ -114,10 +114,12 @@ def db_upgrade():
|
|||
['table_history', 'language', 'text'],
|
||||
['table_history', 'provider', 'text'],
|
||||
['table_history', 'score', 'text'],
|
||||
['table_history', 'subs_id', 'text'],
|
||||
['table_history_movie', 'video_path', 'text'],
|
||||
['table_history_movie', 'language', 'text'],
|
||||
['table_history_movie', 'provider', 'text'],
|
||||
['table_history_movie', 'score', 'text']
|
||||
['table_history_movie', 'score', 'text'],
|
||||
['table_history_movie', 'subs_id', 'text']
|
||||
]
|
||||
|
||||
for column in columnToAdd:
|
||||
|
|
|
@ -268,7 +268,8 @@ def download_subtitle(path, language, audio_language, hi, forced, providers, pro
|
|||
|
||||
track_event(category=downloaded_provider, action=action, label=downloaded_language)
|
||||
|
||||
return message, reversed_path, downloaded_language_code2, downloaded_provider, subtitle.score, subtitle.language.forced
|
||||
return message, reversed_path, downloaded_language_code2, downloaded_provider, subtitle.score, \
|
||||
subtitle.language.forced, subtitle.id
|
||||
|
||||
if not saved_any:
|
||||
logging.debug('BAZARR No Subtitles were found for this file: ' + path)
|
||||
|
@ -512,7 +513,8 @@ def manual_download_subtitle(path, language, audio_language, hi, forced, subtitl
|
|||
track_event(category=downloaded_provider, action="manually_downloaded",
|
||||
label=downloaded_language)
|
||||
|
||||
return message, reversed_path, downloaded_language_code2, downloaded_provider, subtitle.score, subtitle.language.forced
|
||||
return message, reversed_path, downloaded_language_code2, downloaded_provider, subtitle.score, \
|
||||
subtitle.language.forced, subtitle.id
|
||||
else:
|
||||
logging.error(
|
||||
"BAZARR Tried to manually download a Subtitles for file: " + path + " but we weren't able to do (probably throttled by " + str(
|
||||
|
@ -673,8 +675,10 @@ def series_download_subtitles(no):
|
|||
language_code = result[2] + ":forced" if forced else result[2]
|
||||
provider = result[3]
|
||||
score = result[4]
|
||||
subs_id = result[6]
|
||||
store_subtitles(episode['path'], path_mappings.path_replace(episode['path']))
|
||||
history_log(1, no, episode['sonarrEpisodeId'], message, path, language_code, provider, score)
|
||||
history_log(1, no, episode['sonarrEpisodeId'], message, path, language_code, provider, score,
|
||||
subs_id)
|
||||
send_notifications(no, episode['sonarrEpisodeId'], message)
|
||||
else:
|
||||
logging.info("BAZARR All providers are throttled")
|
||||
|
@ -717,9 +721,10 @@ def episode_download_subtitles(no):
|
|||
language_code = result[2] + ":forced" if forced else result[2]
|
||||
provider = result[3]
|
||||
score = result[4]
|
||||
subs_id = result[6]
|
||||
store_subtitles(episode['path'], path_mappings.path_replace(episode['path']))
|
||||
history_log(1, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message, path,
|
||||
language_code, provider, score)
|
||||
language_code, provider, score, subs_id)
|
||||
send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message)
|
||||
else:
|
||||
logging.info("BAZARR All providers are throttled")
|
||||
|
@ -765,8 +770,9 @@ def movies_download_subtitles(no):
|
|||
language_code = result[2] + ":forced" if forced else result[2]
|
||||
provider = result[3]
|
||||
score = result[4]
|
||||
subs_id = result[6]
|
||||
store_subtitles_movie(movie['path'], path_mappings.path_replace_movie(movie['path']))
|
||||
history_log_movie(1, no, message, path, language_code, provider, score)
|
||||
history_log_movie(1, no, message, path, language_code, provider, score, subs_id)
|
||||
send_notifications_movie(no, message)
|
||||
else:
|
||||
logging.info("BAZARR All providers are throttled")
|
||||
|
@ -877,8 +883,10 @@ def wanted_download_subtitles_movie(path, l, count_movies):
|
|||
language_code = result[2] + ":forced" if forced else result[2]
|
||||
provider = result[3]
|
||||
score = result[4]
|
||||
subs_id = result[6]
|
||||
store_subtitles_movie(movie['path'], path_mappings.path_replace_movie(movie['path']))
|
||||
history_log_movie(1, movie['radarrId'], message, path, language_code, provider, score)
|
||||
history_log_movie(1, movie['radarrId'], message, path, language_code, provider, score,
|
||||
subs_id)
|
||||
send_notifications_movie(movie['radarrId'], message)
|
||||
else:
|
||||
logging.info(
|
||||
|
@ -1158,9 +1166,10 @@ def upgrade_subtitles():
|
|||
language_code = result[2] + ":forced" if forced else result[2]
|
||||
provider = result[3]
|
||||
score = result[4]
|
||||
subs_id = result[6]
|
||||
store_subtitles(episode['video_path'], path_mappings.path_replace(episode['video_path']))
|
||||
history_log(3, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message, path,
|
||||
language_code, provider, score)
|
||||
language_code, provider, score, subs_id)
|
||||
send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message)
|
||||
|
||||
if settings.general.getboolean('use_radarr'):
|
||||
|
@ -1207,9 +1216,10 @@ def upgrade_subtitles():
|
|||
language_code = result[2] + ":forced" if forced else result[2]
|
||||
provider = result[3]
|
||||
score = result[4]
|
||||
subs_id = result[6]
|
||||
store_subtitles_movie(movie['video_path'],
|
||||
path_mappings.path_replace_movie(movie['video_path']))
|
||||
history_log_movie(3, movie['radarrId'], message, path, language_code, provider, score)
|
||||
history_log_movie(3, movie['radarrId'], message, path, language_code, provider, score, subs_id)
|
||||
send_notifications_movie(movie['radarrId'], message)
|
||||
|
||||
|
||||
|
|
|
@ -22,18 +22,19 @@ class BinaryNotFound(Exception):
|
|||
|
||||
|
||||
def history_log(action, sonarr_series_id, sonarr_episode_id, description, video_path=None, language=None, provider=None,
|
||||
score=None):
|
||||
score=None, subs_id=None):
|
||||
database.execute("INSERT INTO table_history (action, sonarrSeriesId, sonarrEpisodeId, timestamp, description,"
|
||||
"video_path, language, provider, score) VALUES (?,?,?,?,?,?,?,?,?)",
|
||||
"video_path, language, provider, score, subs_id) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
(action, sonarr_series_id, sonarr_episode_id, time.time(), description, video_path, language,
|
||||
provider, score))
|
||||
provider, score, subs_id))
|
||||
event_stream(type='episodeHistory')
|
||||
|
||||
|
||||
def history_log_movie(action, radarr_id, description, video_path=None, language=None, provider=None, score=None):
|
||||
def history_log_movie(action, radarr_id, description, video_path=None, language=None, provider=None, score=None,
|
||||
subs_id=None):
|
||||
database.execute("INSERT INTO table_history_movie (action, radarrId, timestamp, description, video_path, language, "
|
||||
"provider, score) VALUES (?,?,?,?,?,?,?,?)",
|
||||
(action, radarr_id, time.time(), description, video_path, language, provider, score))
|
||||
"provider, score, subs_id) VALUES (?,?,?,?,?,?,?,?,?)",
|
||||
(action, radarr_id, time.time(), description, video_path, language, provider, score, subs_id))
|
||||
event_stream(type='movieHistory')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue