mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-22 01:23:43 +00:00
Change provider IPT only decode unicode search strings.
Change login process to use General Config/Advanced/Proxy host setting.
This commit is contained in:
parent
2e5d91baca
commit
4699d3d579
2 changed files with 17 additions and 20 deletions
|
@ -16,6 +16,8 @@
|
||||||
* Fix provider SCC stop snatching releases for episodes already completed
|
* Fix provider SCC stop snatching releases for episodes already completed
|
||||||
* Fix provider SCC handle null server responses
|
* Fix provider SCC handle null server responses
|
||||||
* Change provider SCC remove 1 of 3 requests per search to save 30% time
|
* Change provider SCC remove 1 of 3 requests per search to save 30% time
|
||||||
|
* Change provider IPT only decode unicode search strings
|
||||||
|
* Change provider IPT login process to use General Config/Advanced/Proxy host setting
|
||||||
* Remove useless webproxies from provider TPB as they fail for one reason or another
|
* Remove useless webproxies from provider TPB as they fail for one reason or another
|
||||||
* Change provider TPB to use mediaExtensions from common instead of hard-coded private list
|
* Change provider TPB to use mediaExtensions from common instead of hard-coded private list
|
||||||
* Add new tld variants to provider TPB
|
* Add new tld variants to provider TPB
|
||||||
|
|
|
@ -23,7 +23,7 @@ import datetime
|
||||||
import sickbeard
|
import sickbeard
|
||||||
import generic
|
import generic
|
||||||
from sickbeard.common import Quality
|
from sickbeard.common import Quality
|
||||||
from sickbeard import logger,tvcache,db,classes,helpers,show_name_helpers
|
from sickbeard import logger, tvcache, db, classes, helpers, show_name_helpers
|
||||||
from sickbeard.exceptions import ex, AuthException
|
from sickbeard.exceptions import ex, AuthException
|
||||||
from lib import requests
|
from lib import requests
|
||||||
from lib.requests import exceptions
|
from lib.requests import exceptions
|
||||||
|
@ -36,8 +36,7 @@ from sickbeard.show_name_helpers import allPossibleShowNames
|
||||||
class IPTorrentsProvider(generic.TorrentProvider):
|
class IPTorrentsProvider(generic.TorrentProvider):
|
||||||
urls = {'base_url': 'https://iptorrents.eu',
|
urls = {'base_url': 'https://iptorrents.eu',
|
||||||
'login': 'https://iptorrents.eu/torrents/',
|
'login': 'https://iptorrents.eu/torrents/',
|
||||||
'search': 'https://iptorrents.eu/t?%s%s&q=%s&qf=ti#torrents',
|
'search': 'https://iptorrents.eu/t?%s%s&q=%s&qf=ti#torrents'}
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
generic.TorrentProvider.__init__(self, 'IPTorrents', True, False)
|
generic.TorrentProvider.__init__(self, 'IPTorrents', True, False)
|
||||||
|
@ -56,28 +55,22 @@ class IPTorrentsProvider(generic.TorrentProvider):
|
||||||
|
|
||||||
def _checkAuth(self):
|
def _checkAuth(self):
|
||||||
|
|
||||||
if not self.username or not self.password:
|
if not (self.username and self.password):
|
||||||
raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.")
|
raise AuthException('Your authentication credentials for ' + self.name + ' are missing, check your config.')
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _doLogin(self):
|
def _doLogin(self):
|
||||||
|
|
||||||
login_params = {'username': self.username,
|
if any(self.session.cookies.values()):
|
||||||
'password': self.password,
|
return True
|
||||||
'login': 'submit',
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
login_params = {'username': self.username, 'password': self.password, 'login': 'submit'}
|
||||||
response = self.session.post(self.urls['login'], data=login_params, timeout=30, verify=False)
|
|
||||||
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError) as e:
|
|
||||||
logger.log(u'Unable to connect to ' + self.name + ' provider: ' + ex(e), logger.ERROR)
|
|
||||||
return False
|
|
||||||
|
|
||||||
if re.search('tries left', response.text) \
|
response = helpers.getURL(self.urls['login'], post_data=login_params, session=self.session)
|
||||||
or re.search('<title>IPT</title>', response.text) \
|
|
||||||
or response.status_code == 401:
|
if not response or re.search('tries left', response) or re.search('<title>IPT</title>', response):
|
||||||
logger.log(u'Your authentication credentials for ' + self.name + ' are incorrect, check your config.', logger.ERROR)
|
logger.log(u'Could not authenticate %s, abort provider.' % self.name, logger.ERROR)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -144,8 +137,10 @@ class IPTorrentsProvider(generic.TorrentProvider):
|
||||||
for search_string in search_params[mode]:
|
for search_string in search_params[mode]:
|
||||||
|
|
||||||
# URL with 50 tv-show results, or max 150 if adjusted in IPTorrents profile
|
# URL with 50 tv-show results, or max 150 if adjusted in IPTorrents profile
|
||||||
searchURL = self.urls['search'] % (self.categorie, freeleech, unidecode(search_string))
|
if isinstance(search_string, unicode):
|
||||||
searchURL += ';o=seeders' if mode != 'RSS' else ''
|
search_string = unidecode(search_string)
|
||||||
|
searchURL = '%s%s' % (self.urls['search'] % (self.categorie, freeleech, search_string),
|
||||||
|
(';o=seeders', '')['RSS' == mode])
|
||||||
|
|
||||||
logger.log(u"" + self.name + " search page URL: " + searchURL, logger.DEBUG)
|
logger.log(u"" + self.name + " search page URL: " + searchURL, logger.DEBUG)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue