anime-dl / anime-downloader

A simple but powerful anime downloader and streamer.
The Unlicense
1.92k stars 218 forks source link

--fallback-qualities parameter shows error #639

Open lakshya076 opened 3 years ago

lakshya076 commented 3 years ago

Whenever I use the anime dl {url} -e {episode} command, anime-downloader throws an error.

image

I tried to pass the --fallback-qualities parameter with the value as 720p, anime-downloader still throws the same error. I tried the same by passing the 360p, 480p and 1080p values but none work.

I have tried this with all the available sites but still the same error is shown.

Isn't there a way through which anime-downloader automatically decides which quality to use?

Also when I was downloading anime the other day everything was working perfectly fine but this error has been showing from today only.

Blatzar commented 3 years ago

--fallback-qualities is a list, hence -fq "['1080p', '720p']" is an example of how to use it. If you have that as null in config it gives None error like in your screenshot. image Default config for refrence:

"fallback_qualities": [
            "720p",
            "480p",
            "360p"
        ],
lakshya076 commented 3 years ago

I checked my config.py file and in the fallback_qualities parameter, the default config value is already given

image

Blatzar commented 3 years ago

I checked my config.py file and in the fallback_qualities parameter, the default config value is already given

Config.py is the file generation script (and shouldn't be touched), not you actual config, check config.json

lakshya076 commented 3 years ago

I have modified the config.json file and still the same problem persists

ekrekeler commented 3 years ago

I am also getting the same issue. I tried this on WSL Debian Buster using python versions 3.7.10, 3.8.10, and 3.9.5 in a new virtualenv. All versions yielded the same result:

$ anime -ll DEBUG dl 'Naruto' -e 1
Usage: anime command [OPTIONS] ANIME_URL
Try 'anime command --help' for help.

Error: Invalid value for '--fallback-qualities' / '-fq': None

If I pass the -fq arg, it just gets upset that I didn't pass a provider:

$ anime -ll DEBUG dl 'Naruto' -e 1 -fq "['720p', '480p', '360p']"
2021-05-16 20:41:32 WSL_Debian anime_downloader.util[8223] INFO anime-downloader 5.0.9
2021-05-16 20:41:32 WSL_Debian anime_downloader.util[8223] DEBUG Platform: Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.28
2021-05-16 20:41:32 WSL_Debian anime_downloader.util[8223] DEBUG Python 3.8.10
Traceback (most recent call last):
  File "/home/user/.pyenv/versions/anime-downloader/bin/anime", line 33, in <module>
    sys.exit(load_entry_point('anime-downloader', 'console_scripts', 'anime')())
  File "/home/user/anime-downloader/anime_downloader/cli.py", line 53, in main
    cli()
  File "/home/user/.pyenv/versions/3.8.10/envs/anime-downloader/lib/python3.8/site-packages/click/core.py", line 1134, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.pyenv/versions/3.8.10/envs/anime-downloader/lib/python3.8/site-packages/click/core.py", line 1059, in main
    rv = self.invoke(ctx)
  File "/home/user/.pyenv/versions/3.8.10/envs/anime-downloader/lib/python3.8/site-packages/click/core.py", line 1665, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user/.pyenv/versions/3.8.10/envs/anime-downloader/lib/python3.8/site-packages/click/core.py", line 1401, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/.pyenv/versions/3.8.10/envs/anime-downloader/lib/python3.8/site-packages/click/core.py", line 767, in invoke
    return __callback(*args, **kwargs)
  File "/home/user/.pyenv/versions/3.8.10/envs/anime-downloader/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/user/anime-downloader/anime_downloader/commands/dl.py", line 109, in command
    anime_url, _ = util.search(anime_url, provider, choice)
  File "/home/user/anime-downloader/anime_downloader/util.py", line 94, in search
    cls = get_anime_class(provider)
  File "/home/user/anime-downloader/anime_downloader/sites/init.py", line 66, in get_anime_class
    if site[1] in url:
TypeError: argument of type 'NoneType' is not iterable

If I specify the provider, I am further not able to download the episode as it can't seem to find a suitable video quality. I won't share the full output because it is long and could be unrelated to this issue, but here is the last line of the traceback:

$ anime -ll DEBUG dl 'Naruto' -e 1 -fq "['720p', '480p', '360p']" -p twist.moe

...
File "/home/user/anime-downloader/anime_downloader/sites/anime.py", line 82, in __init__
    raise AnimeDLError(
anime_downloader.sites.exceptions.AnimeDLError: Quality None not found in ['360p', '480p', '720p', '1080p']

Testing if the site "works":

$ anime test
anime: anime-downloader 5.0.9

...
[36 of 39] Searching twist.moe... (CTRL-C to stop) : ✅ Works, anime found.

I tried deleting the config.json file between python versions to start fresh, and got the same results. I am also able to edit settings normally using the anime config command. If I had to take a gander at what is wrong, I would assume that the downloader portion of code isn't getting config file keypairs passed to it before calling @click.pass_context in commands/dl.py. I can see while debugging python that cli.py is able import and read keypairs from Config.CONTEXT_SETTINGS, however I am not at all familiar with click and I do not know how to debug it further than this.

ekrekeler commented 3 years ago

Today in the Discord server, someone mentioned to downgrade the click library from 8.0.0 to 7.1.2. I tried this and issue is resolved. It seems that the latest version of click breaks the ability to pass the settings between modules in anime-downloader.

For anyone who wants the workaround: pip install --force-reinstall -U click==7.1.2