From 73d1ae56a983b75aecd590a7905071f0dc3352c2 Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Mon, 16 Oct 2023 06:00:27 +0200 Subject: [PATCH] Change improve Emby status check. By preventing exceptions from wrong type comparison in a fetched response --- sickgear/notifiers/emby.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sickgear/notifiers/emby.py b/sickgear/notifiers/emby.py index 196f23b4..a95cf115 100644 --- a/sickgear/notifiers/emby.py +++ b/sickgear/notifiers/emby.py @@ -127,15 +127,15 @@ class EmbyNotifier(Notifier): response = self._request(f'Library/{endpoint}/Updated', cur_host, keys[i], **args) # Emby will initiate a LibraryMonitor path refresh one minute after this success - if 200 <= self.response.get('status_code') < 300 and self.response.get('ok'): + if 200 <= (self.response.get('status_code') or 0) < 300 and self.response.get('ok'): self._log(f'Success: update {mode_to_log} sent to host {cur_host} in a library updated call') continue - elif 401 == self.response.get('status_code'): + elif 401 == self.response.get('status_code', 0): self._log_warning(f'Failed to authenticate with {cur_host}') - elif 404 == self.response.get('status_code'): + elif 404 == self.response.get('status_code', 0): args = dict(post_json={'Updates': [{'Path': '', 'UpdateType': ''}]}) self._request(f'Library/Media/Updated', cur_host, keys[i], **args) - if 200 <= self.response.get('status_code') < 300 and self.response.get('ok'): + if 200 <= (self.response.get('status_code') or 0) < 300 and self.response.get('ok'): self._log(f'Success: fallback to sending Library/Media/Updated call' f' to scan all shows at host {cur_host}') continue