From 0dce254473a2cc6334be1d368e603bf8d743fd8d Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Mon, 21 May 2018 16:10:52 +0100 Subject: [PATCH 1/2] Fix importing TV shows with utf8 characters in parent folders on Windows. Fix import; add unicode encoding for str values of args and kwargs to ek.ek on Windows. Fix incorrect logic mixing seasons (All wanted episode numbers are checked against all season, not just the season belonging to the episode number). --- sickbeard/encodingKludge.py | 13 +++++++++++++ sickbeard/search.py | 19 ++++++++----------- sickbeard/webserve.py | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/sickbeard/encodingKludge.py b/sickbeard/encodingKludge.py index e9ec28b7..f68478b2 100644 --- a/sickbeard/encodingKludge.py +++ b/sickbeard/encodingKludge.py @@ -66,8 +66,21 @@ def fixParaLists(x): return x +def win_encode_unicode(x): + if isinstance(x, str): + try: + return x.decode('UTF-8') + except UnicodeDecodeError: + return x + return x + + def ek(func, *args, **kwargs): if os.name == 'nt': + # convert all str parameter values to unicode + args = tuple([win_encode_unicode(x) if isinstance(x, str) else x for x in args]) + kwargs = {k: win_encode_unicode(x) if isinstance(x, str) else x for k, x in + kwargs.iteritems()} result = func(*args, **kwargs) else: result = func(*[callPeopleStupid(x) if type(x) in (str, unicode) else fixParaLists(x) for x in args], **kwargs) diff --git a/sickbeard/search.py b/sickbeard/search.py index 67e166f4..19c11709 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -597,9 +597,9 @@ def search_providers(show, episodes, manual_search=False, torrent_only=False, tr best_season_result.provider.providerType), logger.DEBUG) my_db = db.DBConnection() - sql = 'SELECT episode FROM tv_episodes WHERE showid = %s AND (season IN (%s))' %\ + sql = 'SELECT season, episode FROM tv_episodes WHERE showid = %s AND (season IN (%s))' %\ (show.indexerid, ','.join([str(x.season) for x in episodes])) - ep_nums = [int(x['episode']) for x in my_db.select(sql)] + ep_nums = [(int(x['season']), int(x['episode'])) for x in my_db.select(sql)] logger.log(u'Executed query: [%s]' % sql) logger.log(u'Episode list: %s' % ep_nums, logger.DEBUG) @@ -607,11 +607,10 @@ def search_providers(show, episodes, manual_search=False, torrent_only=False, tr all_wanted = True any_wanted = False for ep_num in ep_nums: - for season in set([x.season for x in episodes]): - if not show.wantEpisode(season, ep_num, season_qual): - all_wanted = False - else: - any_wanted = True + if not show.wantEpisode(ep_num[0], ep_num[1], season_qual): + all_wanted = False + else: + any_wanted = True # if we need every ep in the season and there's nothing better then just download this and # be done with it (unless single episodes are preferred) @@ -620,8 +619,7 @@ def search_providers(show, episodes, manual_search=False, torrent_only=False, tr (best_season_result.provider.providerType, best_season_result.name)) ep_objs = [] for ep_num in ep_nums: - for season in set([x.season for x in episodes]): - ep_objs.append(show.getEpisode(season, ep_num)) + ep_objs.append(show.getEpisode(ep_num[0], ep_num[1])) best_season_result.episodes = ep_objs return [best_season_result] @@ -660,8 +658,7 @@ def search_providers(show, episodes, manual_search=False, torrent_only=False, tr u'the episodes that you do not want to "don\'t download"') ep_objs = [] for ep_num in ep_nums: - for season in set([x.season for x in episodes]): - ep_objs.append(show.getEpisode(season, ep_num)) + ep_objs.append(show.getEpisode(ep_num[0], ep_num[1])) best_season_result.episodes = ep_objs ep_num = MULTI_EP_RESULT diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index a00255cb..0a0f19f1 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -3298,7 +3298,7 @@ class NewHomeAddShows(Home): if not file_list: try: file_list = ek.ek(os.listdir, root_dir) - except: + except (StandardError, Exception): continue for cur_file in file_list: From a9500e01d504b239c07b2a8e71d9408df08332d3 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Mon, 21 May 2018 23:29:13 +0100 Subject: [PATCH 2/2] Fix utf8 in folders for SickGear-NG.py post processing script, script version bumped 1.5 to 1.6. Remove NMA notifier. --- CHANGES.md | 10 +- HACKS.txt | 1 - autoProcessTV/SickGear-NG/SickGear-NG.py | 17 +- gui/slick/images/notifiers/nma.png | Bin 1739 -> 0 bytes .../default/config_notifications.tmpl | 79 --------- gui/slick/js/configNotifications.js | 19 --- lib/pynma/__init__.py | 5 - lib/pynma/pynma.py | 151 ------------------ sickbeard/__init__.py | 25 +-- sickbeard/encodingKludge.py | 6 +- sickbeard/notifiers/__init__.py | 2 - sickbeard/notifiers/nma.py | 38 ----- sickbeard/webserve.py | 19 --- 13 files changed, 28 insertions(+), 344 deletions(-) delete mode 100644 gui/slick/images/notifiers/nma.png delete mode 100644 lib/pynma/__init__.py delete mode 100644 lib/pynma/pynma.py delete mode 100644 sickbeard/notifiers/nma.py diff --git a/CHANGES.md b/CHANGES.md index 6c7dcd47..6fb12400 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,12 @@ -### 0.16.9 (2018-05-17 15:30:00 UTC) +### 0.16.10 (2018-05-21 23:30:00 UTC) + +* Fix importing TV shows with utf8 characters in parent folders on Windows +* Fix utf8 in folders for SickGear-NG.py post processing script, script version bumped 1.5 to 1.6 +* Fix incorrect logic mixing seasons +* Remove NMA notifier + + +### 0.16.9 (2018-05-17 15:30:00 UTC) * Fix authorisation issue affecting some providers diff --git a/HACKS.txt b/HACKS.txt index e1911c23..c8727b41 100644 --- a/HACKS.txt +++ b/HACKS.txt @@ -10,7 +10,6 @@ Libs with customisations... /lib/hachoir_parser/guess.py /lib/hachoir_parser/misc/torrent.py /lib/lockfile/mkdirlockfile.py -/lib/pynma/pynma.py /lib/tmdb_api/tmdb_api.py /lib/tornado /lib/tvdb_api/tvdb_api.py diff --git a/autoProcessTV/SickGear-NG/SickGear-NG.py b/autoProcessTV/SickGear-NG/SickGear-NG.py index d18d2330..4597f011 100755 --- a/autoProcessTV/SickGear-NG/SickGear-NG.py +++ b/autoProcessTV/SickGear-NG/SickGear-NG.py @@ -63,7 +63,7 @@ # Send PostProcessing requests to SickGear # -# PostProcessing-Script version: 1.5. +# PostProcessing-Script version: 1.6. # @@ -157,7 +157,7 @@ import re import sys import warnings -__version__ = '1.5' +__version__ = '1.6' verbose = 0 or 'yes' == os.environ.get('NZBPO_SG_VERBOSE', 'no') @@ -294,9 +294,22 @@ class Ek: except UnicodeEncodeError: return x.encode(SYS_ENCODING, 'ignore') + @staticmethod + def win_encode_unicode(x): + if isinstance(x, str): + try: + return x.decode('UTF-8') + except UnicodeDecodeError: + return x + return x + @staticmethod def ek(func, *args, **kwargs): if 'nt' == os.name: + # convert all str parameter values to unicode + args = tuple([x if not isinstance(x, str) else win_encode_unicode(x) for x in args]) + kwargs = {k: x if not isinstance(x, str) else win_encode_unicode(x) for k, x in + kwargs.iteritems()} func_result = func(*args, **kwargs) else: func_result = func(*[Ek.encode_item(x) if type(x) == str else x for x in args], **kwargs) diff --git a/gui/slick/images/notifiers/nma.png b/gui/slick/images/notifiers/nma.png deleted file mode 100644 index 15dfa7f4a362418bd5a240a051d8c25a6fa8bd1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1739 zcmV;+1~mDJP)kb zNAisWe-3Yd?{HP~Xx^6_5}z&y33}3_l^YWCoicF%=xTg z2BS{Do}Z3He55?u=pdIAJ+D4l{b*{Gp}M(*%oPq_$wl*g3-L||;kpVrnX3%r!yIG7 z0xk(hW?6XmHGzCOy5qiQru3>Bx2HH+F(Nzxf5`Q)U%&6U;G@X|c~j%m@jwNtVn86EB5_K?8@&SWza@f7fSMK)OkucxyTljQ>p1hag`JxPMh7+6l9eq8)j`J+iRIg}cx0D~{l5y} z?=LF|)=8Y)%h9&j_v>3%Sc@k{nN;q7tO-+B*&_#jsjRZeWG?Mu`C~d(Y%tKX)kg1D zmAv(1**X==)(hNxk3h86hcgEi{9!wT35n!{gR^fiaGyg^vBuBb>6|5qhD0a^ zF?fKjxiTVA*Xn``j)4ObC-zI6?+@bPULWq+Xkl!$fW&DBj99yC3&-m3`?2Sze*EQU z#Krq1m_%$a#-Wgb#2JQ>Q&_*?ZtND)Kv&|7TqLCfNe~D>FmjUPN7LC4pJ9r=}@3(l*;N=gq-3f@@X_)GfDcXrqvJN7>eH}l1IO=Pn4&5N9(pzm5#-qU zw2Sr@hdlRWKh|lOi!2qKS=6cpC53B~Tb54%KEmuGlPNNdRa_EAk2~?QmYKrwz5+0s1XR;K3scO zewe&!V9{;0c;dx6)VH#7u{lI?^qB~TPgr>B8%2y=%p%@GWINLa3erN$O~J8njX2G@ z!Y*{)roKa6hC-F(jjVWnrGN$95&Ys{8{U5XL-g-YBb}sb&PnWfDTzyoEMDyIK;0}q zCQ^m6oVSZPLV}>}yj?qN=}7TR(nj}JLa(%bN?>B51h3diMYEia-`d`Y+8PJZSP1df zAcB;pT7YAAX9zx_VO~3@B5OcNw+MGHI*G|_37=k~qU+A8zD!brmk6)=7IoM1EwLdN zIw>bFiI4iYr_8~?i9Fio6KS@EOBW0z&KZQQM02N$Q$u+~YN@kQYcUP#0$J0e7%LyH z{j2Kdhb_~s%mbk^)HVA)|KqhEym|cfB>es$5zA{-Fii)BS;UHs zt@*7zvv0X{ULWxqX}MjSB?rZ<^VYWB_6L7(pV2pbDnr$(Qf0W6`T2>fGUYrD?^w}* zP0zJFFfnG1xOT;OIWLK5OkTC1DD34Q{b}BYFRX4Le=6a6qCOv+aaW96W#y|LYED1i zH}`Ag=)Qc$zCLiSPc+UMybCSJ2k%}}f3UGF(4M+%cBIF3BF~v|dj=LRjbigp=KS&N z-)>qvnY4~&(-MkcGtcD8baROlj(EG~8C>~p|J0hHV^hmU2J@|6l#CpyZ&uN9OK4=_ z9g#!xKNo$KxH>eR(94$ diff --git a/gui/slick/interfaces/default/config_notifications.tmpl b/gui/slick/interfaces/default/config_notifications.tmpl index cc21718a..3e31b01f 100644 --- a/gui/slick/interfaces/default/config_notifications.tmpl +++ b/gui/slick/interfaces/default/config_notifications.tmpl @@ -852,7 +852,6 @@ - @@ -1379,84 +1378,6 @@ -
-
- -

