pull/684/head
Louis Vézina 5 years ago
parent b055d89b4f
commit bcc4183ef3

@ -19,9 +19,12 @@ def check_python_version():
minimum_python_version = ".".join(str(i) for i in minimum_python_version_tuple)
minimum_python3_version = ".".join(str(i) for i in minimum_python3_version_tuple)
if int(python_version[0]) == minimum_python3_version_tuple[0] and int(python_version[1]) < minimum_python3_version_tuple[1]:
print("Python " + minimum_python3_version + " or greater required. Current version is " + platform.python_version() + ". Please upgrade Python.")
os._exit(0)
if int(python_version[0]) == minimum_python3_version_tuple[0]:
if int(python_version[1]) >= minimum_python3_version_tuple[1]:
pass
else:
print("Python " + minimum_python3_version + " or greater required. Current version is " + platform.python_version() + ". Please upgrade Python.")
os._exit(0)
elif int(python_version[1]) < minimum_python_version_tuple[1] or int(re.search(r'\d+', python_version[2]).group()) < minimum_python_version_tuple[2]:
print("Python " + minimum_python_version + " or greater required. Current version is " + platform.python_version() + ". Please upgrade Python.")

@ -122,7 +122,7 @@ class SubsCenterProvider(Provider):
self.session.close()
@region.cache_on_arguments(expiration_time=SHOW_EXPIRATION_TIME)
@region.cache_on_arguments(expiration_time=SHOW_EXPIRATION_TIME, should_cache_fn=lambda value: value)
def _search_url_titles(self, title):
"""Search the URL titles by kind for the given `title`.

@ -148,7 +148,7 @@ class CFSession(CloudScraper):
cache_key = "cf_data3_%s" % domain
if not self.cookies.get("cf_clearance", "", domain=domain):
cf_data = str(region.get(cache_key))
cf_data = region.get(cache_key)
if cf_data is not NO_VALUE:
cf_cookies, hdrs = cf_data
logger.debug("Trying to use old cf data for %s: %s", domain, cf_data)
@ -165,9 +165,9 @@ class CFSession(CloudScraper):
pass
else:
if cf_data and "cf_clearance" in cf_data[0] and cf_data[0]["cf_clearance"]:
if cf_data != str(region.get(cache_key)):
if cf_data != region.get(cache_key):
logger.debug("Storing cf data for %s: %s", domain, cf_data)
region.set(cache_key, bytearray(cf_data, encoding='utf-8'))
region.set(cache_key, cf_data)
elif cf_data[0]["cf_clearance"]:
logger.debug("CF Live tokens not updated")

@ -141,7 +141,7 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin):
logger.info("Creating session")
self.session = RetryingCFSession()
prev_cookies = str(region.get("subscene_cookies2"))
prev_cookies = region.get("subscene_cookies2")
if prev_cookies != NO_VALUE:
logger.debug("Re-using old subscene cookies: %r", prev_cookies)
self.session.cookies.update(prev_cookies)
@ -152,11 +152,11 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin):
def login(self):
r = self.session.get("https://subscene.com/account/login")
if "Server Error" in r.content:
if "Server Error" in r.text:
logger.error("Login unavailable; Maintenance?")
raise ServiceUnavailable("Login unavailable; Maintenance?")
match = re.search(r"<script id='modelJson' type='application/json'>\s*(.+)\s*</script>", r.content)
match = re.search(r"<script id='modelJson' type='application/json'>\s*(.+)\s*</script>", r.text)
if match:
h = six.moves.html_parser.HTMLParser()
@ -178,7 +178,7 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin):
r"scope.+?value=\"(?P<scope>.+?)\".+?"
r"state.+?value=\"(?P<state>.+?)\".+?"
r"session_state.+?value=\"(?P<session_state>.+?)\"",
r.content, re.MULTILINE | re.DOTALL)
r.text, re.MULTILINE | re.DOTALL)
if pep_content:
r = self.session.post(SITE_DOMAIN, pep_content.groupdict())
@ -194,7 +194,7 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin):
del cj[cn]
logger.debug("Storing cookies: %r", cj)
region.set("subscene_cookies2", bytearray(cj, encoding='utf-8'))
region.set("subscene_cookies2", bytearray(cj,encoding='utf-8'))
return
raise ProviderError("Something went wrong when trying to log in #1")
@ -219,7 +219,7 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin):
acc_filters["SelectedIds"] = selected_ids
self.filters["LanguageFilter"] = ",".join(acc_filters["SelectedIds"])
last_filters = str(region.get("subscene_filters"))
last_filters = region.get("subscene_filters")
if last_filters != acc_filters:
region.set("subscene_filters", bytearray(acc_filters, encoding='utf-8'))
logger.debug("Setting account filters to %r", acc_filters)

@ -170,7 +170,7 @@
<tbody>
<%
subtitles_files = ast.literal_eval(str(details.subtitles))
subtitles_files.sort()
subtitles_files.sort(key = lambda x: x[0])
if subtitles_files is not None:
for subtitles_file in subtitles_files:
if subtitles_file[0].endswith(':forced'):

Loading…
Cancel
Save