Change name and response

This commit is contained in:
Ruud
2013-11-23 12:07:00 +01:00
parent df60d70592
commit 4b9f9862fc
2 changed files with 24 additions and 32 deletions
@@ -1,17 +1,17 @@
from .main import Couchtater from .main import TorrentPotato
def start(): def start():
return Couchtater() return TorrentPotato()
config = [{ config = [{
'name': 'couchtater', 'name': 'torrentpotato',
'groups': [ 'groups': [
{ {
'tab': 'searcher', 'tab': 'searcher',
'list': 'torrent_providers', 'list': 'torrent_providers',
'name': 'couchtart', 'name': 'TorrentPotato',
'order': 10, 'order': 10,
'description': 'Couchtater providers.', 'description': 'CouchPotato torrent provider providers.',
'wizard': True, 'wizard': True,
'options': [ 'options': [
{ {
@@ -26,7 +26,7 @@ config = [{
{ {
'name': 'host', 'name': 'host',
'default': '', 'default': '',
'description': 'The url path of your Couchtart provider.', 'description': 'The url path of your TorrentPotato provider.',
}, },
{ {
'name': 'extra_score', 'name': 'extra_score',
@@ -1,15 +1,17 @@
from couchpotato.core.helpers.encoding import tryUrlencode from couchpotato.core.helpers.encoding import tryUrlencode, toUnicode
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
import re
import traceback import traceback
log = CPLog(__name__) log = CPLog(__name__)
class Couchtater(TorrentProvider): class TorrentPotato(TorrentProvider):
urls = {}
limits_reached = {} limits_reached = {}
http_time_between_calls = 1 # Seconds http_time_between_calls = 1 # Seconds
@@ -41,30 +43,20 @@ class Couchtater(TorrentProvider):
if torrents: if torrents:
try: try:
if torrents.get('error'): if torrents.get('error'):
if 'Incorrect parameters.' in torrents['Error']: log.error('%s: %s', (torrents.get('error'), host['host']))
log.error('Wrong parameters passed to: %s', host['host'])
elif 'Death by authorization.' in torrents['Error']:
log.error('Wrong username or pass key for: %s', host['host'])
else:
log.error('Unknown error for: %s', host['host'])
return #(can I disable this host somehow? and notify user?)
elif torrents.get('results'): elif torrents.get('results'):
for torrent in torrents['results']: for torrent in torrents.get('results', []):
print torrent results.append({
#results.append({ 'id': torrent.get('torrent_id'),
# 'id': tryInt(result.get('TorrentID')), 'protocol': 'torrent' if re.match('^(http|https|ftp)://.*$', torrent.get('download_url')) else 'torrent_magnet',
# 'name': toUnicode(result.get('ReleaseName')), 'name': toUnicode(torrent.get('name')),
# 'url': result.get('DownloadURL'), 'url': torrent.get('download_url'),
# 'detail_url': result.get('DetailURL'), 'detail_url': torrent.get('details_url'),
# 'size': tryInt(self.parseSize(result.get('Size'))), 'size': torrent.get('size'),
# 'score': host['extra_score'], 'score': host['extra_score'],
# 'seeders': tryInt(result.get('Seeders'), 'seeders': torrent.get('seeders'),
# 'leechers': tryInt(result.get('Leechers'), 'leechers': torrent.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()))
@@ -104,7 +96,7 @@ class Couchtater(TorrentProvider):
hosts = self.getHosts() hosts = self.getHosts()
for host in hosts: for host in hosts:
result = super(Couchtater, self).belongsTo(url, host = host['host'], provider = provider) result = super(TorrentPotato, self).belongsTo(url, host = host['host'], provider = provider)
if result: if result:
return result return result