Fixed some of bwq merge
This commit is contained in:
@@ -19,10 +19,10 @@ class Downloader(Plugin):
|
||||
pass
|
||||
|
||||
def createFileName(self, data, file, movie):
|
||||
if "DOCTYPE nzb" not in file:
|
||||
if data.get('type') == 'nzb':
|
||||
return os.path.join('%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , 'rar'))
|
||||
return os.path.join('%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , data.get('type')))
|
||||
name = os.path.join('%s%s' % (toSafeString(data.get('name')), self.cpTag(movie)))
|
||||
if data.get('type') == 'nzb' and "DOCTYPE nzb" not in file:
|
||||
return '%s.%s' % (name, 'rar')
|
||||
return '%s.%s' % (name, data.get('type'))
|
||||
|
||||
def cpTag(self, movie):
|
||||
if Env.setting('enabled', 'renamer'):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from couchpotato.core.downloaders.base import Downloader
|
||||
from couchpotato.core.helpers.encoding import toSafeString
|
||||
from couchpotato.core.logger import CPLog
|
||||
import os
|
||||
import traceback
|
||||
|
||||
@@ -2,14 +2,9 @@ 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 imdb.parser.http.bsouplxml._bsoup import SoupStrainer, BeautifulSoup
|
||||
import urllib
|
||||
import urllib2
|
||||
from urllib import urlencode
|
||||
from urllib import quote_plus
|
||||
import time
|
||||
import re
|
||||
import time
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
@@ -31,41 +26,32 @@ class X264(NZBProvider, RSS):
|
||||
url = self.urls['search'] % quote_plus(movie['library']['titles'][0]['title'] + ' ' + quality.get('identifier'))
|
||||
log.info('Searching: %s' % url)
|
||||
|
||||
try:
|
||||
opener = urllib2.build_opener()
|
||||
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)
|
||||
data = self.urlopen(url)
|
||||
match = re.compile(self.urls['regex'], re.DOTALL).finditer(data)
|
||||
|
||||
for nzb in match:
|
||||
new = {
|
||||
'id': nzb.group('id'),
|
||||
'name': nzb.group('title'),
|
||||
'type': 'nzb',
|
||||
'provider': self.getName(),
|
||||
'age': self.calculateAge(time.time()),
|
||||
'size': 9999,
|
||||
'url': self.urls['download'] % (nzb.group('id')),
|
||||
'download': self.download,
|
||||
'detail_url': '',
|
||||
'description': '',
|
||||
'check_nzb': False,
|
||||
}
|
||||
new = {
|
||||
'id': nzb.group('id'),
|
||||
'name': nzb.group('title'),
|
||||
'type': 'nzb',
|
||||
'provider': self.getName(),
|
||||
'age': self.calculateAge(time.time()),
|
||||
'size': 9999,
|
||||
'url': self.urls['download'] % (nzb.group('id')),
|
||||
'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:
|
||||
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 = ''):
|
||||
@@ -76,14 +62,3 @@ class X264(NZBProvider, RSS):
|
||||
except Exception, e:
|
||||
log.error('Failed downloading from #alt.binaries.hdtv.x264: %s' % e)
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user