CouchTater fixes
This commit is contained in:
@@ -1,27 +1,27 @@
|
|||||||
from .main import Couchtarter
|
from .main import Couchtater
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
return Couchtarter()
|
return Couchtater()
|
||||||
|
|
||||||
config = [{
|
config = [{
|
||||||
'name': 'couchtart',
|
'name': 'couchtater',
|
||||||
'groups': [
|
'groups': [
|
||||||
{
|
{
|
||||||
'tab': 'searcher',
|
'tab': 'searcher',
|
||||||
'list': 'torrent_providers',
|
'list': 'torrent_providers',
|
||||||
'name': 'couchtart',
|
'name': 'couchtart',
|
||||||
'order': 10,
|
'order': 10,
|
||||||
'description': 'Cocuhtart providers.',
|
'description': 'Couchtater providers.',
|
||||||
'wizard': True,
|
'wizard': True,
|
||||||
'options': [
|
'options': [
|
||||||
{
|
{
|
||||||
'name': 'enabled',
|
'name': 'enabled',
|
||||||
'type': 'enabler',
|
'type': 'enabler',
|
||||||
'default': True,
|
'default': False,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'use',
|
'name': 'use',
|
||||||
'default': '0,0,0,0,0,0'
|
'default': ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'host',
|
'name': 'host',
|
||||||
@@ -36,7 +36,7 @@ config = [{
|
|||||||
'description': 'Starting score for each release found via this provider.',
|
'description': 'Starting score for each release found via this provider.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'username',
|
'name': 'name',
|
||||||
'default': '',
|
'default': '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -45,7 +45,7 @@ config = [{
|
|||||||
'label': 'Pass Key',
|
'label': 'Pass Key',
|
||||||
'description': 'Can be found on your profile page',
|
'description': 'Can be found on your profile page',
|
||||||
'type': 'combined',
|
'type': 'combined',
|
||||||
'combine': ['use', 'host', 'username', 'pass_key', 'extra_score'],
|
'combine': ['use', 'host', 'name', 'pass_key', 'extra_score'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
from couchpotato.core.helpers.encoding import tryUrlencode, toUnicode
|
from couchpotato.core.helpers.encoding import tryUrlencode
|
||||||
from couchpotato.core.helpers.variable import splitString, tryInt
|
from couchpotato.core.helpers.variable import splitString, tryInt
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.providers.base import ResultList
|
from couchpotato.core.providers.base import ResultList
|
||||||
from couchpotato.core.providers.torrent.base import TorrentProvider
|
from couchpotato.core.providers.torrent.base import TorrentProvider
|
||||||
from couchpotato.environment import Env
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
class Couchtarter(TorrentProvider):
|
|
||||||
|
class Couchtater(TorrentProvider):
|
||||||
|
|
||||||
limits_reached = {}
|
limits_reached = {}
|
||||||
|
|
||||||
@@ -30,17 +30,17 @@ class Couchtarter(TorrentProvider):
|
|||||||
def _searchOnHost(self, host, movie, quality, results):
|
def _searchOnHost(self, host, movie, quality, results):
|
||||||
|
|
||||||
arguments = tryUrlencode({
|
arguments = tryUrlencode({
|
||||||
'user': host['username'],
|
'user': host['name'],
|
||||||
'passkey': host['pass_key'],
|
'passkey': host['pass_key'],
|
||||||
'imdbid': movie['library']['identifier'].replace('tt', '')
|
'imdbid': movie['library']['identifier']
|
||||||
})
|
})
|
||||||
url = '%s&%s' % (host['host'], arguments)
|
url = '%s?%s' % (host['host'], arguments)
|
||||||
|
|
||||||
torrents = self.getJsonData(url, cache_timeout = 1800)
|
torrents = self.getJsonData(url, cache_timeout = 1800)
|
||||||
|
|
||||||
if torrents:
|
if torrents:
|
||||||
try:
|
try:
|
||||||
if torrents.get('Error'):
|
if torrents.get('error'):
|
||||||
if 'Incorrect parameters.' in torrents['Error']:
|
if 'Incorrect parameters.' in torrents['Error']:
|
||||||
log.error('Wrong parameters passed to: %s', host['host'])
|
log.error('Wrong parameters passed to: %s', host['host'])
|
||||||
elif 'Death by authorization.' in torrents['Error']:
|
elif 'Death by authorization.' in torrents['Error']:
|
||||||
@@ -49,27 +49,22 @@ class Couchtarter(TorrentProvider):
|
|||||||
log.error('Unknown error for: %s', host['host'])
|
log.error('Unknown error for: %s', host['host'])
|
||||||
return #(can I disable this host somehow? and notify user?)
|
return #(can I disable this host somehow? and notify user?)
|
||||||
|
|
||||||
elif torrents.get('Results'):
|
elif torrents.get('results'):
|
||||||
if 'None found' in torrents['Results']:
|
for torrent in torrents['results']:
|
||||||
return
|
print torrent
|
||||||
else:
|
#results.append({
|
||||||
for torrent in torrents['Results']:
|
# 'id': tryInt(result.get('TorrentID')),
|
||||||
print torrent['ReleaseName']
|
# 'name': toUnicode(result.get('ReleaseName')),
|
||||||
print torrent['Size']
|
# 'url': result.get('DownloadURL'),
|
||||||
print torrent['DownloadURL']
|
# 'detail_url': result.get('DetailURL'),
|
||||||
#results.append({
|
# 'size': tryInt(self.parseSize(result.get('Size'))),
|
||||||
# 'id': tryInt(result.get('TorrentID')),
|
# 'score': host['extra_score'],
|
||||||
# 'name': toUnicode(result.get('ReleaseName')),
|
# 'seeders': tryInt(result.get('Seeders'),
|
||||||
# 'url': result.get('DownloadURL'),
|
# 'leechers': tryInt(result.get('Leechers'),
|
||||||
# 'detail_url': result.get('DetailURL'),
|
# 'resoultion': result.get('Resolution'),
|
||||||
# 'size': tryInt(self.parseSize(result.get('Size'))),
|
# 'source': result.get('Media'),
|
||||||
# 'score': host['extra_score'],
|
# 'get_more_info': result.get('IMDbID')
|
||||||
# 'seeders': tryInt(result.get('Seeders'),
|
#})
|
||||||
# 'leechers': tryInt(result.get('Leechers'),
|
|
||||||
# 'resoultion': result.get('Resolution'),
|
|
||||||
# 'source': result.get('Media'),
|
|
||||||
# 'get_more_info': result.get('IMDbID')
|
|
||||||
#})
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
log.error('Failed getting results from %s: %s', (host['host'], traceback.format_exc()))
|
log.error('Failed getting results from %s: %s', (host['host'], traceback.format_exc()))
|
||||||
@@ -78,7 +73,7 @@ class Couchtarter(TorrentProvider):
|
|||||||
|
|
||||||
uses = splitString(str(self.conf('use')), clean = False)
|
uses = splitString(str(self.conf('use')), clean = False)
|
||||||
hosts = splitString(self.conf('host'), clean = False)
|
hosts = splitString(self.conf('host'), clean = False)
|
||||||
usernames = splitString(self.conf('username'), clean = False)
|
names = splitString(self.conf('name'), clean = False)
|
||||||
pass_keys = splitString(self.conf('pass_key'), clean = False)
|
pass_keys = splitString(self.conf('pass_key'), clean = False)
|
||||||
extra_score = splitString(self.conf('extra_score'), clean = False)
|
extra_score = splitString(self.conf('extra_score'), clean = False)
|
||||||
|
|
||||||
@@ -91,9 +86,13 @@ class Couchtarter(TorrentProvider):
|
|||||||
try: host = hosts[nr]
|
try: host = hosts[nr]
|
||||||
except: host = ''
|
except: host = ''
|
||||||
|
|
||||||
|
try: name = names[nr]
|
||||||
|
except: name = ''
|
||||||
|
|
||||||
list.append({
|
list.append({
|
||||||
'use': uses[nr],
|
'use': uses[nr],
|
||||||
'host': host,
|
'host': host,
|
||||||
|
'name': name,
|
||||||
'pass_key': key,
|
'pass_key': key,
|
||||||
'extra_score': tryInt(extra_score[nr]) if len(extra_score) > nr else 0
|
'extra_score': tryInt(extra_score[nr]) if len(extra_score) > nr else 0
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user