|
@ -2,14 +2,9 @@ from couchpotato.core.event import fireEvent |
|
|
from couchpotato.core.helpers.rss import RSS |
|
|
from couchpotato.core.helpers.rss import RSS |
|
|
from couchpotato.core.logger import CPLog |
|
|
from couchpotato.core.logger import CPLog |
|
|
from couchpotato.core.providers.nzb.base import NZBProvider |
|
|
from couchpotato.core.providers.nzb.base import NZBProvider |
|
|
from dateutil.parser import parse |
|
|
|
|
|
from imdb.parser.http.bsouplxml._bsoup import SoupStrainer, BeautifulSoup |
|
|
|
|
|
import urllib |
|
|
|
|
|
import urllib2 |
|
|
|
|
|
from urllib import urlencode |
|
|
|
|
|
from urllib import quote_plus |
|
|
from urllib import quote_plus |
|
|
import time |
|
|
|
|
|
import re |
|
|
import re |
|
|
|
|
|
import time |
|
|
|
|
|
|
|
|
log = CPLog(__name__) |
|
|
log = CPLog(__name__) |
|
|
|
|
|
|
|
@ -31,18 +26,8 @@ class X264(NZBProvider, RSS): |
|
|
url = self.urls['search'] % quote_plus(movie['library']['titles'][0]['title'] + ' ' + quality.get('identifier')) |
|
|
url = self.urls['search'] % quote_plus(movie['library']['titles'][0]['title'] + ' ' + quality.get('identifier')) |
|
|
log.info('Searching: %s' % url) |
|
|
log.info('Searching: %s' % url) |
|
|
|
|
|
|
|
|
try: |
|
|
data = self.urlopen(url) |
|
|
opener = urllib2.build_opener() |
|
|
match = re.compile(self.urls['regex'], re.DOTALL).finditer(data) |
|
|
urllib2.install_opener(opener) |
|
|
|
|
|
f = opener.open(url) |
|
|
|
|
|
data = f.read() |
|
|
|
|
|
f.close() |
|
|
|
|
|
|
|
|
|
|
|
except (IOError, URLError): |
|
|
|
|
|
log.error('Failed to open %s.' % url) |
|
|
|
|
|
return results |
|
|
|
|
|
|
|
|
|
|
|
match = re.compile(self.urls['regex'], re.DOTALL ).finditer(data) |
|
|
|
|
|
|
|
|
|
|
|
for nzb in match: |
|
|
for nzb in match: |
|
|
new = { |
|
|
new = { |
|
@ -66,6 +51,7 @@ class X264(NZBProvider, RSS): |
|
|
if is_correct_movie: |
|
|
if is_correct_movie: |
|
|
results.append(new) |
|
|
results.append(new) |
|
|
self.found(new) |
|
|
self.found(new) |
|
|
|
|
|
|
|
|
return results |
|
|
return results |
|
|
|
|
|
|
|
|
def download(self, url = '', nzb_id = ''): |
|
|
def download(self, url = '', nzb_id = ''): |
|
@ -76,14 +62,3 @@ class X264(NZBProvider, RSS): |
|
|
except Exception, e: |
|
|
except Exception, e: |
|
|
log.error('Failed downloading from #alt.binaries.hdtv.x264: %s' % e) |
|
|
log.error('Failed downloading from #alt.binaries.hdtv.x264: %s' % e) |
|
|
return False |
|
|
return False |
|
|
|
|
|
|
|
|
def getFormatId(self, format): |
|
|
|
|
|
for id, quality in self.format_ids.iteritems(): |
|
|
|
|
|
for q in quality: |
|
|
|
|
|
if q == format: |
|
|
|
|
|
return id |
|
|
|
|
|
|
|
|
|
|
|
return self.cat_backup_id |
|
|
|
|
|
|
|
|
|
|
|
def isEnabled(self): |
|
|
|
|
|
return NZBProvider.isEnabled(self) and self.conf('enabled') |
|
|
|
|
|