Merge branch 'develop'
This commit is contained in:
commit
7ec64e202b
4 files changed
+12
-164
No files matched your search
@@ -1,126 +0,0 @@
|
|||||||
import traceback
|
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
from couchpotato.core.helpers.variable import tryInt
|
|
||||||
from couchpotato.core.logger import CPLog
|
|
||||||
from couchpotato.core.media._base.providers.torrent.base import TorrentProvider
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
log = CPLog(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class Base(TorrentProvider):
|
|
||||||
|
|
||||||
urls = {
|
|
||||||
'test': 'https://www.torrentleech.org/',
|
|
||||||
'login': 'https://www.torrentleech.org/user/account/login/',
|
|
||||||
'login_check': 'https://torrentleech.org/user/messages',
|
|
||||||
'detail': 'https://www.torrentleech.org/torrent/%s',
|
|
||||||
'search': 'https://www.torrentleech.org/torrents/browse/index/query/%s/categories/%d',
|
|
||||||
'download': 'https://www.torrentleech.org%s',
|
|
||||||
}
|
|
||||||
|
|
||||||
http_time_between_calls = 1 # Seconds
|
|
||||||
cat_backup_id = None
|
|
||||||
|
|
||||||
def _searchOnTitle(self, title, media, quality, results):
|
|
||||||
|
|
||||||
url = self.urls['search'] % self.buildUrl(title, media, quality)
|
|
||||||
|
|
||||||
data = self.getHTMLData(url)
|
|
||||||
|
|
||||||
if data:
|
|
||||||
html = BeautifulSoup(data)
|
|
||||||
|
|
||||||
try:
|
|
||||||
result_table = html.find('table', attrs = {'id': 'torrenttable'})
|
|
||||||
if not result_table:
|
|
||||||
return
|
|
||||||
|
|
||||||
entries = result_table.find_all('tr')
|
|
||||||
|
|
||||||
for result in entries[1:]:
|
|
||||||
|
|
||||||
link = result.find('td', attrs = {'class': 'name'}).find('a')
|
|
||||||
url = result.find('td', attrs = {'class': 'quickdownload'}).find('a')
|
|
||||||
details = result.find('td', attrs = {'class': 'name'}).find('a')
|
|
||||||
|
|
||||||
results.append({
|
|
||||||
'id': link['href'].replace('/torrent/', ''),
|
|
||||||
'name': six.text_type(link.string),
|
|
||||||
'url': self.urls['download'] % url['href'],
|
|
||||||
'detail_url': self.urls['download'] % details['href'],
|
|
||||||
'size': self.parseSize(result.find_all('td')[4].string),
|
|
||||||
'seeders': tryInt(result.find('td', attrs = {'class': 'seeders'}).string),
|
|
||||||
'leechers': tryInt(result.find('td', attrs = {'class': 'leechers'}).string),
|
|
||||||
})
|
|
||||||
|
|
||||||
except:
|
|
||||||
log.error('Failed to parsing %s: %s', (self.getName(), traceback.format_exc()))
|
|
||||||
|
|
||||||
def getLoginParams(self):
|
|
||||||
return {
|
|
||||||
'username': self.conf('username'),
|
|
||||||
'password': self.conf('password'),
|
|
||||||
'remember_me': 'on',
|
|
||||||
'login': 'submit',
|
|
||||||
}
|
|
||||||
|
|
||||||
def loginSuccess(self, output):
|
|
||||||
return '/user/account/logout' in output.lower() or 'welcome back' in output.lower()
|
|
||||||
|
|
||||||
loginCheckSuccess = loginSuccess
|
|
||||||
|
|
||||||
|
|
||||||
config = [{
|
|
||||||
'name': 'torrentleech',
|
|
||||||
'groups': [
|
|
||||||
{
|
|
||||||
'tab': 'searcher',
|
|
||||||
'list': 'torrent_providers',
|
|
||||||
'name': 'TorrentLeech',
|
|
||||||
'description': '<a href="http://torrentleech.org">TorrentLeech</a>',
|
|
||||||
'wizard': True,
|
|
||||||
'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAACHUlEQVR4AZVSO48SYRSdGTCBEMKzILLAWiybkKAGMZRUUJEoDZX7B9zsbuQPYEEjNLTQkYgJDwsoSaxspEBsCITXjjNAIKi8AkzceXgmbHQ1NJ5iMufmO9/9zrmXlCSJ+B8o75J8Pp/NZj0eTzweBy0Wi4PBYD6f12o1r9ebTCZx+22HcrnMsuxms7m6urTZ7LPZDMVYLBZ8ZV3yo8aq9Pq0wzCMTqe77dDv9y8uLyAWBH6xWOyL0K/56fcb+rrPgPZ6PZfLRe1fsl6vCUmGKIqoqNXqdDr9Dbjps9znUV0uTqdTjuPkDoVCIfcuJ4gizjMMm8u9vW+1nr04czqdK56c37CbKY9j2+1WEARZ0Gq1RFHAz2q1qlQqXxoN69HRcDjUarW8ZD6QUigUOnY8uKYH8N1sNkul9yiGw+F6vS4Rxn8EsodEIqHRaOSnq9T7ajQazWQycEIR1AEBYDabSZJyHDucJyegwWBQr9ebTCaKvHd4cCQANUU9evwQ1Ofz4YvUKUI43GE8HouSiFiNRhOowWBIpVLyHITJkuW3PwgAEf3pgIwxF5r+OplMEsk3CPT5szCMnY7EwUdhwUh/CXiej0Qi3idPz89fdrpdbsfBzH7S3Q9K5pP4c0sAKpVKoVAQGO1ut+t0OoFAQHkH2Da/3/+but3uarWK0ZMQoNdyucRutdttmqZxMTzY7XaYxsrgtUjEZrNhkSwWyy/0NCatZumrNQAAAABJRU5ErkJggg==',
|
|
||||||
'options': [
|
|
||||||
{
|
|
||||||
'name': 'enabled',
|
|
||||||
'type': 'enabler',
|
|
||||||
'default': False,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'username',
|
|
||||||
'default': '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'password',
|
|
||||||
'default': '',
|
|
||||||
'type': 'password',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'seed_ratio',
|
|
||||||
'label': 'Seed ratio',
|
|
||||||
'type': 'float',
|
|
||||||
'default': 1,
|
|
||||||
'description': 'Will not be (re)moved until this seed ratio is met.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'seed_time',
|
|
||||||
'label': 'Seed time',
|
|
||||||
'type': 'int',
|
|
||||||
'default': 40,
|
|
||||||
'description': 'Will not be (re)moved until this seed time (in hours) is met.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'extra_score',
|
|
||||||
'advanced': True,
|
|
||||||
'label': 'Extra Score',
|
|
||||||
'type': 'int',
|
|
||||||
'default': 20,
|
|
||||||
'description': 'Starting score for each release found via this provider.',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}]
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
from couchpotato.core.helpers.encoding import tryUrlencode
|
|
||||||
from couchpotato.core.logger import CPLog
|
|
||||||
from couchpotato.core.media._base.providers.torrent.torrentleech import Base
|
|
||||||
from couchpotato.core.media.movie.providers.base import MovieProvider
|
|
||||||
|
|
||||||
log = CPLog(__name__)
|
|
||||||
|
|
||||||
autoload = 'TorrentLeech'
|
|
||||||
|
|
||||||
|
|
||||||
class TorrentLeech(MovieProvider, Base):
|
|
||||||
|
|
||||||
cat_ids = [
|
|
||||||
([13], ['720p', '1080p', 'bd50']),
|
|
||||||
([8], ['cam']),
|
|
||||||
([9], ['ts', 'tc']),
|
|
||||||
([10], ['r5', 'scr']),
|
|
||||||
([11], ['dvdrip']),
|
|
||||||
([14], ['brrip']),
|
|
||||||
([12], ['dvdr']),
|
|
||||||
]
|
|
||||||
|
|
||||||
def buildUrl(self, title, media, quality):
|
|
||||||
return (
|
|
||||||
tryUrlencode(title.replace(':', '')),
|
|
||||||
self.getCatId(quality)[0]
|
|
||||||
)
|
|
||||||
@@ -203,13 +203,6 @@ class MovieSearcher(SearcherBase, MovieTypeBase):
|
|||||||
quality['custom'] = quality_custom
|
quality['custom'] = quality_custom
|
||||||
|
|
||||||
results = fireEvent('searcher.search', search_protocols, movie, quality, single = True) or []
|
results = fireEvent('searcher.search', search_protocols, movie, quality, single = True) or []
|
||||||
results_count = len(results)
|
|
||||||
total_result_count += results_count
|
|
||||||
if results_count == 0:
|
|
||||||
log.debug('Nothing found for %s in %s', (default_title, quality['label']))
|
|
||||||
|
|
||||||
# Keep track of releases found outside ETA window
|
|
||||||
outside_eta_results += results_count if could_not_be_released else 0
|
|
||||||
|
|
||||||
# Check if movie isn't deleted while searching
|
# Check if movie isn't deleted while searching
|
||||||
if not fireEvent('media.get', movie.get('_id'), single = True):
|
if not fireEvent('media.get', movie.get('_id'), single = True):
|
||||||
@@ -217,11 +210,17 @@ class MovieSearcher(SearcherBase, MovieTypeBase):
|
|||||||
|
|
||||||
# Add them to this movie releases list
|
# Add them to this movie releases list
|
||||||
found_releases += fireEvent('release.create_from_search', results, movie, quality, single = True)
|
found_releases += fireEvent('release.create_from_search', results, movie, quality, single = True)
|
||||||
|
results_count = len(found_releases)
|
||||||
|
total_result_count += results_count
|
||||||
|
if results_count == 0:
|
||||||
|
log.debug('Nothing found for %s in %s', (default_title, quality['label']))
|
||||||
|
|
||||||
|
# Keep track of releases found outside ETA window
|
||||||
|
outside_eta_results += results_count if could_not_be_released else 0
|
||||||
|
|
||||||
# Don't trigger download, but notify user of available releases
|
# Don't trigger download, but notify user of available releases
|
||||||
if could_not_be_released:
|
if could_not_be_released and results_count > 0:
|
||||||
if results_count > 0:
|
log.debug('Found %s releases for "%s", but ETA isn\'t correct yet.', (results_count, default_title))
|
||||||
log.debug('Found %s releases for "%s", but ETA isn\'t correct yet.', (results_count, default_title))
|
|
||||||
|
|
||||||
# Try find a valid result and download it
|
# Try find a valid result and download it
|
||||||
if (force_download or not could_not_be_released or always_search) and fireEvent('release.try_download_result', results, movie, quality_custom, single = True):
|
if (force_download or not could_not_be_released or always_search) and fireEvent('release.try_download_result', results, movie, quality_custom, single = True):
|
||||||
|
|||||||
@@ -441,7 +441,6 @@ class Release(Plugin):
|
|||||||
for rel in search_results:
|
for rel in search_results:
|
||||||
|
|
||||||
rel_identifier = md5(rel['url'])
|
rel_identifier = md5(rel['url'])
|
||||||
found_releases.append(rel_identifier)
|
|
||||||
|
|
||||||
release = {
|
release = {
|
||||||
'_t': 'release',
|
'_t': 'release',
|
||||||
@@ -482,6 +481,9 @@ class Release(Plugin):
|
|||||||
# Update release in search_results
|
# Update release in search_results
|
||||||
rel['status'] = rls.get('status')
|
rel['status'] = rls.get('status')
|
||||||
|
|
||||||
|
if rel['status'] == 'available':
|
||||||
|
found_releases.append(rel_identifier)
|
||||||
|
|
||||||
return found_releases
|
return found_releases
|
||||||
except:
|
except:
|
||||||
log.error('Failed: %s', traceback.format_exc())
|
log.error('Failed: %s', traceback.format_exc())
|
||||||
|
|||||||
Reference in new issue
Block a user