Notify My Android

-

Notify My Android is a Prowl-like Android app and API that sends notifications from applications directly to Android devices.

-
-
-
- -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
Click below to test
- - -
- -
-
- -
diff --git a/gui/slick/js/configNotifications.js b/gui/slick/js/configNotifications.js index 9795fa7f..ae423a26 100644 --- a/gui/slick/js/configNotifications.js +++ b/gui/slick/js/configNotifications.js @@ -409,25 +409,6 @@ $(document).ready(function(){ }); }); - $('#test-nma').click(function () { - var nmaApi = $.trim($('#nma-api').val()); - var nmaPriority = $('#nma-priority').val(); - if (!nmaApi) { - $('#test-nma-result').html('Please fill out the necessary fields above.'); - $('#nma-api').addClass('warning'); - return; - } - $('#nma-api').removeClass('warning'); - $(this).prop('disabled', !0); - $('#test-nma-result').html(loading); - $.get(sbRoot + '/home/test_nma', - {nma_api: nmaApi, nma_priority: nmaPriority}) - .done(function (data) { - $('#test-nma-result').html(data); - $('#test-nma').prop('disabled', !1); - }); - }); - $('#test-pushalot').click(function () { var pushalotAuthorizationtoken = $.trim($('#pushalot-authorizationtoken').val()); if (!pushalotAuthorizationtoken) { diff --git a/lib/pynma/__init__.py b/lib/pynma/__init__.py deleted file mode 100644 index f884b504..00000000 --- a/lib/pynma/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/python - -__version__ = '1.01' - -from .pynma import PyNMA diff --git a/lib/pynma/pynma.py b/lib/pynma/pynma.py deleted file mode 100644 index e735eddd..00000000 --- a/lib/pynma/pynma.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/python - -from . import __version__ -from xml.dom.minidom import parseString - -import requests - - -class PyNMA(object): - """ - http://www.notifymyandroid.com/api.jsp - PyNMA(apikey=None, developerkey=None) - takes 2 optional arguments: - - (opt) apykey: a string containing 1 key or an array of keys - - (opt) developerkey: where you can store your developer key - """ - - def __init__(self, apikey=None, developerkey=None): - - self._developerkey = None - self.developerkey(developerkey) - - self.api_server = 'https://www.notifymyandroid.com' - self.add_path = '/publicapi/notify' - self.user_agent = 'PyNMA/v%s' % __version__ - - key = [] - if apikey: - key = (apikey, [apikey])[str == type(apikey)] - - self._apikey = self.uniq(key) - - @staticmethod - def uniq(seq): - # Not order preserving - return list({}.fromkeys(seq).keys()) - - def addkey(self, key): - """ - Add a key (register ?) - """ - if str == type(key): - if key not in self._apikey: - self._apikey.append(key) - - elif list == type(key): - for k in key: - if k not in self._apikey: - self._apikey.append(k) - - def delkey(self, key): - """ - Removes a key (unregister ?) - """ - if str == type(key): - if key in self._apikey: - self._apikey.remove(key) - - elif list == type(key): - for k in key: - if key in self._apikey: - self._apikey.remove(k) - - def developerkey(self, developerkey): - """ - Sets the developer key (and check it has the good length) - """ - if str == type(developerkey) and 48 == len(developerkey): - self._developerkey = developerkey - - def push(self, application='', event='', description='', url='', content_type=None, priority=0, batch_mode=False, html=False): - """ - Pushes a message on the registered API keys. - takes 5 arguments: - - (req) application: application name [256] - - (req) event: event name [1000] - - (req) description: description [10000] - - (opt) url: url [512] - - (opt) contenttype: Content Type (act: None (plain text) or text/html) - - (opt) priority: from -2 (lowest) to 2 (highest) (def:0) - - (opt) batch_mode: call API 5 by 5 (def:False) - - (opt) html: shortcut for content_type=text/html - - Warning: using batch_mode will return error only if all API keys are bad - http://www.notifymyandroid.com/api.jsp - """ - datas = {'application': application[:256].encode('utf8'), - 'event': event[:1000].encode('utf8'), - 'description': description[:10000].encode('utf8'), - 'priority': priority} - - if url: - datas['url'] = url[:2000] - - if self._developerkey: - datas['developerkey'] = self._developerkey - - if 'text/html' == content_type or True == html: # Currently only accepted content type - datas['content-type'] = 'text/html' - - results = {} - - if not batch_mode: - for key in self._apikey: - datas['apikey'] = key - res = self.callapi('POST', self.add_path, datas) - results[key] = res - else: - datas['apikey'] = ','.join(self._apikey) - res = self.callapi('POST', self.add_path, datas) - results[datas['apikey']] = res - - return results - - def callapi(self, method, path, args): - headers = {'User-Agent': self.user_agent} - - if 'POST' == method: - headers['Content-type'] = 'application/x-www-form-urlencoded' - - try: - resp = requests.post('%s:443%s' % (self.api_server, path), data=args, headers=headers).text - res = self._parse_response(resp) - except Exception as e: - res = {'type': 'pynmaerror', - 'code': 600, - 'message': str(e)} - pass - - return res - - @staticmethod - def _parse_response(response): - - root = parseString(response).firstChild - - for elem in root.childNodes: - if elem.TEXT_NODE == elem.nodeType: - continue - - if 'success' == elem.tagName: - res = dict(list(elem.attributes.items())) - res['message'] = '' - res['type'] = elem.tagName - return res - - if 'error' == elem.tagName: - res = dict(list(elem.attributes.items())) - res['message'] = elem.firstChild.nodeValue - res['type'] = elem.tagName - return res diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 179fe3d0..f1bd7354 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -391,13 +391,6 @@ PROWL_NOTIFY_ONSUBTITLEDOWNLOAD = False PROWL_API = None PROWL_PRIORITY = '0' -USE_NMA = False -NMA_NOTIFY_ONSNATCH = False -NMA_NOTIFY_ONDOWNLOAD = False -NMA_NOTIFY_ONSUBTITLEDOWNLOAD = False -NMA_API = None -NMA_PRIORITY = '0' - USE_LIBNOTIFY = False LIBNOTIFY_NOTIFY_ONSNATCH = False LIBNOTIFY_NOTIFY_ONDOWNLOAD = False @@ -671,7 +664,6 @@ def initialize(console_logging=True): PUSHOVER_USERKEY, PUSHOVER_APIKEY, PUSHOVER_PRIORITY, PUSHOVER_DEVICE, PUSHOVER_SOUND, \ USE_BOXCAR2, BOXCAR2_NOTIFY_ONSNATCH, BOXCAR2_NOTIFY_ONDOWNLOAD, BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD, \ BOXCAR2_ACCESSTOKEN, BOXCAR2_SOUND, \ - USE_NMA, NMA_NOTIFY_ONSNATCH, NMA_NOTIFY_ONDOWNLOAD, NMA_NOTIFY_ONSUBTITLEDOWNLOAD, NMA_API, NMA_PRIORITY, \ USE_PUSHALOT, PUSHALOT_NOTIFY_ONSNATCH, PUSHALOT_NOTIFY_ONDOWNLOAD, \ PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHALOT_AUTHORIZATIONTOKEN, \ USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, \ @@ -700,7 +692,7 @@ def initialize(console_logging=True): for stanza in ('General', 'Blackhole', 'SABnzbd', 'NZBget', 'Emby', 'Kodi', 'XBMC', 'PLEX', 'Growl', 'Prowl', 'Twitter', 'Slack', 'Discordapp', 'Boxcar2', 'NMJ', 'NMJv2', 'Synology', 'SynologyNotifier', - 'pyTivo', 'NMA', 'Pushalot', 'Pushbullet', 'Subtitles'): + 'pyTivo', 'Pushalot', 'Pushbullet', 'Subtitles'): check_section(CFG, stanza) update_config = False @@ -1087,13 +1079,6 @@ def initialize(console_logging=True): PYTIVO_SHARE_NAME = check_setting_str(CFG, 'pyTivo', 'pytivo_share_name', '') PYTIVO_TIVO_NAME = check_setting_str(CFG, 'pyTivo', 'pytivo_tivo_name', '') - USE_NMA = bool(check_setting_int(CFG, 'NMA', 'use_nma', 0)) - NMA_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'NMA', 'nma_notify_onsnatch', 0)) - NMA_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'NMA', 'nma_notify_ondownload', 0)) - NMA_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'NMA', 'nma_notify_onsubtitledownload', 0)) - NMA_API = check_setting_str(CFG, 'NMA', 'nma_api', '') - NMA_PRIORITY = check_setting_str(CFG, 'NMA', 'nma_priority', '0') - 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)) @@ -1905,14 +1890,6 @@ def save_config(): new_config['Prowl']['prowl_api'] = PROWL_API new_config['Prowl']['prowl_priority'] = PROWL_PRIORITY - new_config['NMA'] = {} - new_config['NMA']['use_nma'] = int(USE_NMA) - new_config['NMA']['nma_notify_onsnatch'] = int(NMA_NOTIFY_ONSNATCH) - new_config['NMA']['nma_notify_ondownload'] = int(NMA_NOTIFY_ONDOWNLOAD) - new_config['NMA']['nma_notify_onsubtitledownload'] = int(NMA_NOTIFY_ONSUBTITLEDOWNLOAD) - new_config['NMA']['nma_api'] = NMA_API - new_config['NMA']['nma_priority'] = NMA_PRIORITY - new_config['Libnotify'] = {} new_config['Libnotify']['use_libnotify'] = int(USE_LIBNOTIFY) new_config['Libnotify']['libnotify_notify_onsnatch'] = int(LIBNOTIFY_NOTIFY_ONSNATCH) diff --git a/sickbeard/encodingKludge.py b/sickbeard/encodingKludge.py index f68478b2..67067b20 100644 --- a/sickbeard/encodingKludge.py +++ b/sickbeard/encodingKludge.py @@ -25,6 +25,7 @@ import sickbeard # encodings. It tries to just use unicode, but if that fails then it tries forcing it to utf-8. Any functions # which return something should always return unicode. + def fixStupidEncodings(x, silent=False): if type(x) == str: try: @@ -41,7 +42,6 @@ def fixStupidEncodings(x, silent=False): return None - def fixListEncodings(x): if type(x) != list and type(x) != tuple: return x @@ -78,8 +78,8 @@ def win_encode_unicode(x): def ek(func, *args, **kwargs): if os.name == 'nt': # convert all str parameter values to unicode - args = tuple([win_encode_unicode(x) if isinstance(x, str) else x for x in args]) - kwargs = {k: win_encode_unicode(x) if isinstance(x, str) else x for k, x in + args = tuple([x if not isinstance(x, str) else win_encode_unicode(x) for x in args]) + kwargs = {k: x if not isinstance(x, str) else win_encode_unicode(x) for k, x in kwargs.iteritems()} result = func(*args, **kwargs) else: diff --git a/sickbeard/notifiers/__init__.py b/sickbeard/notifiers/__init__.py index 1ff173c1..4c9c7e08 100644 --- a/sickbeard/notifiers/__init__.py +++ b/sickbeard/notifiers/__init__.py @@ -32,7 +32,6 @@ import pushbullet import pushover import growl import prowl -import nma from . import libnotify from lib import libtrakt @@ -68,7 +67,6 @@ class NotifierFactory(object): PUSHOVER=pushover.PushoverNotifier, GROWL=growl.GrowlNotifier, PROWL=prowl.ProwlNotifier, - NMA=nma.NMANotifier, LIBNOTIFY=libnotify.LibnotifyNotifier, # social diff --git a/sickbeard/notifiers/nma.py b/sickbeard/notifiers/nma.py deleted file mode 100644 index 3ed63278..00000000 --- a/sickbeard/notifiers/nma.py +++ /dev/null @@ -1,38 +0,0 @@ -import sickbeard -from sickbeard.notifiers.generic import Notifier - -from lib.pynma import pynma - - -class NMANotifier(Notifier): - - def _notify(self, title, body, nma_api=None, nma_priority=None, **kwargs): - - nma_api = self._choose(nma_api, sickbeard.NMA_API) - nma_priority = self._choose(nma_priority, sickbeard.NMA_PRIORITY) - - batch = False - - p = pynma.PyNMA() - keys = nma_api.split(',') - p.addkey(keys) - - if 1 < len(keys): - batch = True - - self._log_debug('Sending notice with priority=%s, batch=%s' % (nma_priority, batch)) - response = p.push('SickGear', title, body, priority=nma_priority, batch_mode=batch) - - result = False - try: - if u'200' != response[nma_api][u'code']: - self._log_error('Notification failed') - else: - result = True - except (StandardError, Exception): - pass - - return result - - -notifier = NMANotifier diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 0a0f19f1..948a5b6f 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -1450,14 +1450,6 @@ class Home(MainHandler): return notifiers.NotifierFactory().get('PROWL').test_notify(prowl_api, prowl_priority) - def test_nma(self, nma_api=None, nma_priority=0): - self.set_header('Cache-Control', 'max-age=0,no-cache,no-store') - - if None is not nma_api and starify(nma_api, True): - nma_api = sickbeard.NMA_API - - return notifiers.NotifierFactory().get('NMA').test_notify(nma_api, nma_priority) - def test_libnotify(self, *args, **kwargs): self.set_header('Cache-Control', 'max-age=0,no-cache,no-store') @@ -6587,8 +6579,6 @@ class ConfigNotifications(Config): growl_notify_onsubtitledownload=None, growl_host=None, growl_password=None, use_prowl=None, prowl_notify_onsnatch=None, prowl_notify_ondownload=None, prowl_notify_onsubtitledownload=None, prowl_api=None, prowl_priority=0, - use_nma=None, nma_notify_onsnatch=None, nma_notify_ondownload=None, - nma_notify_onsubtitledownload=None, nma_api=None, nma_priority=0, use_libnotify=None, libnotify_notify_onsnatch=None, libnotify_notify_ondownload=None, libnotify_notify_onsubtitledownload=None, # use_pushalot=None, pushalot_notify_onsnatch=None, pushalot_notify_ondownload=None, @@ -6802,15 +6792,6 @@ class ConfigNotifications(Config): sickbeard.PYTIVO_SHARE_NAME = pytivo_share_name sickbeard.PYTIVO_TIVO_NAME = pytivo_tivo_name - sickbeard.USE_NMA = config.checkbox_to_value(use_nma) - sickbeard.NMA_NOTIFY_ONSNATCH = config.checkbox_to_value(nma_notify_onsnatch) - sickbeard.NMA_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(nma_notify_ondownload) - sickbeard.NMA_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(nma_notify_onsubtitledownload) - key = nma_api.strip() - if not starify(key, True): - sickbeard.NMA_API = key - sickbeard.NMA_PRIORITY = nma_priority - # sickbeard.USE_PUSHALOT = config.checkbox_to_value(use_pushalot) # sickbeard.PUSHALOT_NOTIFY_ONSNATCH = config.checkbox_to_value(pushalot_notify_onsnatch) # sickbeard.PUSHALOT_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(pushalot_notify_ondownload)