Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added provider for nzbX. #567

Merged
merged 2 commits into from

4 participants

@jrdnull

Provider for nzbX, discussed with thezoggy and Lemon in irc.

Let me know of any changes/improvements and I'll fix them.

This was referenced
@thezoggy

This is good to go.

@midgetspy
Owner

This code seems to work well but the provider itself is providing junk results. I won't be pulling it for now, hopefully we can figure out a way to exclude results like these:

[Desktop]-[1/1] - "europolis.2010.pdtv.x264-saftoiu.nfo.nzb"
[o4u] "Melissa & Joey.s01e01.Pilot.dTV.x264-o4u.vol07+08.PAR2"
Scary.Walls.(08-10-12).PDTV.XviD-acrwt

(and before somebody asks: no SB won't add parsing rules to parse the raw post names, that's the entire point of the indexer)

@LemonadeDev

I've found the issue, the API is returning spam flagged results to you (as seen by the spam: 1 attribute). I'll have these hidden in the next couple of minutes.

@LemonadeDev

Appears there was an issue with the "recent" code when using more than one category, I have now fixed this.

@thezoggy

ty lemon

@jrdnull

Have you had a chance to look at this again midgetspy?

@midgetspy midgetspy merged commit 82d204b into midgetspy:development
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2013
  1. @jrdnull

    Added provider for nzbX.

    jrdnull authored
Commits on Feb 21, 2013
  1. @jrdnull
