show error message when adding movie/series fails.

pull/3/head
l3uddz 7 years ago
parent affa47afb5
commit 96d9769a0f

@ -98,9 +98,8 @@ class Radarr:
if req.status_code == 201 and req.json()['tmdbId'] == movie_tmdbid: if req.status_code == 201 and req.json()['tmdbId'] == movie_tmdbid:
log.debug("Successfully added %s (%d)", movie_title, movie_tmdbid) log.debug("Successfully added %s (%d)", movie_title, movie_tmdbid)
return True return True
elif req.status_code == 401: elif req.status_code == 409 and 'message' in req.text:
log.error("Failed to add %s (%d), reason: %s", movie_title, movie_tmdbid, log.error("Failed to add %s (%d), reason: %s", movie_title, movie_tmdbid, req.json()['message'])
req.json()['errorMessage'] if '{' in req.text else "\n{}".format(req.text))
return False return False
else: else:
log.error("Failed to add %s (%d), unexpected response:\n%s", movie_title, movie_tmdbid, req.text) log.error("Failed to add %s (%d), unexpected response:\n%s", movie_title, movie_tmdbid, req.text)

@ -98,9 +98,8 @@ class Sonarr:
if req.status_code == 201 and req.json()['tvdbId'] == series_tvdbid: if req.status_code == 201 and req.json()['tvdbId'] == series_tvdbid:
log.debug("Successfully added %s (%d)", series_title, series_tvdbid) log.debug("Successfully added %s (%d)", series_title, series_tvdbid)
return True return True
elif req.status_code == 401: elif req.status_code == 401 and 'errorMessage' in req.text:
log.error("Failed to add %s (%d), reason: %s", series_title, series_tvdbid, log.error("Failed to add %s (%d), reason: %s", series_title, series_tvdbid, req.json()['errorMessage'])
req.json()['errorMessage'] if '{' in req.text else "\n{}".format(req.text))
return False return False
else: else:
log.error("Failed to add %s (%d), unexpected response:\n%s", series_title, series_tvdbid, req.text) log.error("Failed to add %s (%d), unexpected response:\n%s", series_title, series_tvdbid, req.text)

Loading…
Cancel
Save