Skip to content

Commit

Permalink
add support for foreign_only from opensubtitles.com
Browse files Browse the repository at this point in the history
  • Loading branch information
getzze committed Oct 7, 2024
1 parent afa239a commit 0471218
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion subliminal/providers/opensubtitlescom.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def __init__(
subtitle_id: str,
*,
hearing_impaired: bool = False,
foreign_only: bool = False,
movie_kind: str | None = None,
release: str | None = None,
movie_title: str | None = None,
Expand All @@ -199,7 +200,14 @@ def __init__(
file_id: int = 0,
file_name: str = '',
) -> None:
super().__init__(language, subtitle_id, hearing_impaired=hearing_impaired, page_link=None, encoding='utf-8')
super().__init__(
language,
subtitle_id,
hearing_impaired=hearing_impaired,
foreign_only=foreign_only,
page_link=None,
encoding='utf-8',
)
self.movie_kind = movie_kind
self.release = release
self.movie_title = movie_title
Expand Down Expand Up @@ -235,6 +243,7 @@ def from_response(
attributes = response.get('attributes', {})
language = Language.fromopensubtitlescom(str(attributes.get('language')))
hearing_impaired = bool(int(attributes.get('hearing_impaired')))
foreign_only = bool(int(attributes.get('foreign_parts_only')))
release = str(attributes.get('release'))
moviehash_match = bool(attributes.get('moviehash_match', False))
download_count = int(attributes.get('download_count'))
Expand Down Expand Up @@ -266,6 +275,7 @@ def from_response(
language,
subtitle_id,
hearing_impaired=hearing_impaired,
foreign_only=foreign_only,
movie_kind=movie_kind,
release=release,
movie_title=movie_title,
Expand Down

0 comments on commit 0471218

Please sign in to comment.