@ -448,10 +448,12 @@ def series_download_subtitles(no):
providers_list = get_providers ( )
providers_list = get_providers ( )
providers_auth = get_providers_auth ( )
providers_auth = get_providers_auth ( )
for episode in episodes_details :
count_episodes_details = len ( episodes_details )
for i , episode in enumerate ( episodes_details , 1 ) :
for language in ast . literal_eval ( episode [ 1 ] ) :
for language in ast . literal_eval ( episode [ 1 ] ) :
if language is not None :
if language is not None :
notifications . write ( msg = ' Searching for ' + str ( language_from_alpha2( language ) ) + ' subtitles for this episode: ' + path_replace ( episode [ 0 ] ) , queue = ' get_subtitle ' )
notifications . write ( msg = ' Searching for series subtitles : ' + str ( i) + ' / ' + str ( count_episodes_details ) , queue = ' get_subtitle ' , duration = ' long ' , item = i , length = count_episodes_details )
result = download_subtitle ( path_replace ( episode [ 0 ] ) , str ( alpha3_from_alpha2 ( language ) ) ,
result = download_subtitle ( path_replace ( episode [ 0 ] ) , str ( alpha3_from_alpha2 ( language ) ) ,
series_details [ 0 ] , providers_list , providers_auth , str ( episode [ 3 ] ) ,
series_details [ 0 ] , providers_list , providers_auth , str ( episode [ 3 ] ) ,
series_details [ 1 ] , ' series ' )
series_details [ 1 ] , ' series ' )
@ -480,9 +482,11 @@ def movies_download_subtitles(no):
providers_list = get_providers ( )
providers_list = get_providers ( )
providers_auth = get_providers_auth ( )
providers_auth = get_providers_auth ( )
for language in ast . literal_eval ( movie [ 1 ] ) :
count_movie = len ( ast . literal_eval ( movie [ 1 ] ) )
for i , language in enumerate ( ast . literal_eval ( movie [ 1 ] ) , 1 ) :
if language is not None :
if language is not None :
notifications . write ( msg = ' Searching for ' + str ( language_from_alpha2 ( language ) ) + ' subtitles for this movie: ' + path_replace_movie ( movie [ 0 ] ) , queue = ' get_subtitle ' )
notifications . write ( msg = ' Searching for movies subtitles : ' + str ( i) + ' / ' + str ( count_movie ) , queue = ' get_subtitle ' , duration = ' long ' , item = i , length = count_movie )
result = download_subtitle ( path_replace_movie ( movie [ 0 ] ) , str ( alpha3_from_alpha2 ( language ) ) , movie [ 4 ] ,
result = download_subtitle ( path_replace_movie ( movie [ 0 ] ) , str ( alpha3_from_alpha2 ( language ) ) , movie [ 4 ] ,
providers_list , providers_auth , str ( movie [ 3 ] ) , movie [ 5 ] , ' movie ' )
providers_list , providers_auth , str ( movie [ 3 ] ) , movie [ 5 ] , ' movie ' )
if result is not None :
if result is not None :
@ -499,7 +503,7 @@ def movies_download_subtitles(no):
notifications . write ( msg = ' Searching completed. Please reload the page. ' , type = ' success ' , duration = ' permanent ' , button = ' refresh ' , queue = ' get_subtitle ' )
notifications . write ( msg = ' Searching completed. Please reload the page. ' , type = ' success ' , duration = ' permanent ' , button = ' refresh ' , queue = ' get_subtitle ' )
def wanted_download_subtitles ( path ):
def wanted_download_subtitles ( path , l , count_episodes ):
conn_db = sqlite3 . connect ( os . path . join ( args . config_dir , ' db ' , ' bazarr.db ' ) , timeout = 30 )
conn_db = sqlite3 . connect ( os . path . join ( args . config_dir , ' db ' , ' bazarr.db ' ) , timeout = 30 )
c_db = conn_db . cursor ( )
c_db = conn_db . cursor ( )
episodes_details = c_db . execute (
episodes_details = c_db . execute (
@ -533,8 +537,7 @@ def wanted_download_subtitles(path):
for i in range ( len ( attempt ) ) :
for i in range ( len ( attempt ) ) :
if attempt [ i ] [ 0 ] == language :
if attempt [ i ] [ 0 ] == language :
if search_active ( attempt [ i ] [ 1 ] ) :
if search_active ( attempt [ i ] [ 1 ] ) :
notifications . write (
notifications . write ( msg = ' Searching for series subtitles : ' + str ( l ) + ' / ' + str ( count_episodes ) , queue = ' get_subtitle ' , duration = ' long ' , item = l , length = count_episodes )
msg = ' Searching ' + str ( language_from_alpha2 ( language ) ) + ' subtitles for this episode: ' + path , queue = ' get_subtitle ' )
result = download_subtitle ( path_replace ( episode [ 0 ] ) , str ( alpha3_from_alpha2 ( language ) ) ,
result = download_subtitle ( path_replace ( episode [ 0 ] ) , str ( alpha3_from_alpha2 ( language ) ) ,
episode [ 4 ] , providers_list , providers_auth , str ( episode [ 5 ] ) ,
episode [ 4 ] , providers_list , providers_auth , str ( episode [ 5 ] ) ,
episode [ 7 ] , ' series ' )
episode [ 7 ] , ' series ' )
@ -553,7 +556,7 @@ def wanted_download_subtitles(path):
' BAZARR Search is not active for episode ' + episode [ 0 ] + ' Language: ' + attempt [ i ] [ 0 ] )
' BAZARR Search is not active for episode ' + episode [ 0 ] + ' Language: ' + attempt [ i ] [ 0 ] )
def wanted_download_subtitles_movie ( path ):
def wanted_download_subtitles_movie ( path , l , count_movies ):
conn_db = sqlite3 . connect ( os . path . join ( args . config_dir , ' db ' , ' bazarr.db ' ) , timeout = 30 )
conn_db = sqlite3 . connect ( os . path . join ( args . config_dir , ' db ' , ' bazarr.db ' ) , timeout = 30 )
c_db = conn_db . cursor ( )
c_db = conn_db . cursor ( )
movies_details = c_db . execute (
movies_details = c_db . execute (
@ -586,8 +589,7 @@ def wanted_download_subtitles_movie(path):
for i in range ( len ( attempt ) ) :
for i in range ( len ( attempt ) ) :
if attempt [ i ] [ 0 ] == language :
if attempt [ i ] [ 0 ] == language :
if search_active ( attempt [ i ] [ 1 ] ) is True :
if search_active ( attempt [ i ] [ 1 ] ) is True :
notifications . write (
notifications . write ( msg = ' Searching for movies subtitles : ' + str ( l ) + ' / ' + str ( count_movies ) , queue = ' get_subtitle ' , duration = ' long ' , item = l , length = count_movies )
msg = ' Searching ' + str ( language_from_alpha2 ( language ) ) + ' subtitles for this movie: ' + path , queue = ' get_subtitle ' )
result = download_subtitle ( path_replace_movie ( movie [ 0 ] ) , str ( alpha3_from_alpha2 ( language ) ) ,
result = download_subtitle ( path_replace_movie ( movie [ 0 ] ) , str ( alpha3_from_alpha2 ( language ) ) ,
movie [ 4 ] , providers_list , providers_auth , str ( movie [ 5 ] ) , movie [ 7 ] ,
movie [ 4 ] , providers_list , providers_auth , str ( movie [ 5 ] ) , movie [ 7 ] ,
' movie ' )
' movie ' )
@ -634,16 +636,18 @@ def wanted_search_missing_subtitles():
providers = get_providers ( )
providers = get_providers ( )
if settings . general . getboolean ( ' use_sonarr ' ) :
if settings . general . getboolean ( ' use_sonarr ' ) :
if providers :
if providers :
for episode in episodes :
count_episodes = len ( episodes )
wanted_download_subtitles ( episode [ 0 ] )
for i , episode in enumerate ( episodes , 1 ) :
wanted_download_subtitles ( episode [ 0 ] , i , count_episodes )
else :
else :
notifications . write ( msg = ' BAZARR All providers are throttled ' , queue = ' get_subtitle ' )
notifications . write ( msg = ' BAZARR All providers are throttled ' , queue = ' get_subtitle ' )
logging . info ( " BAZARR All providers are throttled " )
logging . info ( " BAZARR All providers are throttled " )
if settings . general . getboolean ( ' use_radarr ' ) :
if settings . general . getboolean ( ' use_radarr ' ) :
if providers :
if providers :
for movie in movies :
count_movies = len ( movies )
wanted_download_subtitles_movie ( movie [ 0 ] )
for i , movie in enumerate ( movies , 1 ) :
wanted_download_subtitles_movie ( movie [ 0 ] , i , count_movies )
else :
else :
notifications . write ( msg = ' BAZARR All providers are throttled ' , queue = ' get_subtitle ' )
notifications . write ( msg = ' BAZARR All providers are throttled ' , queue = ' get_subtitle ' )
logging . info ( " BAZARR All providers are throttled " )
logging . info ( " BAZARR All providers are throttled " )
@ -772,7 +776,7 @@ def upgrade_subtitles():
for i , episode in enumerate ( episodes_to_upgrade , 1 ) :
for i , episode in enumerate ( episodes_to_upgrade , 1 ) :
if episode [ 1 ] in ast . literal_eval ( str ( episode [ 9 ] ) ) :
if episode [ 1 ] in ast . literal_eval ( str ( episode [ 9 ] ) ) :
notifications . write ( msg = ' Upgrading series subtitles : ' + str ( i ) + ' / ' + str ( count_episode_to_upgrade ) ,
notifications . write ( msg = ' Upgrading series subtitles : ' + str ( i ) + ' / ' + str ( count_episode_to_upgrade ) ,
queue = ' get_subtitle ' , duration = ' long ' )
queue = ' get_subtitle ' , duration = ' long ' , item = i , length = count_episode_to_upgrade )
result = download_subtitle ( path_replace ( episode [ 0 ] ) , str ( alpha3_from_alpha2 ( episode [ 1 ] ) ) ,
result = download_subtitle ( path_replace ( episode [ 0 ] ) , str ( alpha3_from_alpha2 ( episode [ 1 ] ) ) ,
episode [ 3 ] , providers_list , providers_auth , str ( episode [ 4 ] ) ,
episode [ 3 ] , providers_list , providers_auth , str ( episode [ 4 ] ) ,
episode [ 5 ] , ' series ' , forced_minimum_score = int ( episode [ 2 ] ) , is_upgrade = True )
episode [ 5 ] , ' series ' , forced_minimum_score = int ( episode [ 2 ] ) , is_upgrade = True )
@ -789,7 +793,7 @@ def upgrade_subtitles():
for i , movie in enumerate ( movies_to_upgrade , 1 ) :
for i , movie in enumerate ( movies_to_upgrade , 1 ) :
if movie [ 1 ] in ast . literal_eval ( str ( movie [ 8 ] ) ) :
if movie [ 1 ] in ast . literal_eval ( str ( movie [ 8 ] ) ) :
notifications . write ( msg = ' Upgrading movie subtitles : ' + str ( i ) + ' / ' + str ( count_movie_to_upgrade ) ,
notifications . write ( msg = ' Upgrading movie subtitles : ' + str ( i ) + ' / ' + str ( count_movie_to_upgrade ) ,
queue = ' get_subtitle ' , duration = ' long ' )
queue = ' get_subtitle ' , duration = ' long ' , item = i , length = count_movie_to_upgrad )
result = download_subtitle ( path_replace_movie ( movie [ 0 ] ) , str ( alpha3_from_alpha2 ( movie [ 1 ] ) ) ,
result = download_subtitle ( path_replace_movie ( movie [ 0 ] ) , str ( alpha3_from_alpha2 ( movie [ 1 ] ) ) ,
movie [ 3 ] , providers_list , providers_auth , str ( movie [ 4 ] ) ,
movie [ 3 ] , providers_list , providers_auth , str ( movie [ 4 ] ) ,
movie [ 5 ] , ' movie ' , forced_minimum_score = int ( movie [ 2 ] ) , is_upgrade = True )
movie [ 5 ] , ' movie ' , forced_minimum_score = int ( movie [ 2 ] ) , is_upgrade = True )