fixing #508 in ezdl

master
Blatzar 2020-09-13 10:07:41 +02:00 committed by GitHub
parent 80ed758b89
commit 2f403d4b2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 10 deletions

View File

@ -6,7 +6,7 @@ import requests_cache
from anime_downloader import session, util
from anime_downloader.__version__ import __version__
from anime_downloader.sites import get_anime_class, ALL_ANIME_SITES
from anime_downloader.sites import get_anime_class, ALL_ANIME_SITES, exceptions
from anime_downloader import animeinfo
from anime_downloader.config import Config
@ -16,6 +16,8 @@ echo = click.echo
sitenames = [v[1] for v in ALL_ANIME_SITES]
# NOTE: Don't put defaults here. Add them to the dict in config
@click.command()
@click.argument('anime_url')
@click.option(
@ -40,7 +42,6 @@ sitenames = [v[1] for v in ALL_ANIME_SITES]
@click.option(
'--url', '-u', type=bool, is_flag=True,
help="If flag is set, prints the stream url instead of downloading")
@click.option(
'--choice', '-c', type=int,
help='Choice to start downloading given anime number ',
@ -50,7 +51,6 @@ sitenames = [v[1] for v in ALL_ANIME_SITES]
'--download-metadata', '-dm', is_flag=True,
help='Download additional metadata')
@click.option("--skip-fillers", is_flag=True, help="Skip downloading of fillers.")
@click.pass_context
def command(ctx, anime_url, episode_range, player,
force_download, provider,
@ -89,6 +89,9 @@ def command(ctx, anime_url, episode_range, player,
# 1:3 -> for _episode in range(1, 4):
episode_range = util.parse_episode_range(episode_count, episode_range)
episode_range_split = episode_range.split(':')
# Issue #508.
if episode_range_split[0] > episode_range_split[-1]:
raise exceptions.NotFoundError('No episodes found within index.')
# Stores the choices for each provider, to prevent re-prompting search.
# As the current setup runs episode wise without this a 12 episode series would give 12+ prompts.