From f74c83a6b5505d419dcc7ad34fc78bd1af4f23ce Mon Sep 17 00:00:00 2001 From: cytec Date: Tue, 25 Nov 2014 14:32:08 +0100 Subject: [PATCH 1/5] nzbto password fix --- sickbeard/providers/nzbto.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sickbeard/providers/nzbto.py b/sickbeard/providers/nzbto.py index 663db8be1e..1c92913769 100644 --- a/sickbeard/providers/nzbto.py +++ b/sickbeard/providers/nzbto.py @@ -77,10 +77,11 @@ def _get_title_and_url(self, item): tmp_url = "http://nzb.to/inc/ajax/popupdetails.php?n=" + cur_el["href"].split("nid=")[1] x = self.session.get(tmp_url) tro = BeautifulSoup(x.text) - try: - pw = tro.find('span', attrs={"style": "color:#ff0000"}).strong.next.next - except AttributeError: - pw = None + pw = tro.find('span', attrs={"style": "color:#ff0000"}).strong.next.next + #try: + # pw = tro.find('span', attrs={"style": "color:#ff0000"}).strong.next.next + #except AttributeError: + # pw = None if not pw or pw.strip() == "-": title = tmp_title else: From 4d0f4ac00da0ff45246016eddd22558414c19578 Mon Sep 17 00:00:00 2001 From: cytec Date: Mon, 26 Jan 2015 12:52:57 +0100 Subject: [PATCH 2/5] added pushalot notifications --- data/images/notifiers/pushalot.png | Bin 0 -> 927 bytes .../default/config_notifications.tmpl | 50 ++++++++++ data/js/configNotifications.js | 7 ++ sickbeard/__init__.py | 17 ++++ sickbeard/notifiers/__init__.py | 3 + sickbeard/notifiers/pushalot.py | 87 ++++++++++++++++++ sickbeard/webserve.py | 33 ++++++- 7 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 data/images/notifiers/pushalot.png create mode 100644 sickbeard/notifiers/pushalot.py diff --git a/data/images/notifiers/pushalot.png b/data/images/notifiers/pushalot.png new file mode 100644 index 0000000000000000000000000000000000000000..f1d9008c1e6078ebc2275fe1b28961fa1143ee70 GIT binary patch literal 927 zcmV;Q17Q4#P)004R> z004l5008;`004mK004C`008P>0026e000+ooVrmw00004XF*Lt006O%3;baP00009 za7bBm000ib000ib0l1NC?EnA(8gxZibW?9;ba!ELWdKlNX>N2bPDNB8b~7$DE-^4L z^m3s900QqxL_t(YOP!U^OH@%5$7dJ)SY?To2~lk;s$~%^q=iI8qAj9L5fMdE`42?3 zs)a}`A|gv(XK%oSrnSY(UEE0*RNG6je z;)#gpnkX}AB{Za5+HM3AJ3&ASaK*>Opu0l2ypLeC&W7QLUyS{H3Z95?G{Cu7d`&pL z4_MneeAGCEwyQ|m^ML16aP({wGl2%vl@gKIvS{qzrwzI$E~aS+PoSPXq^?Gp?*L&+ z&Mr1-F>Q<58n?ezn>P;Z$H1W0g(C}mCu;3oe5bUu-9|MWbJd3*OJ?xmW``%vXuX@H9slXK6w82mG0YD}elq?mczSD02?UK?ePiMcA3 zo1poP2E)akRI^nTfT_KR#*^<_{8A!ebG5y3NB=! zl#gi$51V=;@E|Ya0H<8w_?26}RJlUEo#vO%Lj&xFg!te*A?AY}|1^lS^TE&DYxDvw zG~jAVlBvb1sPEmb`RF>W4e7VBMp`QmaF+&b2O&e!68e0o0rcBSlLCFl_o%nI(onGE zKL)&Ja|$f-0H3B*ng$N?X&J&vQ3L2V<(dW#r0FF=uv^-11QNx7Zp$QgbZ@}}Y}e+B zx!-O2jZYx~&P!W!pl}If9g@ZTy0o(n2GH8e(C- z4qku)*`9l#i3ZW4zhn$FfEyrR$}PfX`wOKhK&vCQiFp73002ovPDHLkV1loc BnK%Fd literal 0 HcmV?d00001 diff --git a/data/interfaces/default/config_notifications.tmpl b/data/interfaces/default/config_notifications.tmpl index 4c7a5da2c7..c7f00ab3e2 100755 --- a/data/interfaces/default/config_notifications.tmpl +++ b/data/interfaces/default/config_notifications.tmpl @@ -837,6 +837,56 @@ + +
+
+ +

