Fixed opensubtitles.com authentication issue. #1935

This commit is contained in:
morpheus65535 2022-09-17 09:10:08 -04:00
parent 61f888c3df
commit 663e8d7395
1 changed files with 5 additions and 2 deletions

View File

@ -205,7 +205,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
)
if results == 401:
logging.debug('Authentification failed: clearing cache and attempting to login.')
logging.debug('Authentication failed: clearing cache and attempting to login.')
region.delete("oscom_token")
self.login()
@ -245,6 +245,9 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
logger.debug(f'No match found for {title}')
def query(self, languages, video):
if region.get("oscom_token", expiration_time=TOKEN_EXPIRATION_TIME) is NO_VALUE:
logger.debug("No cached token, we'll try to login again.")
self.login()
self.video = video
if self.use_hash:
file_hash = self.video.hashes.get('opensubtitlescom')
@ -363,7 +366,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
return self.query(languages, video)
def download_subtitle(self, subtitle):
if self.token is NO_VALUE:
if region.get("oscom_token", expiration_time=TOKEN_EXPIRATION_TIME) is NO_VALUE:
logger.debug("No cached token, we'll try to login again.")
self.login()
if self.token is NO_VALUE: