Skip to content

Commit

Permalink
Fixed issue with TorrentLeech logins
Browse files Browse the repository at this point in the history
  • Loading branch information
echel0n committed Oct 10, 2018
1 parent 37896dd commit 7a20aea
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
4 changes: 2 additions & 2 deletions COPYING.txt
Expand Up @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

The ultimate PVR application that downloads and manages your TV shows
Copyright (C) 2010 - echel0n
Copyright (C) 2014 - echel0n

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

SiCKRAGE - Copyright (C) 2010 - echel0n
SiCKRAGE - Copyright (C) 2014 - echel0n
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
3 changes: 2 additions & 1 deletion changelog.md
@@ -1,6 +1,7 @@
# Changelog

- * 9ca359a - 2018-10-08: Release v9.3.80
- * 414a1aa - 2018-10-09: Fixed issue with TorrentLeech logins
- * a9e7913 - 2018-10-08: Release v9.3.80
- * 615cf7d - 2018-10-08: Pre-Release v9.3.80.dev6
- * fabc483 - 2018-10-08: Added web session hook to handle redirects when doing posts. Fixed issues with getting search results from YGGTorrent provider.
- * f64a196 - 2018-10-08: Pre-Release v9.3.80.dev5
Expand Down
56 changes: 29 additions & 27 deletions sickrage/providers/torrent/torrentleech.py
Expand Up @@ -20,6 +20,8 @@

from urlparse import urljoin

from requests.utils import dict_from_cookiejar

import sickrage
from sickrage.core.caches.tv_cache import TVCache
from sickrage.core.helpers import bs4_parser, convert_size, try_int
Expand All @@ -38,8 +40,8 @@ def __init__(self):
self.username = None
self.password = None

self.enable_cookies = True
self.required_cookies = ('tluid', 'tlpass')
# self.enable_cookies = True
# self.required_cookies = ('tluid', 'tlpass')

self.minseed = None
self.minleech = None
Expand All @@ -48,32 +50,32 @@ def __init__(self):

self.cache = TVCache(self, min_time=20)

def login(self):
return self.cookie_login('log in')

# def login(self):
# cookies = dict_from_cookiejar(self.session.cookies)
# if any(cookies.values()) and cookies.get('member_id'):
# return True
#
# login_params = {
# 'username': self.username,
# 'password': self.password,
# 'login': 'submit',
# 'remember_me': 'on',
# }
#
# try:
# response = self.session.post(self.urls['login'], data=login_params, timeout=30).text
# except Exception:
# sickrage.app.log.warning("Unable to connect to provider")
# return False
#
# if '<title>Login :: TorrentLeech.org</title>' in response:
# sickrage.app.log.warning("Invalid username or password. Check your settings")
# return False
#
# return True
# return self.cookie_login('log in')

def login(self):
cookies = dict_from_cookiejar(self.session.cookies)
if any(cookies.values()) and cookies.get('member_id'):
return True

login_params = {
'username': self.username,
'password': self.password,
'login': 'submit',
'remember_me': 'on',
}

try:
response = self.session.post(self.urls['login'], data=login_params, timeout=30).text
except Exception:
sickrage.app.log.warning("Unable to connect to provider")
return False

if '<title>Login :: TorrentLeech.org</title>' in response:
sickrage.app.log.warning("Invalid username or password. Check your settings")
return False

return True

def search(self, search_strings, age=0, ep_obj=None, **kwargs):
results = []
Expand Down

0 comments on commit 7a20aea

Please sign in to comment.