Skip to content

Commit

Permalink
Fixed sorting everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
ofir123 committed Nov 29, 2017
1 parent d7d1769 commit 5d74d55
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
10 changes: 5 additions & 5 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:

Cinemast
----------
.. automodule:: subliminal.providers.cinemast
:private-members:

LegendasTv
----------
.. automodule:: subliminal.providers.legendastv
Expand All @@ -32,11 +37,6 @@ Shooter
.. automodule:: subliminal.providers.shooter
:private-members:

Cinemast
----------
.. automodule:: subliminal.providers.cinemast
:private-members:

TheSubDB
--------
.. automodule:: subliminal.providers.thesubdb
Expand Down
2 changes: 1 addition & 1 deletion docs/user/how_it_works.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Subliminal uses multiple providers to give users a vast choice and have a better
subtitles. Current supported providers are:

* Addic7ed
* Cinemast
* LegendasTV
* NapiProjekt
* OpenSubtitles
* Podnapisi
* Shooter
* Cinemast
* TheSubDB
* TvSubtitles

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def find_version(*file_paths):
entry_points={
'subliminal.providers': [
'addic7ed = subliminal.providers.addic7ed:Addic7edProvider',
'cinemast = subliminal.providers.cinemast:CinemastProvider',
'legendastv = subliminal.providers.legendastv:LegendasTVProvider',
'opensubtitles = subliminal.providers.opensubtitles:OpenSubtitlesProvider',
'podnapisi = subliminal.providers.podnapisi:PodnapisiProvider',
'shooter = subliminal.providers.shooter:ShooterProvider',
'cinemast = subliminal.providers.cinemast:CinemastProvider',
'thesubdb = subliminal.providers.thesubdb:TheSubDBProvider',
'tvsubtitles = subliminal.providers.tvsubtitles:TVsubtitlesProvider'
],
Expand Down
8 changes: 4 additions & 4 deletions subliminal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,16 @@ def convert(self, value, param, ctx):
@click.group(context_settings={'max_content_width': 100}, epilog='Suggestions and bug reports are greatly appreciated: '
'https://github.com/Diaoul/subliminal/')
@click.option('--addic7ed', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD', help='Addic7ed configuration.')
@click.option('--cinemast', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD', help='Cinemast configuration.')
@click.option('--legendastv', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD', help='LegendasTV configuration.')
@click.option('--opensubtitles', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD',
help='OpenSubtitles configuration.')
@click.option('--cinemast', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD', help='Cinemast configuration.')
@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, cinemast, cache_dir, debug):
def subliminal(ctx, addic7ed, cinemast, legendastv, opensubtitles, cache_dir, debug):
"""Subtitles, faster than your thoughts."""
# create cache directory
try:
Expand All @@ -249,12 +249,12 @@ def subliminal(ctx, addic7ed, legendastv, opensubtitles, cinemast, cache_dir, de
ctx.obj = {'provider_configs': {}}
if addic7ed:
ctx.obj['provider_configs']['addic7ed'] = {'username': addic7ed[0], 'password': addic7ed[1]}
if cinemast:
ctx.obj['provider_configs']['cinemast'] = {'username': cinemast[0], 'password': cinemast[1]}
if legendastv:
ctx.obj['provider_configs']['legendastv'] = {'username': legendastv[0], 'password': legendastv[1]}
if opensubtitles:
ctx.obj['provider_configs']['opensubtitles'] = {'username': opensubtitles[0], 'password': opensubtitles[1]}
if cinemast:
ctx.obj['provider_configs']['cinemast'] = {'username': cinemast[0], 'password': cinemast[1]}


@subliminal.command()
Expand Down
2 changes: 1 addition & 1 deletion subliminal/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ def unregister(self, entry_point):
#: Provider manager
provider_manager = RegistrableExtensionManager('subliminal.providers', [
'addic7ed = subliminal.providers.addic7ed:Addic7edProvider',
'cinemast = subliminal.providers.cinemast:CinemastProvider',
'legendastv = subliminal.providers.legendastv:LegendasTVProvider',
'opensubtitles = subliminal.providers.opensubtitles:OpenSubtitlesProvider',
'podnapisi = subliminal.providers.podnapisi:PodnapisiProvider',
'shooter = subliminal.providers.shooter:ShooterProvider',
'cinemast = subliminal.providers.cinemast:CinemastProvider',
'thesubdb = subliminal.providers.thesubdb:TheSubDBProvider',
'tvsubtitles = subliminal.providers.tvsubtitles:TVsubtitlesProvider'
])
Expand Down
20 changes: 10 additions & 10 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,11 @@ def test_list_subtitles_movie(movies, mock_providers):

# test providers
assert not provider_manager['addic7ed'].plugin.list_subtitles.called
assert not provider_manager['cinemast'].plugin.list_subtitles.called
assert provider_manager['legendastv'].plugin.list_subtitles.called
assert provider_manager['opensubtitles'].plugin.list_subtitles.called
assert provider_manager['podnapisi'].plugin.list_subtitles.called
assert provider_manager['shooter'].plugin.list_subtitles.called
assert not provider_manager['cinemast'].plugin.list_subtitles.called
assert provider_manager['thesubdb'].plugin.list_subtitles.called
assert not provider_manager['tvsubtitles'].plugin.list_subtitles.called

Expand All @@ -431,18 +431,18 @@ def test_list_subtitles_episode(episodes, mock_providers):

# test providers
assert provider_manager['addic7ed'].plugin.list_subtitles.called
assert provider_manager['cinemast'].plugin.list_subtitles.called
assert provider_manager['legendastv'].plugin.list_subtitles.called
assert provider_manager['opensubtitles'].plugin.list_subtitles.called
assert provider_manager['podnapisi'].plugin.list_subtitles.called
assert provider_manager['shooter'].plugin.list_subtitles.called
assert provider_manager['cinemast'].plugin.list_subtitles.called
assert provider_manager['thesubdb'].plugin.list_subtitles.called
assert provider_manager['tvsubtitles'].plugin.list_subtitles.called

# test result
assert len(subtitles) == 1
assert sorted(subtitles[episodes['bbt_s07e05']]) == ['addic7ed', 'legendastv', 'opensubtitles', 'podnapisi',
'shooter', 'cinemast', 'thesubdb', 'tvsubtitles']
assert sorted(subtitles[episodes['bbt_s07e05']]) == ['addic7ed', 'cinemast', 'legendastv', 'opensubtitles',
'podnapisi', 'shooter', 'thesubdb', 'tvsubtitles']


def test_list_subtitles_providers(episodes, mock_providers):
Expand All @@ -453,9 +453,9 @@ def test_list_subtitles_providers(episodes, mock_providers):

# test providers
assert provider_manager['addic7ed'].plugin.list_subtitles.called
assert not provider_manager['cinemast'].plugin.list_subtitles.called
assert not provider_manager['opensubtitles'].plugin.list_subtitles.called
assert not provider_manager['podnapisi'].plugin.list_subtitles.called
assert not provider_manager['cinemast'].plugin.list_subtitles.called
assert not provider_manager['thesubdb'].plugin.list_subtitles.called
assert not provider_manager['tvsubtitles'].plugin.list_subtitles.called

Expand All @@ -472,17 +472,17 @@ def test_list_subtitles_episode_no_hash(episodes, mock_providers):

# test providers
assert provider_manager['addic7ed'].plugin.list_subtitles.called
assert provider_manager['cinemast'].plugin.list_subtitles.called
assert provider_manager['legendastv'].plugin.list_subtitles.called
assert provider_manager['opensubtitles'].plugin.list_subtitles.called
assert provider_manager['podnapisi'].plugin.list_subtitles.called
assert provider_manager['cinemast'].plugin.list_subtitles.called
assert not provider_manager['thesubdb'].plugin.list_subtitles.called
assert provider_manager['tvsubtitles'].plugin.list_subtitles.called

# test result
assert len(subtitles) == 1
assert sorted(subtitles[episodes['dallas_s01e03']]) == ['addic7ed', 'legendastv', 'opensubtitles', 'podnapisi',
'shooter', 'cinemast', 'tvsubtitles']
assert sorted(subtitles[episodes['dallas_s01e03']]) == ['addic7ed', 'cinemast', 'legendastv', 'opensubtitles',
'podnapisi', 'shooter', 'tvsubtitles']


def test_list_subtitles_no_language(episodes, mock_providers):
Expand All @@ -494,9 +494,9 @@ def test_list_subtitles_no_language(episodes, mock_providers):

# test providers
assert not provider_manager['addic7ed'].plugin.list_subtitles.called
assert not provider_manager['cinemast'].plugin.list_subtitles.called
assert not provider_manager['opensubtitles'].plugin.list_subtitles.called
assert not provider_manager['podnapisi'].plugin.list_subtitles.called
assert not provider_manager['cinemast'].plugin.list_subtitles.called
assert not provider_manager['thesubdb'].plugin.list_subtitles.called
assert not provider_manager['tvsubtitles'].plugin.list_subtitles.called

Expand All @@ -516,12 +516,12 @@ def test_download_subtitles(mock_providers):

# test providers
assert provider_manager['addic7ed'].plugin.download_subtitle.called
assert not provider_manager['cinemast'].plugin.download_subtitle.called
assert not provider_manager['legendastv'].plugin.download_subtitle.called
assert not provider_manager['opensubtitles'].plugin.download_subtitle.called
assert not provider_manager['podnapisi'].plugin.download_subtitle.called
assert provider_manager['thesubdb'].plugin.download_subtitle.called
assert provider_manager['tvsubtitles'].plugin.download_subtitle.called
assert not provider_manager['cinemast'].plugin.download_subtitle.called


@pytest.mark.integration
Expand Down
4 changes: 2 additions & 2 deletions tests/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ def test_registrable_extension_manager_all_extensions():
])
extensions = sorted(e.name for e in manager)
assert len(extensions) == 9
assert extensions == ['addic7ed', 'de7cidda', 'legendastv', 'opensubtitles', 'podnapisi', 'shooter', 'cinemast',
assert extensions == ['addic7ed', 'cinemast', 'de7cidda', 'legendastv', 'opensubtitles', 'podnapisi', 'shooter',
'thesubdb', 'tvsubtitles']


def test_registrable_extension_manager_internal_extension():
manager = RegistrableExtensionManager('subliminal.test_providers', [
'addic7ed = subliminal.providers.addic7ed:Addic7edProvider',
'cinemast = subliminal.providers.cinemast:CinemastProvider',
'opensubtitles = subliminal.providers.opensubtitles:OpenSubtitlesProvider',
'podnapisi = subliminal.providers.podnapisi:PodnapisiProvider',
'cinemast = subliminal.providers.cinemast:CinemastProvider',
'thesubdb = subliminal.providers.thesubdb:TheSubDBProvider',
'tvsubtitles = subliminal.providers.tvsubtitles:TVsubtitlesProvider'
])
Expand Down

0 comments on commit 5d74d55

Please sign in to comment.