This page is out of date. Refresh to see the latest.
View
BIN  data/images/providers/nzbx.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
15 sickbeard/__init__.py
@@ -30,7 +30,7 @@
# apparently py2exe won't build these unless they're imported somewhere
from sickbeard import providers, metadata
-from providers import ezrss, tvtorrents, btn, nzbsrus, newznab, womble
+from providers import ezrss, tvtorrents, btn, nzbsrus, newznab, womble, nzbx
from sickbeard.config import CheckSection, check_setting_int, check_setting_str, ConfigMigrator
from sickbeard import searchCurrent, searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser
@@ -177,6 +177,9 @@
WOMBLE = False
+NZBX = False
+NZBX_COMPLETION = 100
+
NZBSRUS = False
NZBSRUS_UID = None
NZBSRUS_HASH = None
@@ -329,7 +332,7 @@ def initialize(consoleLogging=True):
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, TVDB_API_PARMS, \
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, \
RENAME_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \
- NZBSRUS, NZBSRUS_UID, NZBSRUS_HASH, WOMBLE, providerList, newznabProviderList, \
+ NZBSRUS, NZBSRUS_UID, NZBSRUS_HASH, WOMBLE, NZBX, NZBX_COMPLETION, providerList, newznabProviderList, \
EXTRA_SCRIPTS, USE_TWITTER, TWITTER_USERNAME, TWITTER_PASSWORD, TWITTER_PREFIX, \
USE_NOTIFO, NOTIFO_USERNAME, NOTIFO_APISECRET, NOTIFO_NOTIFY_ONDOWNLOAD, NOTIFO_NOTIFY_ONSNATCH, \
USE_BOXCAR, BOXCAR_USERNAME, BOXCAR_PASSWORD, BOXCAR_NOTIFY_ONDOWNLOAD, BOXCAR_NOTIFY_ONSNATCH, \
@@ -557,6 +560,10 @@ def initialize(consoleLogging=True):
CheckSection(CFG, 'Womble')
WOMBLE = bool(check_setting_int(CFG, 'Womble', 'womble', 1))
+ CheckSection(CFG, 'nzbX')
+ NZBX = bool(check_setting_int(CFG, 'nzbX', 'nzbx', 0))
+ NZBX_COMPLETION = check_setting_int(CFG, 'nzbX', 'nzbx_completion', 100)
+
CheckSection(CFG, 'SABnzbd')
SAB_USERNAME = check_setting_str(CFG, 'SABnzbd', 'sab_username', '')
SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')
@@ -1030,6 +1037,10 @@ def save_config():
new_config['Womble'] = {}
new_config['Womble']['womble'] = int(WOMBLE)
+ new_config['nzbX'] = {}
+ new_config['nzbX']['nzbx'] = int(NZBX)
+ new_config['nzbX']['nzbx_completion'] = int(NZBX_COMPLETION)
+
new_config['SABnzbd'] = {}
new_config['SABnzbd']['sab_username'] = SAB_USERNAME
new_config['SABnzbd']['sab_password'] = SAB_PASSWORD
View
1  sickbeard/providers/__init__.py
@@ -21,6 +21,7 @@
'nzbsrus',
'womble',
'btn',
+ 'nzbx'
]
import sickbeard
View
125 sickbeard/providers/nzbx.py
@@ -0,0 +1,125 @@
+# Author: Jordon Smith <smith@jordon.me.uk>
+# 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 <http://www.gnu.org/licenses/>.
+
+import urllib
+import generic
+import sickbeard
+
+from sickbeard import tvcache
+from sickbeard import logger
+from sickbeard import classes
+from sickbeard import show_name_helpers
+from datetime import datetime
+
+try:
+ import json
+except ImportError:
+ from lib import simplejson as json
+
+
+class NzbXProvider(generic.NZBProvider):
+
+ def __init__(self):
+ generic.NZBProvider.__init__(self, "nzbX")
+ self.cache = NzbXCache(self)
+ self.url = 'https://nzbx.co/'
+ self.supportsBacklog = True
+
+ def isEnabled(self):
+ return sickbeard.NZBX
+
+ def _get_season_search_strings(self, show, season):
+ return [x + '*' for x in show_name_helpers.makeSceneSeasonSearchString(show, season)]
+
+ def _get_episode_search_strings(self, ep_obj):
+ return [x for x in show_name_helpers.makeSceneSearchString(ep_obj)]
+
+ def _get_title_and_url(self, item):
+ title = item['name']
+ url = self.url + 'nzb?' + str(item['guid']) + '*|*' + urllib.quote_plus(title)
+ return (title, url)
+
+ def _doSearch(self, search, show=None, age=0):
+ params = {'age': sickbeard.USENET_RETENTION,
+ 'completion': sickbeard.NZBX_COMPLETION,
+ 'cat': 'tv-hd|tv-sd',
+ 'limit': 250,
+ 'q': search}
+
+ if age or not params['age']:
+ params['age'] = age
+
+ if not params['completion']:
+ params['completion'] = 100
+
+ url = self.url + 'api/sickbeard?' + urllib.urlencode(params)
+ logger.log(u"nzbX search url: " + url, logger.DEBUG)
+
+ data = self.getURL(url)
+ try:
+ items = json.loads(data)
+ except ValueError:
+ logger.log(u"Error trying to decode nzbX json data", logger.ERROR)
+ return[]
+
+ results = []
+ for item in items:
+ if item['name'] and item['guid']:
+ results.append(item)
+ else:
+ logger.log(u"Partial result from nzbx", logger.DEBUG)
+ return results
+
+ def findPropers(self, date=None):
+ results = []
+ for item in self._doSearch('.proper.|.repack.', age=4):
+ if item['postdate']:
+ name, url = self._get_title_and_url(item)
+ results.append(classes.Proper(name, url, datetime.fromtimestamp(item['postdate'])))
+ return results
+
+
+class NzbXCache(tvcache.TVCache):
+
+ def __init__(self, provider):
+ tvcache.TVCache.__init__(self, provider)
+ self.minTime = 20
+
+ def _parseItem(self, item):
+ title, url = self.provider._get_title_and_url(item)
+ logger.log(u"Adding item from RSS to cache: " + title, logger.DEBUG)
+ self._addCacheEntry(title, url)
+
+ def updateCache(self):
+ if not self.shouldUpdate():
+ return
+
+ items = self.provider._doSearch('')
+ if not items:
+ return
+ self.setLastUpdate()
+
+ # now that we've got the latest releases lets delete the old cache
+ logger.log(u"Clearing nzbX cache and updating with new information")
+ self._clearCache()
+
+ for item in items:
+ self._parseItem(item)
+
+provider = NzbXProvider()
+
View
2  sickbeard/webserve.py
@@ -1091,6 +1091,8 @@ def saveProviders(self, nzbmatrix_username=None, nzbmatrix_apikey=None,
sickbeard.BINREQ = curEnabled
elif curProvider == 'womble_s_index':
sickbeard.WOMBLE = curEnabled
+ elif curProvider == 'nzbx':
+ sickbeard.NZBX = curEnabled
elif curProvider == 'ezrss':
sickbeard.EZRSS = curEnabled
elif curProvider == 'tvtorrents':
Something went wrong with that request. Please try again.