summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2023-11-18 10:30:37 -0500
committermorpheus65535 <[email protected]>2023-11-18 10:30:37 -0500
commitb3b4fef8c7b8de80d9c7167a445815b8f356f8aa (patch)
treea73f9bcbda5cd98c00f55c6b636bd32c757d4c71 /libs
parent7e650c2babf9c3fdca83750408da0e8ce5edf093 (diff)
downloadbazarr-b3b4fef8c7b8de80d9c7167a445815b8f356f8aa.tar.gz
bazarr-b3b4fef8c7b8de80d9c7167a445815b8f356f8aa.zip
Implemented PaymentRequired exception on opensubtitles.org that now requires VIP subscription.
Diffstat (limited to 'libs')
-rw-r--r--libs/subliminal/providers/opensubtitles.py5
-rw-r--r--libs/subliminal_patch/providers/opensubtitles.py4
2 files changed, 8 insertions, 1 deletions
diff --git a/libs/subliminal/providers/opensubtitles.py b/libs/subliminal/providers/opensubtitles.py
index 7a0b60029..ebe791e53 100644
--- a/libs/subliminal/providers/opensubtitles.py
+++ b/libs/subliminal/providers/opensubtitles.py
@@ -237,6 +237,11 @@ class Unauthorized(OpenSubtitlesError, AuthenticationError):
pass
+class PaymentRequired(OpenSubtitlesError):
+ """Exception raised when status is '402 Payment Required'."""
+ pass
+
+
class NoSession(OpenSubtitlesError, AuthenticationError):
"""Exception raised when status is '406 No session'."""
pass
diff --git a/libs/subliminal_patch/providers/opensubtitles.py b/libs/subliminal_patch/providers/opensubtitles.py
index 2918fd6ce..678ec882e 100644
--- a/libs/subliminal_patch/providers/opensubtitles.py
+++ b/libs/subliminal_patch/providers/opensubtitles.py
@@ -15,7 +15,7 @@ from guessit import guessit
from subliminal.exceptions import ConfigurationError, ServiceUnavailable
from subliminal.providers.opensubtitles import OpenSubtitlesProvider as _OpenSubtitlesProvider,\
OpenSubtitlesSubtitle as _OpenSubtitlesSubtitle, Episode, Movie, ServerProxy, Unauthorized, NoSession, \
- DownloadLimitReached, InvalidImdbid, UnknownUserAgent, DisabledUserAgent, OpenSubtitlesError
+ DownloadLimitReached, InvalidImdbid, UnknownUserAgent, DisabledUserAgent, OpenSubtitlesError, PaymentRequired
from .mixins import ProviderRetryMixin
from subliminal.subtitle import fix_line_ending
from subliminal_patch.providers import reinitialize_on_error
@@ -418,6 +418,8 @@ def checked(fn, raise_api_limit=False):
if status_code == 401:
raise Unauthorized
+ if status_code == 402:
+ raise PaymentRequired
if status_code == 406:
raise NoSession
if status_code == 407: