Skip to content

Commit

Permalink
Merge pull request #1077 from getzze/opensubtitles-com-cli
Browse files Browse the repository at this point in the history
Opensubtitles.com cli options and document (also Gestdown)
  • Loading branch information
getzze authored May 13, 2024
2 parents aa04b97 + 644d4b1 commit 348ee7b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
10 changes: 10 additions & 0 deletions docs/api/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Addic7ed
.. automodule:: subliminal.providers.addic7ed
:private-members:

Gestdown
--------
.. automodule:: subliminal.providers.gestdown
:private-members:

NapiProjekt
-----------
.. automodule:: subliminal.providers.napiprojekt
Expand All @@ -17,6 +22,11 @@ OpenSubtitles
.. automodule:: subliminal.providers.opensubtitles
:private-members:

OpenSubtitles.com
-----------------
.. automodule:: subliminal.providers.opensubtitlescom
:private-members:

Podnapisi
---------
.. automodule:: subliminal.providers.podnapisi
Expand Down
2 changes: 2 additions & 0 deletions docs/user/how_it_works.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ Subliminal uses multiple providers to give users a vast choice and have a better
subtitles. Current supported providers are:

* Addic7ed
* Gestdown
* LegendasTV
* NapiProjekt
* OpenSubtitles
* OpenSubtitles.com
* Podnapisi
* Shooter
* TheSubDB
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ def find_version(*file_paths):
'subliminal.providers': [
'addic7ed = subliminal.providers.addic7ed:Addic7edProvider',
'argenteam = subliminal.providers.argenteam:ArgenteamProvider',
'gestdown = subliminal.providers.gestdown:GestdownProvider',
'napiprojekt = subliminal.providers.napiprojekt:NapiProjektProvider',
'opensubtitles = subliminal.providers.opensubtitles:OpenSubtitlesProvider',
'opensubtitlescom = subliminal.providers.opensubtitlescom:OpenSubtitlesComProvider',
'podnapisi = subliminal.providers.podnapisi:PodnapisiProvider',
'shooter = subliminal.providers.shooter:ShooterProvider',
'thesubdb = subliminal.providers.thesubdb:TheSubDBProvider',
Expand All @@ -86,6 +88,7 @@ def find_version(*file_paths):
],
'babelfish.language_converters': [
'addic7ed = subliminal.converters.addic7ed:Addic7edConverter',
'opensubtitlescom = subliminal.converters.opensubtitlescom:OpenSubtitlesComConverter',
'shooter = subliminal.converters.shooter:ShooterConverter',
'thesubdb = subliminal.converters.thesubdb:TheSubDBConverter',
'tvsubtitles = subliminal.converters.tvsubtitles:TVsubtitlesConverter'
Expand Down
13 changes: 12 additions & 1 deletion subliminal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,15 @@ def convert(self, value, param, ctx):
@click.option('--legendastv', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD', help='LegendasTV configuration.', hidden=True)
@click.option('--opensubtitles', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD',
help='OpenSubtitles configuration.')
@click.option('--opensubtitlescom', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD',
help='OpenSubtitles.com configuration.')
@click.option('--omdb', type=click.STRING, nargs=1, metavar='APIKEY', help='OMDB API key.')
@click.option('--cache-dir', type=click.Path(writable=True, file_okay=False), default=dirs.user_cache_dir,
show_default=True, expose_value=True, help='Path to the cache directory.')
@click.option('--debug', is_flag=True, help='Print useful information for debugging subliminal and for reporting bugs.')
@click.version_option(__version__)
@click.pass_context
def subliminal(ctx, addic7ed, legendastv, opensubtitles, omdb, cache_dir, debug):
def subliminal(ctx, addic7ed, legendastv, opensubtitles, opensubtitlescom, omdb, cache_dir, debug):
"""Subtitles, faster than your thoughts."""
# create cache directory
try:
Expand Down Expand Up @@ -280,6 +282,15 @@ def subliminal(ctx, addic7ed, legendastv, opensubtitles, omdb, cache_dir, debug)
if opensubtitles:
ctx.obj['provider_configs']['opensubtitles'] = {'username': opensubtitles[0], 'password': opensubtitles[1]}
ctx.obj['provider_configs']['opensubtitlesvip'] = {'username': opensubtitles[0], 'password': opensubtitles[1]}
if opensubtitlescom:
ctx.obj['provider_configs']['opensubtitlescom'] = {
'username': opensubtitlescom[0],
'password': opensubtitlescom[1],
}
ctx.obj['provider_configs']['opensubtitlescomvip'] = {
'username': opensubtitlescom[0],
'password': opensubtitlescom[1],
}

# refiner configs
if omdb:
Expand Down
2 changes: 1 addition & 1 deletion subliminal/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def unregister(self, entry_point):
])

#: Disabled providers
disabled_providers = ['addic7ed', 'napiprojekt', 'opensubtitlesvip', 'shooter']
disabled_providers = ['addic7ed', 'napiprojekt', 'opensubtitlesvip', 'opensubtitlescomvip', 'shooter']

#: Default enabled providers
default_providers = [p for p in provider_manager.names() if p not in disabled_providers]
Expand Down
2 changes: 2 additions & 0 deletions subliminal/refiners/hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
'napiprojekt': hash_napiprojekt,
'opensubtitles': hash_opensubtitles,
'opensubtitlesvip': hash_opensubtitles,
'opensubtitlescom': hash_opensubtitles,
'opensubtitlescomvip': hash_opensubtitles,
'shooter': hash_shooter,
'thesubdb': hash_thesubdb
}
Expand Down

0 comments on commit 348ee7b

Please sign in to comment.