mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-05 17:05:03 -05:00
Reverted change torrentday.py, the shouldn't be included
This commit is contained in:
parent
d2f49a0759
commit
ccf3a03c24
@ -1,19 +1,19 @@
|
|||||||
# Author: Mr_Orange <mr_orange@hotmail.it>
|
# Author: Mr_Orange <mr_orange@hotmail.it>
|
||||||
#
|
#
|
||||||
# This file is part of SickGear.
|
# This file is part of SickRage.
|
||||||
#
|
#
|
||||||
# SickGear is free software: you can redistribute it and/or modify
|
# SickRage is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# SickGear is distributed in the hope that it will be useful,
|
# SickRage is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
|
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import datetime
|
import datetime
|
||||||
@ -35,11 +35,6 @@ from sickbeard.helpers import sanitizeSceneName
|
|||||||
|
|
||||||
|
|
||||||
class TorrentDayProvider(generic.TorrentProvider):
|
class TorrentDayProvider(generic.TorrentProvider):
|
||||||
urls = {'base_url': 'https://torrentday.eu',
|
|
||||||
'login': 'https://torrentday.eu/torrents/',
|
|
||||||
'search': 'https://torrentday.eu/V3/API/API.php',
|
|
||||||
'download': 'https://torrentday.eu/download.php/%s/%s'
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
@ -59,6 +54,12 @@ class TorrentDayProvider(generic.TorrentProvider):
|
|||||||
|
|
||||||
self.cache = TorrentDayCache(self)
|
self.cache = TorrentDayCache(self)
|
||||||
|
|
||||||
|
self.urls = {'base_url': 'http://www.td.af',
|
||||||
|
'login': 'http://www.td.af/torrents/',
|
||||||
|
'search': 'http://www.td.af/V3/API/API.php',
|
||||||
|
'download': 'http://www.td.af/download.php/%s/%s'
|
||||||
|
}
|
||||||
|
|
||||||
self.url = self.urls['base_url']
|
self.url = self.urls['base_url']
|
||||||
|
|
||||||
self.cookies = None
|
self.cookies = None
|
||||||
@ -83,9 +84,7 @@ class TorrentDayProvider(generic.TorrentProvider):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
if self._uid and self._hash:
|
if self._uid and self._hash:
|
||||||
|
|
||||||
requests.utils.add_dict_to_cookiejar(self.session.cookies, self.cookies)
|
requests.utils.add_dict_to_cookiejar(self.session.cookies, self.cookies)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
login_params = {'username': self.username,
|
login_params = {'username': self.username,
|
||||||
@ -94,6 +93,9 @@ class TorrentDayProvider(generic.TorrentProvider):
|
|||||||
'submit.y': 0
|
'submit.y': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not self.session:
|
||||||
|
self.session = requests.Session()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = self.session.post(self.urls['login'], data=login_params, timeout=30, verify=False)
|
response = self.session.post(self.urls['login'], data=login_params, timeout=30, verify=False)
|
||||||
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e:
|
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e:
|
||||||
@ -108,18 +110,20 @@ class TorrentDayProvider(generic.TorrentProvider):
|
|||||||
logger.log(u'Invalid username or password for ' + self.name + ', Check your settings!', logger.ERROR)
|
logger.log(u'Invalid username or password for ' + self.name + ', Check your settings!', logger.ERROR)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if requests.utils.dict_from_cookiejar(self.session.cookies)['uid'] and requests.utils.dict_from_cookiejar(self.session.cookies)['pass']:
|
try:
|
||||||
self._uid = requests.utils.dict_from_cookiejar(self.session.cookies)['uid']
|
if requests.utils.dict_from_cookiejar(self.session.cookies)['uid'] and requests.utils.dict_from_cookiejar(self.session.cookies)['pass']:
|
||||||
self._hash = requests.utils.dict_from_cookiejar(self.session.cookies)['pass']
|
self._uid = requests.utils.dict_from_cookiejar(self.session.cookies)['uid']
|
||||||
|
self._hash = requests.utils.dict_from_cookiejar(self.session.cookies)['pass']
|
||||||
|
|
||||||
self.cookies = {'uid': self._uid,
|
self.cookies = {'uid': self._uid,
|
||||||
'pass': self._hash
|
'pass': self._hash
|
||||||
}
|
}
|
||||||
return True
|
return True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
else:
|
logger.log(u'Unable to obtain cookie for TorrentDay', logger.ERROR)
|
||||||
logger.log(u'Unable to obtain cookie for TorrentDay', logger.ERROR)
|
return False
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def _get_season_search_strings(self, ep_obj):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
@ -165,7 +169,7 @@ class TorrentDayProvider(generic.TorrentProvider):
|
|||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
ep_string = show_name_helpers.sanitizeSceneName(show_name) + ' ' + \
|
ep_string = show_name_helpers.sanitizeSceneName(show_name) + ' ' + \
|
||||||
sickbeard.config.naming_ep_type[2] % {'seasonnumber': ep_obj.scene_season,
|
sickbeard.config.naming_ep_type[2] % {'seasonnumber': ep_obj.scene_season,
|
||||||
'episodenumber': ep_obj.scene_episode}
|
'episodenumber': ep_obj.scene_episode} + ' %s' % add_string
|
||||||
|
|
||||||
search_string['Episode'].append(re.sub('\s+', ' ', ep_string))
|
search_string['Episode'].append(re.sub('\s+', ' ', ep_string))
|
||||||
|
|
||||||
@ -179,7 +183,7 @@ class TorrentDayProvider(generic.TorrentProvider):
|
|||||||
freeleech = '&free=on' if self.freeleech else ''
|
freeleech = '&free=on' if self.freeleech else ''
|
||||||
|
|
||||||
if not self._doLogin():
|
if not self._doLogin():
|
||||||
return []
|
return results
|
||||||
|
|
||||||
for mode in search_params.keys():
|
for mode in search_params.keys():
|
||||||
for search_string in search_params[mode]:
|
for search_string in search_params[mode]:
|
||||||
@ -279,8 +283,6 @@ class TorrentDayCache(tvcache.TVCache):
|
|||||||
|
|
||||||
def _getRSSData(self):
|
def _getRSSData(self):
|
||||||
search_params = {'RSS': ['']}
|
search_params = {'RSS': ['']}
|
||||||
return self.provider._doSearch(search_params)
|
return {'entries': self.provider._doSearch(search_params)}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
provider = TorrentDayProvider()
|
provider = TorrentDayProvider()
|
||||||
|
Loading…
Reference in New Issue
Block a user