Pushalot

+

Pushalot is a platform for receiving custom push notifications to connected devices running Windows Phone or Windows 8.

+
+
+
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
Click below to test.
+ + +
+ +
+
+ +

diff --git a/data/js/configNotifications.js b/data/js/configNotifications.js index 363d231ec7..9d8f5c922e 100644 --- a/data/js/configNotifications.js +++ b/data/js/configNotifications.js @@ -188,4 +188,11 @@ $(document).ready(function () { $.get(sbRoot + "/home/testNMA", {'nma_api': nma_api, 'nma_priority': nma_priority}, function (data) { $('#testNMA-result').html(data); }); }); + + $('#testPushalot').click(function () { + $('#testPushalot-result').html(loading); + var pushalot_authorizationtoken = $("pushalot_authorizationtoken").val(); + $.get(sbRoot + "/home/testPushalot", {'authorizationToken': pushalot_authorizationtoken}, + function (data) { $('#testPushalot-result').html(data); }); + }); }); diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 1553b25ca6..d7d32481e0 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -305,6 +305,11 @@ NMA_NOTIFY_ONDOWNLOAD = False NMA_API = None NMA_PRIORITY = 0 + +USE_PUSHALOT = False +PUSHALOT_NOTIFY_ONSNATCH = False +PUSHALOT_NOTIFY_ONDOWNLOAD = False +PUSHALOT_AUTHORIZATIONTOKEN = None COMING_EPS_LAYOUT = None COMING_EPS_DISPLAY_PAUSED = None @@ -733,6 +738,12 @@ def initialize(consoleLogging=True): NMA_API = check_setting_str(CFG, 'NMA', 'nma_api', '') NMA_PRIORITY = check_setting_str(CFG, 'NMA', 'nma_priority', "0") + CheckSection(CFG, 'Pushalot') + USE_PUSHALOT = bool(check_setting_int(CFG, 'Pushalot', 'use_pushalot', 0)) + PUSHALOT_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Pushalot', 'pushalot_notify_onsnatch', 0)) + PUSHALOT_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Pushalot', 'pushalot_notify_ondownload', 0)) + PUSHALOT_AUTHORIZATIONTOKEN = check_setting_str(CFG, 'Pushalot', 'pushalot_authorizationtoken', '') + # start up all the threads logger.sb_log_instance.initLogging(consoleLogging=consoleLogging) @@ -1234,6 +1245,12 @@ def save_config(): new_config['NMA']['nma_api'] = NMA_API new_config['NMA']['nma_priority'] = NMA_PRIORITY + new_config['Pushalot'] = {} + new_config['Pushalot']['use_pushalot'] = int(USE_PUSHALOT) + new_config['Pushalot']['pushalot_notify_onsnatch'] = int(PUSHALOT_NOTIFY_ONSNATCH) + new_config['Pushalot']['pushalot_notify_ondownload'] = int(PUSHALOT_NOTIFY_ONDOWNLOAD) + new_config['Pushalot']['pushalot_authorizationtoken'] = PUSHALOT_AUTHORIZATIONTOKEN + new_config['Newznab'] = {} new_config['Newznab']['newznab_data'] = '!!!'.join([x.configStr() for x in newznabProviderList]) diff --git a/sickbeard/notifiers/__init__.py b/sickbeard/notifiers/__init__.py index fb28b7ddcd..9db7b018e1 100755 --- a/sickbeard/notifiers/__init__.py +++ b/sickbeard/notifiers/__init__.py @@ -32,6 +32,7 @@ import pushover import boxcar import nma +import pushalot import tweet import trakt @@ -53,6 +54,7 @@ pushover_notifier = pushover.PushoverNotifier() boxcar_notifier = boxcar.BoxcarNotifier() nma_notifier = nma.NMA_Notifier() +pushalot_notifier = pushalot.PushalotNotifier() # online twitter_notifier = tweet.TwitterNotifier() trakt_notifier = trakt.TraktNotifier() @@ -71,6 +73,7 @@ pushover_notifier, boxcar_notifier, nma_notifier, + pushalot_notifier, twitter_notifier, trakt_notifier, ] diff --git a/sickbeard/notifiers/pushalot.py b/sickbeard/notifiers/pushalot.py new file mode 100644 index 0000000000..5c55e1aa8d --- /dev/null +++ b/sickbeard/notifiers/pushalot.py @@ -0,0 +1,87 @@ +# Author: Maciej Olesinski (https://github.com/molesinski/) +# Based on prowl.py by Nic Wolfe +# URL: http://code.google.com/p/sickbeard/ +# +# This file is part of Sick Beard. +# +# Sick Beard is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Sick Beard is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Sick Beard. If not, see . + +from httplib import HTTPSConnection, HTTPException +from urllib import urlencode + +try: + # this only exists in 2.6 + from ssl import SSLError +except ImportError: + # make a fake one since I don't know what it is supposed to be in 2.5 + class SSLError(Exception): + pass + +import sickbeard + +from sickbeard import logger, common + +class PushalotNotifier: + + def test_notify(self, pushalot_authorizationtoken): + return self._sendPushalot(pushalot_authorizationtoken, event="Test", message="Testing Pushalot settings from Sick Beard", force=True) + + def notify_snatch(self, ep_name): + if sickbeard.PUSHALOT_NOTIFY_ONSNATCH: + self._sendPushalot(pushalot_authorizationtoken=None, event=common.notifyStrings[common.NOTIFY_SNATCH], message=ep_name) + + def notify_download(self, ep_name): + if sickbeard.PUSHALOT_NOTIFY_ONDOWNLOAD: + self._sendPushalot(pushalot_authorizationtoken=None, event=common.notifyStrings[common.NOTIFY_DOWNLOAD], message=ep_name) + + def _sendPushalot(self, pushalot_authorizationtoken=None, event=None, message=None, force=False): + + if not sickbeard.USE_PUSHALOT and not force: + return False + + if pushalot_authorizationtoken == None: + pushalot_authorizationtoken = sickbeard.PUSHALOT_AUTHORIZATIONTOKEN + + logger.log(u"Pushalot event: " + event, logger.DEBUG) + logger.log(u"Pushalot message: " + message, logger.DEBUG) + logger.log(u"Pushalot api: " + pushalot_authorizationtoken, logger.DEBUG) + + http_handler = HTTPSConnection("pushalot.com") + + data = {'AuthorizationToken': pushalot_authorizationtoken, + 'Title': event.encode('utf-8'), + 'Body': message.encode('utf-8') } + + try: + http_handler.request("POST", + "/api/sendmessage", + headers = {'Content-type': "application/x-www-form-urlencoded"}, + body = urlencode(data)) + except (SSLError, HTTPException): + logger.log(u"Pushalot notification failed.", logger.ERROR) + return False + response = http_handler.getresponse() + request_status = response.status + + if request_status == 200: + logger.log(u"Pushalot notifications sent.", logger.DEBUG) + return True + elif request_status == 410: + logger.log(u"Pushalot auth failed: %s" % response.reason, logger.ERROR) + return False + else: + logger.log(u"Pushalot notification failed.", logger.ERROR) + return False + +notifier = PushalotNotifier diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 941843b6a9..32e9c26d90 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -1220,7 +1220,8 @@ def saveNotifications(self, use_xbmc=None, xbmc_notify_onsnatch=None, xbmc_notif use_trakt=None, trakt_username=None, trakt_password=None, trakt_api=None, use_pytivo=None, pytivo_notify_onsnatch=None, pytivo_notify_ondownload=None, pytivo_update_library=None, pytivo_host=None, pytivo_share_name=None, pytivo_tivo_name=None, - use_nma=None, nma_notify_onsnatch=None, nma_notify_ondownload=None, nma_api=None, nma_priority=0 ): + use_nma=None, nma_notify_onsnatch=None, nma_notify_ondownload=None, nma_api=None, nma_priority=0, + use_pushalot=None, pushalot_notify_onsnatch=None, pushalot_notify_ondownload=None, pushalot_authorizationtoken=None ): results = [] @@ -1414,6 +1415,21 @@ def saveNotifications(self, use_xbmc=None, xbmc_notify_onsnatch=None, xbmc_notif else: nma_notify_ondownload = 0 + if use_pushalot == "on": + use_pushalot = 1 + else: + use_pushalot = 0 + + if pushalot_notify_onsnatch == "on": + pushalot_notify_onsnatch = 1 + else: + pushalot_notify_onsnatch = 0 + + if pushalot_notify_ondownload == "on": + pushalot_notify_ondownload = 1 + else: + pushalot_notify_ondownload = 0 + sickbeard.USE_XBMC = use_xbmc sickbeard.XBMC_NOTIFY_ONSNATCH = xbmc_notify_onsnatch sickbeard.XBMC_NOTIFY_ONDOWNLOAD = xbmc_notify_ondownload @@ -1500,6 +1516,11 @@ def saveNotifications(self, use_xbmc=None, xbmc_notify_onsnatch=None, xbmc_notif sickbeard.NMA_API = nma_api sickbeard.NMA_PRIORITY = nma_priority + sickbeard.USE_PUSHALOT = use_pushalot + sickbeard.PUSHALOT_NOTIFY_ONSNATCH = pushalot_notify_onsnatch + sickbeard.PUSHALOT_NOTIFY_ONDOWNLOAD = pushalot_notify_ondownload + sickbeard.PUSHALOT_AUTHORIZATIONTOKEN = pushalot_authorizationtoken + sickbeard.save_config() if len(results) > 0: @@ -2243,6 +2264,16 @@ def testNMA(self, nma_api=None, nma_priority=0): else: return "Test NMA notice failed" + @cherrypy.expose + def testPushalot(self, authorizationToken=None): + cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store" + + result = notifiers.pushalot_notifier.test_notify(authorizationToken) + if result: + return "Pushalot notification succeeded. Check your Pushalot clients to make sure it worked" + else: + return "Error sending Pushalot notification" + @cherrypy.expose def shutdown(self, pid=None): From c8a62dc4944f89d826350faae101d9fd418d3c1d Mon Sep 17 00:00:00 2001 From: cytec Date: Mon, 2 Mar 2015 15:47:12 +0100 Subject: [PATCH 3/5] netfilxhd is web-dl --- sickbeard/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sickbeard/common.py b/sickbeard/common.py index 024f073d93..6473682fce 100644 --- a/sickbeard/common.py +++ b/sickbeard/common.py @@ -158,9 +158,9 @@ def nameQuality(name): return Quality.RAWHDTV elif checkName(["1080p", "hdtv", "(h|x)264"], all) or checkName(["videomann", "1080p"], all): return Quality.FULLHDTV - elif checkName(["720p", "web.?dl|webrip|webhd(rip)?"], all) or checkName(["720p", "(webhd|itunes)", "(h|x).?264"], all) or checkName(["720p", "(webhd|itunes)", "avc"], all): + elif checkName(["720p", "web.?dl|webrip|webhd(rip)?|netfilxhd"], all) or checkName(["720p", "(webhd|itunes)", "(h|x).?264"], all) or checkName(["720p", "(webhd|itunes)", "avc"], all): return Quality.HDWEBDL - elif checkName(["1080p", "web.?dl|webrip|webhd(rip)?"], all) or checkName(["1080p", "(webhd|itunes)", "(h|x).?264"], all): + elif checkName(["1080p", "web.?dl|webrip|webhd(rip)?|netfilxhd"], all) or checkName(["1080p", "(webhd|itunes)", "(h|x).?264"], all): return Quality.FULLHDWEBDL elif checkName(["720p", "bluray|hddvd|bd", "(h|x)264"], all): return Quality.HDBLURAY From 989a63c7260c945b2dc0cdcb5c8feae66098c1b2 Mon Sep 17 00:00:00 2001 From: cytec Date: Thu, 5 Mar 2015 12:57:45 +0100 Subject: [PATCH 4/5] fixed typo in netflixhd --- sickbeard/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sickbeard/common.py b/sickbeard/common.py index 6473682fce..a7e6631e68 100644 --- a/sickbeard/common.py +++ b/sickbeard/common.py @@ -158,9 +158,9 @@ def nameQuality(name): return Quality.RAWHDTV elif checkName(["1080p", "hdtv", "(h|x)264"], all) or checkName(["videomann", "1080p"], all): return Quality.FULLHDTV - elif checkName(["720p", "web.?dl|webrip|webhd(rip)?|netfilxhd"], all) or checkName(["720p", "(webhd|itunes)", "(h|x).?264"], all) or checkName(["720p", "(webhd|itunes)", "avc"], all): + elif checkName(["720p", "web.?dl|webrip|webhd(rip)?|netflixhd"], all) or checkName(["720p", "(webhd|itunes)", "(h|x).?264"], all) or checkName(["720p", "(webhd|itunes)", "avc"], all): return Quality.HDWEBDL - elif checkName(["1080p", "web.?dl|webrip|webhd(rip)?|netfilxhd"], all) or checkName(["1080p", "(webhd|itunes)", "(h|x).?264"], all): + elif checkName(["1080p", "web.?dl|webrip|webhd(rip)?|netflixhd"], all) or checkName(["1080p", "(webhd|itunes)", "(h|x).?264"], all): return Quality.FULLHDWEBDL elif checkName(["720p", "bluray|hddvd|bd", "(h|x)264"], all): return Quality.HDBLURAY From 61c42931210e37e08f2be260481823a4af743be5 Mon Sep 17 00:00:00 2001 From: cytec Date: Tue, 9 Aug 2016 20:17:06 +0200 Subject: [PATCH 5/5] amazonHD --- sickbeard/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sickbeard/common.py b/sickbeard/common.py index a7e6631e68..1ce5b7a201 100644 --- a/sickbeard/common.py +++ b/sickbeard/common.py @@ -158,9 +158,9 @@ def nameQuality(name): return Quality.RAWHDTV elif checkName(["1080p", "hdtv", "(h|x)264"], all) or checkName(["videomann", "1080p"], all): return Quality.FULLHDTV - elif checkName(["720p", "web.?dl|webrip|webhd(rip)?|netflixhd"], all) or checkName(["720p", "(webhd|itunes)", "(h|x).?264"], all) or checkName(["720p", "(webhd|itunes)", "avc"], all): + elif checkName(["720p", "web.?dl|webrip|webhd(rip)?|netflixhd|amazonhd"], all) or checkName(["720p", "(webhd|itunes)", "(h|x).?264"], all) or checkName(["720p", "(webhd|itunes)", "avc"], all): return Quality.HDWEBDL - elif checkName(["1080p", "web.?dl|webrip|webhd(rip)?|netflixhd"], all) or checkName(["1080p", "(webhd|itunes)", "(h|x).?264"], all): + elif checkName(["1080p", "web.?dl|webrip|webhd(rip)?|netflixhd|amazonhd"], all) or checkName(["1080p", "(webhd|itunes)", "(h|x).?264"], all): return Quality.FULLHDWEBDL elif checkName(["720p", "bluray|hddvd|bd", "(h|x)264"], all): return Quality.HDBLURAY