Merge branch 'develop' of git://github.com/Mochaka/CouchPotatoServer into Mochaka-develop
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
from main import Yify
|
||||||
|
|
||||||
|
def start():
|
||||||
|
return Yify()
|
||||||
|
|
||||||
|
config = [{
|
||||||
|
'name': 'yify',
|
||||||
|
'groups': [
|
||||||
|
{
|
||||||
|
'tab': 'searcher',
|
||||||
|
'subtab': 'providers',
|
||||||
|
'list': 'torrent_providers',
|
||||||
|
'name': 'Yify',
|
||||||
|
'description': 'Small HD movies, encoded by Yify.',
|
||||||
|
'wizard': False,
|
||||||
|
'options': [
|
||||||
|
{
|
||||||
|
'name': 'enabled',
|
||||||
|
'type': 'enabler',
|
||||||
|
'default': True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'extra_score',
|
||||||
|
'advanced': True,
|
||||||
|
'label': 'Extra Score',
|
||||||
|
'type': 'int',
|
||||||
|
'default': 0,
|
||||||
|
'description': 'Starting score for each release found via this provider.',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}]
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
|
||||||
|
from couchpotato.core.helpers.variable import tryInt, cleanHost
|
||||||
|
from couchpotato.core.logger import CPLog
|
||||||
|
from couchpotato.core.providers.torrent.base import TorrentProvider
|
||||||
|
from couchpotato.environment import Env
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class Yify(TorrentProvider):
|
||||||
|
|
||||||
|
urls = {
|
||||||
|
'test' : 'https://yify-torrents.com/api',
|
||||||
|
'search' : 'https://yify-torrents.com/api/list.json?keywords=%s&quality=%s',
|
||||||
|
'detail': 'https://yify-torrents.com/api/movie.json?id=%s'
|
||||||
|
}
|
||||||
|
|
||||||
|
http_time_between_calls = 1 #seconds
|
||||||
|
|
||||||
|
def _search(self, movie, quality, results):
|
||||||
|
try:
|
||||||
|
data = self.getJsonData(self.urls['search'] % (movie['library']['title'], quality['identifier']))
|
||||||
|
except:
|
||||||
|
log.error('Search on Yify (%s) failed (could not decode JSON)', params)
|
||||||
|
return
|
||||||
|
|
||||||
|
if data:
|
||||||
|
try:
|
||||||
|
for result in data:
|
||||||
|
results.append({
|
||||||
|
'id': result['MovieID'],
|
||||||
|
'name': result['MovieTitle'],
|
||||||
|
'url': result['TorrentUrl'],
|
||||||
|
'detail_url': self.urls['detail'] % result['MovieID'],
|
||||||
|
'size': self.parseSize(result['Size']),
|
||||||
|
'seeders': tryInt(result['TorrentSeeds']),
|
||||||
|
'leechers': tryInt(result['TorrentPeers'])
|
||||||
|
})
|
||||||
|
|
||||||
|
except:
|
||||||
|
log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc()))
|
||||||
|
|
||||||
Reference in New Issue
Block a user