Browse Source

Fix add `cf_clearance` to two providers that use CF IUAM, Scenetime and Torrenting.

Change convert Scenetime Quicktime SD release titles to formal SD quality title.
tags/release_0.21.49^2
JackDandy 5 years ago
parent
commit
b201c36fec
  1. 4
      CHANGES.md
  2. 25
      sickbeard/providers/scenetime.py
  3. 4
      sickbeard/providers/torrenting.py

4
CHANGES.md

@ -1,6 +1,8 @@
### 0.21.49 (2020-09-xx xx:xx:00 UTC)
### 0.21.49 (2020-09-19 20:40:00 UTC)
* Change make make test_encrypt hardware independent
* Fix add `cf_clearance` to two providers that use CF IUAM, Scenetime and Torrenting
* Change convert Scenetime Quicktime SD release titles to formal SD quality title
### 0.21.48 (2020-09-18 21:00:00 UTC)

25
sickbeard/providers/scenetime.py

@ -49,7 +49,8 @@ class SceneTimeProvider(generic.TorrentProvider):
return super(SceneTimeProvider, self)._authorised(
logged_in=(lambda y='': all(
['staff-support' in y, self.has_all_cookies()] +
[(self.session.cookies.get(x, domain='') or 'sg!no!pw') in self.digest for x in ('uid', 'pass')])),
[(self.session.cookies.get(x, domain='') or 'sg!no!pw') in self.digest
for x in ('uid', 'pass', 'cf_clearance')])),
failed_msg=(lambda y=None: u'Invalid cookie details for %s. Check settings'))
@staticmethod
@ -136,7 +137,7 @@ class SceneTimeProvider(generic.TorrentProvider):
self.freeleech and (None is rc['fl'].search(cells[1].get_text()))):
continue
title = (info.attrs.get('title') or info.get_text()).strip()
title = self.regulate_title((info.attrs.get('title') or info.get_text()).strip())
download_url = self._link('%s/%s' % (dl_id, str(title).replace(' ', '.')))
except (AttributeError, TypeError, ValueError, KeyError):
continue
@ -159,8 +160,26 @@ class SceneTimeProvider(generic.TorrentProvider):
return results
@staticmethod
def regulate_title(name):
# convert a non-standard release title into a usable format
name_has = (lambda quality_list, func=all: func([re.search(q, name, re.I) for q in quality_list]))
fmt = '((h.?|x)26[45]|vp9|av1|hevc)'
webfmt = 'web.?(dl|rip|.%s)' % fmt
rips = 'b[r|d]rip'
# check none of the formal structures apply to this title
if not name_has(['(720|1080|2160)[pi]|720hd']) and \
not name_has(['(dvd.?rip|%s)(.ws)?(.(xvid|divx|%s))?' % (rips, fmt)]):
if (not name_has(['hr.ws.pdtv.(h.?|x)264'])
and not (name_has([r'(hdtv|pdtv|dsr|tvrip)([-]|.((aac|ac3|dd).?\d\.?\d.)*(xvid|%s))' % fmt])
or name_has(['(xvid|divx|480p|hevc|x265)']))) \
or not name_has([webfmt, 'xvid|%s' % fmt]):
# non standard SD `aac.mp4-` -> `hdtv.x264.aac-`
name = re.sub(r'([.\s])AAC([.\s])MP4[-]', r'\1hdtv\2x264\2aac-', name)
return name
def ui_string(self, key):
cookies = 'use... \'uid=xx; pass=yy\''
cookies = 'use... \'uid=xx; pass=yy; cf_clearance=zz\''
if 'cookie_str_only' == key:
return cookies
if 'scenetime_digest' == key and self._valid_home():

4
sickbeard/providers/torrenting.py

@ -47,7 +47,7 @@ class TorrentingProvider(generic.TorrentProvider):
return super(TorrentingProvider, self)._authorised(
logged_in=(lambda y='': all(
['RSS link' in y, self.has_all_cookies()] +
[(self.session.cookies.get(x) or 'sg!no!pw') in self.digest for x in ('uid', 'pass')])),
[(self.session.cookies.get(x) or 'sg!no!pw') in self.digest for x in ('uid', 'pass', 'cf_clearance')])),
failed_msg=(lambda y=None: u'Invalid cookie details for %s. Check settings'))
@staticmethod
@ -120,7 +120,7 @@ class TorrentingProvider(generic.TorrentProvider):
@staticmethod
def ui_string(key):
return 'torrenting_digest' == key and 'use... \'uid=xx; pass=yy\'' or ''
return 'torrenting_digest' == key and 'use... \'uid=xx; pass=yy; cf_clearance=zz\'' or ''
provider = TorrentingProvider()

Loading…
Cancel
Save