|
|
@ -38,13 +38,15 @@ def sync_episodes():
|
|
|
|
url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId[0]) + "&apikey=" + apikey_sonarr
|
|
|
|
url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId[0]) + "&apikey=" + apikey_sonarr
|
|
|
|
r = requests.get(url_sonarr_api_episode)
|
|
|
|
r = requests.get(url_sonarr_api_episode)
|
|
|
|
for episode in r.json():
|
|
|
|
for episode in r.json():
|
|
|
|
if episode['hasFile'] and episode['episodeFile']['size'] > 20480:
|
|
|
|
if episode['hasFile'] is True:
|
|
|
|
# Add shows in Sonarr to current shows list
|
|
|
|
if 'episodeFile' in episode:
|
|
|
|
if 'sceneName' in episode['episodeFile']:
|
|
|
|
if episode['episodeFile']['size'] > 20480:
|
|
|
|
sceneName = episode['episodeFile']['sceneName']
|
|
|
|
# Add shows in Sonarr to current shows list
|
|
|
|
else:
|
|
|
|
if 'sceneName' in episode['episodeFile']:
|
|
|
|
sceneName = None
|
|
|
|
sceneName = episode['episodeFile']['sceneName']
|
|
|
|
current_episodes_sonarr.append((episode['seriesId'], episode['id'], episode['title'], episode['episodeFile']['path'], episode['seasonNumber'], episode['episodeNumber'], 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))
|
|
|
|
added_episodes = list(set(current_episodes_sonarr) - set(current_episodes_db))
|
|
|
|
removed_episodes = list(set(current_episodes_db) - set(current_episodes_sonarr))
|
|
|
|
removed_episodes = list(set(current_episodes_db) - set(current_episodes_sonarr))
|
|
|
|