diff --git a/couchpotato/core/providers/nzb/moovee/__init__.py b/couchpotato/core/providers/nzb/moovee/__init__.py new file mode 100644 index 00000000..5a1c20a8 --- /dev/null +++ b/couchpotato/core/providers/nzb/moovee/__init__.py @@ -0,0 +1,21 @@ +from .main import Moovee + +def start(): + return Moovee() + +config = [{ + 'name': 'moovee', + 'groups': [ + { + 'tab': 'providers', + 'name': '#alt.binaries.moovee', + 'description': 'SD movies only', + 'options': [ + { + 'name': 'enabled', + 'type': 'enabler', + }, + ], + }, + ], +}] diff --git a/couchpotato/core/providers/nzb/moovee/main.py b/couchpotato/core/providers/nzb/moovee/main.py new file mode 100644 index 00000000..240607ee --- /dev/null +++ b/couchpotato/core/providers/nzb/moovee/main.py @@ -0,0 +1,71 @@ +from couchpotato.core.event import fireEvent +from couchpotato.core.helpers.rss import RSS +from couchpotato.core.logger import CPLog +from couchpotato.core.providers.nzb.base import NZBProvider +from dateutil.parser import parse +from urllib import quote_plus +import re +import time + +log = CPLog(__name__) + + +class Moovee(NZBProvider, RSS): + + urls = { + 'download': 'http://85.214.105.230/get_nzb.php?id=%s§ion=moovee', + 'search': 'http://abmoovee.allfilled.com/search.php?q=%s&Search=Search', + 'regex': '(?P.*?).+?(?P.*?)</td>.+?<td class="cell_statuschange">(?P<age>.*?)</td>', + } + + def search(self, movie, quality): + + results = [] + if self.isDisabled() or not self.isAvailable(self.urls['search']): + return results + + url = self.urls['search'] % quote_plus(movie['library']['titles'][0]['title'] + ' ' + quality.get('identifier')) + log.info('Searching: %s' % url) + + data = self.urlopen(url) + match = re.compile(self.urls['regex'], re.DOTALL).finditer(data) + + for nzb in match: + new = { + 'id': nzb.group('reqid'), + 'name': nzb.group('title'), + 'type': 'nzb', + 'provider': self.getName(), + 'age': self.calculateAge(time.mktime(parse(nzb.group('age')).timetuple())), + 'size': None, + 'url': self.urls['download'] % (nzb.group('reqid')), + 'download': self.download, + 'detail_url': '', + 'description': '', + 'check_nzb': False, + } + + new['score'] = fireEvent('score.calculate', new, movie, single = True) + is_correct_movie = fireEvent('searcher.correct_movie', + nzb = new, movie = movie, quality = quality, + imdb_results = False, single_category = False, single = True) + if is_correct_movie: + results.append(new) + self.found(new) + + return results + + def download(self, url = '', nzb_id = ''): + try: + log.info('Downloading nzb from #alt.binaries.moovee, request id: %s ' % nzb_id) + return self.urlopen(self.urls['download'] % nzb_id) + + except Exception, e: + log.error('Failed downloading from #alt.binaries.moovee: %s' % e) + return False + + def belongsTo(self, url, host = None): + match = re.match('http://85\.214\.105\.230/get_nzb\.php\?id=[0-9]*§ion=moovee', url) + if match: + return self + return diff --git a/couchpotato/core/providers/nzb/x264/__init__.py b/couchpotato/core/providers/nzb/x264/__init__.py index cf65b0a2..b48a1955 100644 --- a/couchpotato/core/providers/nzb/x264/__init__.py +++ b/couchpotato/core/providers/nzb/x264/__init__.py @@ -9,6 +9,7 @@ config = [{ { 'tab': 'providers', 'name': '#alt.binaries.hdtv.x264', + 'description': 'HD movies only', 'options': [ { 'name': 'enabled', diff --git a/couchpotato/core/providers/nzb/x264/main.py b/couchpotato/core/providers/nzb/x264/main.py index 878e6a3a..9d790f7a 100644 --- a/couchpotato/core/providers/nzb/x264/main.py +++ b/couchpotato/core/providers/nzb/x264/main.py @@ -1,8 +1,10 @@ from couchpotato.core.event import fireEvent from couchpotato.core.helpers.rss import RSS +from couchpotato.core.helpers.variable import tryInt from couchpotato.core.logger import CPLog from couchpotato.core.providers.nzb.base import NZBProvider from urllib import quote_plus +from dateutil.parser import parse import re import time @@ -14,7 +16,7 @@ class X264(NZBProvider, RSS): urls = { 'download': 'http://85.214.105.230/get_nzb.php?id=%s§ion=hd', 'search': 'http://85.214.105.230/x264/requests.php?release=%s&status=FILLED&age=700&sort=ID', - 'regex': '<tr class="req_filled"><td class="reqid">(?P<id>.*?)</td><td class="release">(?P<title>.*?)</td>', + 'regex': '<tr class="req_filled"><td class="reqid">(?P<id>.*?)</td><td class="release">(?P<title>.*?)</td>.+?<td class="age">(?P<age>\d+)d.+?</td>', } def search(self, movie, quality): @@ -30,13 +32,16 @@ class X264(NZBProvider, RSS): match = re.compile(self.urls['regex'], re.DOTALL).finditer(data) for nzb in match: + age = nzb.group('age') + if not age: + age = 1 new = { 'id': nzb.group('id'), 'name': nzb.group('title'), 'type': 'nzb', 'provider': self.getName(), - 'age': self.calculateAge(time.time()), - 'size': 9999, + 'age': tryInt(age), + 'size': None, 'url': self.urls['download'] % (nzb.group('id')), 'download': self.download, 'detail_url': '', @@ -57,8 +62,14 @@ class X264(NZBProvider, RSS): def download(self, url = '', nzb_id = ''): try: log.info('Downloading nzb from #alt.binaries.hdtv.x264, request id: %s ' % nzb_id) - return self.urlopen(self.urls['download'] % nzb_id) + except Exception, e: log.error('Failed downloading from #alt.binaries.hdtv.x264: %s' % e) return False + + def belongsTo(self, url, host = None): + match = re.match('http://85\.214\.105\.230/get_nzb\.php\?id=[0-9]*§ion=hd', url) + if match: + return self + return \ No newline at end of file