Merge branch 'develop' of github.com:RuudBurger/CouchPotatoServer into develop

This commit is contained in:
Ruud
2012-08-09 21:36:32 +02:00
2 changed files with 9 additions and 37 deletions
@@ -3,8 +3,6 @@ from couchpotato.core.event import fireEvent
from couchpotato.core.helpers.variable import tryInt from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.providers.torrent.base import TorrentProvider from couchpotato.core.providers.torrent.base import TorrentProvider
import StringIO
import gzip
import re import re
import traceback import traceback
@@ -14,10 +12,9 @@ log = CPLog(__name__)
class KickAssTorrents(TorrentProvider): class KickAssTorrents(TorrentProvider):
urls = { urls = {
'test': 'http://www.kat.ph/', 'test': 'http://kat.ph/',
'detail': 'http://www.kat.ph/%s-t%s.html', 'detail': 'http://kat.ph/%s-t%s.html',
'search': 'http://www.kat.ph/i%s/', 'search': 'http://kat.ph/i%s/',
'download': 'http://torcache.net/',
} }
cat_ids = [ cat_ids = [
@@ -60,11 +57,10 @@ class KickAssTorrents(TorrentProvider):
continue continue
new = { new = {
'type': 'torrent', 'type': 'torrent_magnet',
'check_nzb': False, 'check_nzb': False,
'description': '', 'description': '',
'provider': self.getName(), 'provider': self.getName(),
'download': self.download,
'score': 0, 'score': 0,
} }
@@ -77,9 +73,7 @@ class KickAssTorrents(TorrentProvider):
link = td.find('div', {'class': 'torrentname'}).find_all('a')[1] link = td.find('div', {'class': 'torrentname'}).find_all('a')[1]
new['id'] = temp.get('id')[-8:] new['id'] = temp.get('id')[-8:]
new['name'] = link.text new['name'] = link.text
new['url'] = td.find_all('a', 'idownload')[1]['href'] new['url'] = td.find('a', 'imagnet')['href']
if new['url'][:2] == '//':
new['url'] = 'http:%s' % new['url']
new['score'] = 20 if td.find('a', 'iverif') else 0 new['score'] = 20 if td.find('a', 'iverif') else 0
elif column_name is 'size': elif column_name is 'size':
new['size'] = self.parseSize(td.text) new['size'] = self.parseSize(td.text)
@@ -129,13 +123,3 @@ class KickAssTorrents(TorrentProvider):
age += tryInt(nr) * mult age += tryInt(nr) * mult
return tryInt(age) return tryInt(age)
def download(self, url = '', nzb_id = ''):
compressed_data = self.urlopen(url = url, headers = {'Referer': 'http://kat.ph/'})
compressedstream = StringIO.StringIO(compressed_data)
gzipper = gzip.GzipFile(fileobj = compressedstream)
data = gzipper.read()
return data
@@ -15,19 +15,9 @@ class PublicHD(TorrentProvider):
urls = { urls = {
'test': 'http://publichd.eu', 'test': 'http://publichd.eu',
'download': 'http://publichd.eu/%s',
'detail': 'http://publichd.eu/index.php?page=torrent-details&id=%s', 'detail': 'http://publichd.eu/index.php?page=torrent-details&id=%s',
'search': 'http://publichd.eu/index.php', 'search': 'http://publichd.eu/index.php',
} }
cat_ids = [
([9], ['bd50']),
([5], ['1080p']),
([2], ['720p']),
([15, 16], ['brrip']),
]
cat_backup_id = 0
http_time_between_calls = 0 http_time_between_calls = 0
def search(self, movie, quality): def search(self, movie, quality):
@@ -39,9 +29,8 @@ class PublicHD(TorrentProvider):
params = tryUrlencode({ params = tryUrlencode({
'page':'torrents', 'page':'torrents',
'search': getTitle(movie['library']) + ' ' + quality['identifier'], 'search': '%s %s' % (getTitle(movie['library']), movie['library']['year']),
'active': 1, 'active': 1,
'category': self.getCatId(quality['identifier'])[0]
}) })
url = '%s?%s' % (self.urls['search'], params) url = '%s?%s' % (self.urls['search'], params)
@@ -58,7 +47,7 @@ class PublicHD(TorrentProvider):
for result in entries[2:len(entries) - 1]: for result in entries[2:len(entries) - 1]:
info_url = result.find(href = re.compile('torrent-details')) info_url = result.find(href = re.compile('torrent-details'))
download = result.find(href = re.compile('\.torrent')) download = result.find(href = re.compile('magnet:'))
if info_url and download: if info_url and download:
@@ -67,12 +56,11 @@ class PublicHD(TorrentProvider):
new = { new = {
'id': url['id'][0], 'id': url['id'][0],
'name': info_url.string, 'name': info_url.string,
'type': 'torrent', 'type': 'torrent_magnet',
'check_nzb': False, 'check_nzb': False,
'description': '', 'description': '',
'provider': self.getName(), 'provider': self.getName(),
'download': self.download, 'url': download['href'],
'url': self.urls['download'] % download['href'],
'detail_url': self.urls['detail'] % url['id'][0], 'detail_url': self.urls['detail'] % url['id'][0],
'size': self.parseSize(result.find_all('td')[7].string), 'size': self.parseSize(result.find_all('td')[7].string),
'seeders': tryInt(result.find_all('td')[4].string), 'seeders': tryInt(result.find_all('td')[4].string),