mirror of https://github.com/morpheus65535/bazarr
Add another check for incorrect json returned by Sonarr #101
This commit is contained in:
parent
ded4a43846
commit
8825a83c95
|
@ -8,15 +8,15 @@ from list_subtitles import *
|
|||
|
||||
def update_all_episodes():
|
||||
series_full_scan_subtitles()
|
||||
logging.info('All existing subtitles indexed from disk.')
|
||||
logging.info('All existing episode subtitles indexed from disk.')
|
||||
list_missing_subtitles()
|
||||
logging.info('All missing subtitles updated in database.')
|
||||
logging.info('All missing episode subtitles updated in database.')
|
||||
|
||||
def update_all_movies():
|
||||
movies_full_scan_subtitles()
|
||||
logging.info('All existing subtitles indexed from disk.')
|
||||
logging.info('All existing movie subtitles indexed from disk.')
|
||||
list_missing_subtitles()
|
||||
logging.info('All missing subtitles updated in database.')
|
||||
logging.info('All missing movie subtitles updated in database.')
|
||||
|
||||
def sync_episodes():
|
||||
from get_sonarr_settings import get_sonarr_settings
|
||||
|
@ -38,15 +38,16 @@ def sync_episodes():
|
|||
url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId[0]) + "&apikey=" + apikey_sonarr
|
||||
r = requests.get(url_sonarr_api_episode)
|
||||
for episode in r.json():
|
||||
if episode['hasFile'] is True:
|
||||
if 'episodeFile' in episode:
|
||||
if episode['episodeFile']['size'] > 20480:
|
||||
# Add shows in Sonarr to current shows list
|
||||
if 'sceneName' in episode['episodeFile']:
|
||||
sceneName = episode['episodeFile']['sceneName']
|
||||
else:
|
||||
sceneName = None
|
||||
current_episodes_sonarr.append((episode['seriesId'], episode['id'], episode['title'], episode['episodeFile']['path'], episode['seasonNumber'], episode['episodeNumber'], sceneName))
|
||||
if 'hasFile' in episode:
|
||||
if episode['hasFile'] is True:
|
||||
if 'episodeFile' in episode:
|
||||
if episode['episodeFile']['size'] > 20480:
|
||||
# Add shows in Sonarr to current shows list
|
||||
if 'sceneName' in episode['episodeFile']:
|
||||
sceneName = episode['episodeFile']['sceneName']
|
||||
else:
|
||||
sceneName = None
|
||||
current_episodes_sonarr.append((episode['seriesId'], episode['id'], episode['title'], episode['episodeFile']['path'], episode['seasonNumber'], episode['episodeNumber'], sceneName))
|
||||
|
||||
added_episodes = list(set(current_episodes_sonarr) - set(current_episodes_db))
|
||||
removed_episodes = list(set(current_episodes_db) - set(current_episodes_sonarr))
|
||||
|
|
Loading…
Reference in New Issue