From 12148217a292c2836a8bed28de7c97cf0cf70ec7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 10 Jan 2015 13:41:17 +0100 Subject: [PATCH 1/3] Log failed notification --- couchpotato/core/notifications/core/main.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/couchpotato/core/notifications/core/main.py b/couchpotato/core/notifications/core/main.py index 771d9696..4c39fb77 100644 --- a/couchpotato/core/notifications/core/main.py +++ b/couchpotato/core/notifications/core/main.py @@ -149,16 +149,15 @@ class CoreNotifier(Notification): def notify(self, message = '', data = None, listener = None): if not data: data = {} + n = { + '_t': 'notification', + 'time': int(time.time()), + } + try: db = get_db() - data['notification_type'] = listener if listener else 'unknown' - - n = { - '_t': 'notification', - 'time': int(time.time()), - 'message': toUnicode(message) - } + n['message'] = toUnicode(message) if data.get('sticky'): n['sticky'] = True @@ -171,7 +170,7 @@ class CoreNotifier(Notification): return True except: - log.error('Failed notify: %s', traceback.format_exc()) + log.error('Failed notify "%s": %s', (n, traceback.format_exc())) def frontend(self, type = 'notification', data = None, message = None): if not data: data = {} From 601f0b54cff4f1768105254e801922d1efacb9a8 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 11 Jan 2015 00:25:51 +0100 Subject: [PATCH 2/3] Send CP header when downloading from newznab --- couchpotato/core/media/_base/providers/nzb/newznab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/nzb/newznab.py b/couchpotato/core/media/_base/providers/nzb/newznab.py index 62b787d8..21ce94b3 100644 --- a/couchpotato/core/media/_base/providers/nzb/newznab.py +++ b/couchpotato/core/media/_base/providers/nzb/newznab.py @@ -183,7 +183,7 @@ class Base(NZBProvider, RSS): return 'try_next' try: - data = self.urlopen(url, show_error = False) + data = self.urlopen(url, show_error = False, headers = {'User-Agent': Env.getIdentifier()}) self.limits_reached[host] = False return data except HTTPError as e: From 17fa33a49608e17cbfd260064cadfaac9d9a8368 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 11 Jan 2015 00:25:58 +0100 Subject: [PATCH 3/3] Update user agent --- couchpotato/core/plugins/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index 5a90d92b..c02e8f75 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -39,7 +39,7 @@ class Plugin(object): _locks = {} - user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20130519 Firefox/24.0' + user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0' http_last_use = {} http_time_between_calls = 0 http_failed_request = {}