logging.debug('BAZARR '+str(len(subtitles_list))+" subtitles have been found for this file: "+path)
logging.debug(
'BAZARR '+str(len(subtitles_list))+" subtitles have been found for this file: "+path)
iflen(subtitles_list)>0:
try:
pdownload_result=False
forsubtitleinsubtitles_list:
download_result=p.download_subtitle(subtitle)
ifdownload_result==True:
logging.debug('BAZARR Subtitles file downloaded from '+str(subtitle.provider_name)+' for this file: '+path)
logging.debug('BAZARR Subtitles file downloaded from '+str(
subtitle.provider_name)+' for this file: '+path)
break
else:
logging.warning('BAZARR Subtitles file skipped from '+str(subtitle.provider_name)+' for this file: '+path+' because no content was returned by the provider (probably throttled).')
logging.warning('BAZARR Subtitles file skipped from '+str(
subtitle.provider_name)+' for this file: '+path+' because no content was returned by the provider (probably throttled).')
continue
ifdownload_result==False:
logging.error('BAZARR Tried to download a subtitles for file: '+path+" but we weren't able to do it this time (probably being throttled). Going to retry on next search.")
logging.error(
'BAZARR Tried to download a subtitles for file: '+path+" but we weren't able to do it this time (probably being throttled). Going to retry on next search.")
returnNone
exceptExceptionase:
logging.exception('BAZARR Error downloading subtitles for this file '+path)
logging.debug('BAZARR Subtitles file saved to disk: '+downloaded_path)
ifused_sceneName==True:
message=downloaded_language+" subtitles downloaded from "+downloaded_provider+" with a score of "+unicode(calculated_score)+"% using this scene name: "+sceneName
message=downloaded_language+" subtitles downloaded from "+downloaded_provider+" with a score of "+unicode(
calculated_score)+"% using this scene name: "+sceneName
else:
message=downloaded_language+" subtitles downloaded from "+downloaded_provider+" with a score of "+unicode(calculated_score)+"% using filename guessing."
message=downloaded_language+" subtitles downloaded from "+downloaded_provider+" with a score of "+unicode(
logging.error('BAZARR Post-processing result for file '+path+' : Nothing returned from command execution')
logging.error(
'BAZARR Post-processing result for file '+path+' : Nothing returned from command execution')
else:
logging.error('BAZARR Post-processing result for file '+path+' : '+out)
else:
ifout=="":
logging.info('BAZARR Post-processing result for file '+path+' : Nothing returned from command execution')
logging.info(
'BAZARR Post-processing result for file '+path+' : Nothing returned from command execution')
else:
logging.info('BAZARR Post-processing result for file '+path+' : '+out)
returnmessage
else:
logging.error('BAZARR Tried to manually download a subtitles for file: '+path+" but we weren't able to do (probably throttled by ' + str(subtitle.provider_name) + '. Please retry later or select a subtitles from another provider.")
logging.error(
'BAZARR Tried to manually download a subtitles for file: '+path+" but we weren't able to do (probably throttled by ' + str(subtitle.provider_name) + '. Please retry later or select a subtitles from another provider.")
returnNone
logging.debug('BAZARR Ended manually downloading subtitles for file: '+path)
defseries_download_subtitles(no):
ifget_general_settings()[24]isTrue:
monitored_only_query_string=' AND monitored = "True"'
episodes_details=c_db.execute('SELECT path, missing_subtitles, sonarrEpisodeId, scene_name FROM table_episodes WHERE sonarrSeriesId = ? AND missing_subtitles != "[]"'+monitored_only_query_string,(no,)).fetchall()
episodes_details=c_db.execute(
'SELECT path, missing_subtitles, sonarrEpisodeId, scene_name FROM table_episodes WHERE sonarrSeriesId = ? AND missing_subtitles != "[]"'+monitored_only_query_string,
(no,)).fetchall()
series_details=c_db.execute("SELECT hearing_impaired FROM table_shows WHERE sonarrSeriesId = ?",(no,)).fetchone()
logging.exception('BAZARR Error trying to detect character encoding for this subtitles file: '+path_replace(os.path.join(os.path.dirname(file),subtitle))+' You should try to delete this subtitles file manually and ask Bazarr to download it again.')
logging.exception(
'BAZARR Error trying to detect character encoding for this subtitles file: '+path_replace(
os.path.join(os.path.dirname(file),
subtitle))+' You should try to delete this subtitles file manually and ask Bazarr to download it again.')
logging.exception('BAZARR Error trying to detect character encoding for this subtitles file: '+path_replace_movie(os.path.join(os.path.dirname(file),subtitle))+' You should try to delete this subtitles file manually and ask Bazarr to download it again.')
logging.exception(
'BAZARR Error trying to detect character encoding for this subtitles file: '+path_replace_movie(
os.path.join(os.path.dirname(file),
subtitle))+' You should try to delete this subtitles file manually and ask Bazarr to download it again.')
c.execute("SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster, audio_language FROM table_shows ORDER BY sortTitle ASC LIMIT ? OFFSET ?",(page_size,offset,))
c.execute(
"SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster, audio_language FROM table_shows ORDER BY sortTitle ASC LIMIT ? OFFSET ?",
(page_size,offset,))
data=c.fetchall()
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
languages=c.fetchall()
c.execute("SELECT table_shows.sonarrSeriesId, COUNT(table_episodes.missing_subtitles) FROM table_shows LEFT JOIN table_episodes ON table_shows.sonarrSeriesId=table_episodes.sonarrSeriesId WHERE table_shows.languages IS NOT 'None' AND table_episodes.missing_subtitles IS NOT '[]'"+monitored_only_query_string+" GROUP BY table_shows.sonarrSeriesId")
c.execute(
"SELECT table_shows.sonarrSeriesId, COUNT(table_episodes.missing_subtitles) FROM table_shows LEFT JOIN table_episodes ON table_shows.sonarrSeriesId=table_episodes.sonarrSeriesId WHERE table_shows.languages IS NOT 'None' AND table_episodes.missing_subtitles IS NOT '[]'"+monitored_only_query_string+" GROUP BY table_shows.sonarrSeriesId")
missing_subtitles_list=c.fetchall()
c.execute("SELECT table_shows.sonarrSeriesId, COUNT(table_episodes.missing_subtitles) FROM table_shows LEFT JOIN table_episodes ON table_shows.sonarrSeriesId=table_episodes.sonarrSeriesId WHERE table_shows.languages IS NOT 'None'"+monitored_only_query_string+" GROUP BY table_shows.sonarrSeriesId")
c.execute(
"SELECT table_shows.sonarrSeriesId, COUNT(table_episodes.missing_subtitles) FROM table_shows LEFT JOIN table_episodes ON table_shows.sonarrSeriesId=table_episodes.sonarrSeriesId WHERE table_shows.languages IS NOT 'None'"+monitored_only_query_string+" GROUP BY table_shows.sonarrSeriesId")
c.execute("SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster, audio_language FROM table_shows ORDER BY title ASC")
c.execute(
"SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster, audio_language FROM table_shows ORDER BY title ASC")
data=c.fetchall()
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
series_details=c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tvdbid, audio_language, languages, path_substitution(path) FROM table_shows WHERE sonarrSeriesId LIKE ?",(str(no),)).fetchone()
series_details=c.execute(
"SELECT title, overview, poster, fanart, hearing_impaired, tvdbid, audio_language, languages, path_substitution(path) FROM table_shows WHERE sonarrSeriesId LIKE ?",
(str(no),)).fetchone()
tvdbid=series_details[5]
episodes=c.execute("SELECT title, path_substitution(path), season, episode, subtitles, sonarrSeriesId, missing_subtitles, sonarrEpisodeId, scene_name, monitored FROM table_episodes WHERE sonarrSeriesId LIKE ? ORDER BY episode ASC",(str(no),)).fetchall()
episodes=c.execute(
"SELECT title, path_substitution(path), season, episode, subtitles, sonarrSeriesId, missing_subtitles, sonarrEpisodeId, scene_name, monitored FROM table_episodes WHERE sonarrSeriesId LIKE ? ORDER BY episode ASC",
(str(no),)).fetchall()
number=len(episodes)
languages=c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall()
c.execute("SELECT tmdbId, title, path_substitution(path), languages, hearing_impaired, radarrId, poster, audio_language, monitored FROM table_movies ORDER BY title ASC LIMIT ? OFFSET ?",(page_size,offset,))
c.execute(
"SELECT tmdbId, title, path_substitution(path), languages, hearing_impaired, radarrId, poster, audio_language, monitored FROM table_movies ORDER BY title ASC LIMIT ? OFFSET ?",
(page_size,offset,))
data=c.fetchall()
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
c.execute("SELECT tmdbId, title, path_substitution(path), languages, hearing_impaired, radarrId, poster, audio_language FROM table_movies ORDER BY title ASC")
c.execute(
"SELECT tmdbId, title, path_substitution(path), languages, hearing_impaired, radarrId, poster, audio_language FROM table_movies ORDER BY title ASC")
data=c.fetchall()
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
c.execute("SELECT table_history.action, table_shows.title, table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, table_history.timestamp, table_history.description, table_history.sonarrSeriesId FROM table_history LEFT JOIN table_shows on table_shows.sonarrSeriesId = table_history.sonarrSeriesId LEFT JOIN table_episodes on table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId ORDER BY id DESC LIMIT ? OFFSET ?",(page_size,offset,))
c.execute(
"SELECT table_history.action, table_shows.title, table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, table_history.timestamp, table_history.description, table_history.sonarrSeriesId FROM table_history LEFT JOIN table_shows on table_shows.sonarrSeriesId = table_history.sonarrSeriesId LEFT JOIN table_episodes on table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId ORDER BY id DESC LIMIT ? OFFSET ?",
c.execute("SELECT table_history_movie.action, table_movies.title, table_history_movie.timestamp, table_history_movie.description, table_history_movie.radarrId FROM table_history_movie LEFT JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId ORDER BY id DESC LIMIT ? OFFSET ?",(page_size,offset,))
c.execute(
"SELECT table_history_movie.action, table_movies.title, table_history_movie.timestamp, table_history_movie.description, table_history_movie.radarrId FROM table_history_movie LEFT JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId ORDER BY id DESC LIMIT ? OFFSET ?",
c.execute("UPDATE table_settings_providers SET username = ?, password = ? WHERE name = 'addic7ed'",(settings_addic7ed_username,settings_addic7ed_password))
c.execute("UPDATE table_settings_providers SET username = ?, password = ? WHERE name = 'addic7ed'",
c.execute("UPDATE table_settings_providers SET username = ?, password = ? WHERE name = 'legendastv'",(settings_legendastv_username,settings_legendastv_password))
c.execute("UPDATE table_settings_providers SET username = ?, password = ? WHERE name = 'legendastv'",
c.execute("UPDATE table_settings_providers SET username = ?, password = ? WHERE name = 'opensubtitles'",(settings_opensubtitles_username,settings_opensubtitles_password))
c.execute("UPDATE table_settings_providers SET username = ?, password = ? WHERE name = 'opensubtitles'",
data=c.execute("SELECT table_movies.title, table_movies.missing_subtitles FROM table_movies WHERE table_movies.missing_subtitles != '[]' ORDER BY table_movies._rowid_ DESC").fetchall()
data=c.execute(
"SELECT table_movies.title, table_movies.missing_subtitles FROM table_movies WHERE table_movies.missing_subtitles != '[]' ORDER BY table_movies._rowid_ DESC").fetchall()
data=c.execute("SELECT table_movies.title, strftime('%Y-%m-%d', datetime(table_history_movie.timestamp, 'unixepoch')), table_history_movie.description FROM table_history_movie INNER JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId WHERE table_history_movie.action = '1' ORDER BY id DESC").fetchall()
data=c.execute(
"SELECT table_movies.title, strftime('%Y-%m-%d', datetime(table_history_movie.timestamp, 'unixepoch')), table_history_movie.description FROM table_history_movie INNER JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId WHERE table_history_movie.action = '1' ORDER BY id DESC").fetchall()
misfire_grace_time=15,id='update_all_movies',name='Update all movies subtitles from disk',
misfire_grace_time=15,id='update_all_movies',
name='Update all movies subtitles from disk',
replace_existing=True)
@ -61,25 +68,32 @@ if str(get_localzone()) == "local":
else:
scheduler=BackgroundScheduler()
ifno_update isFalse:
ifnotargs.no_update:
ifautomaticisTrue:
scheduler.add_job(check_and_apply_update,IntervalTrigger(hours=6),max_instances=1,coalesce=True,misfire_grace_time=15,id='update_bazarr',name='Update bazarr from source on Github')
scheduler.add_job(update_series,IntervalTrigger(minutes=1),max_instances=1,coalesce=True,misfire_grace_time=15,id='update_series',name='Update series list from Sonarr')
scheduler.add_job(sync_episodes,IntervalTrigger(minutes=5),max_instances=1,coalesce=True,misfire_grace_time=15,id='sync_episodes',name='Sync episodes with Sonarr')
id='sync_episodes',name='Sync episodes with Sonarr')
ifintegration[13]isTrue:
scheduler.add_job(update_movies,IntervalTrigger(minutes=5),max_instances=1,coalesce=True,misfire_grace_time=15,id='update_movies',name='Update movies list from Radarr')
id='update_movies',name='Update movies list from Radarr')
ifintegration[12]isTrueorintegration[13]isTrue:
scheduler.add_job(wanted_search_missing_subtitles,IntervalTrigger(hours=3),max_instances=1,coalesce=True,misfire_grace_time=15,id='wanted_search_missing_subtitles',name='Search for wanted subtitles')