anime-downloader icon indicating copy to clipboard operation
anime-downloader copied to clipboard

--fallback-qualities parameter shows error

Open lakshya076 opened this issue 4 years ago • 6 comments

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.

lakshya076 avatar Feb 26 '21 14:02 lakshya076

--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"
        ],

Blatzar avatar Mar 01 '21 22:03 Blatzar

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

image

lakshya076 avatar Mar 03 '21 07:03 lakshya076

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

Blatzar avatar Mar 03 '21 12:03 Blatzar

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

lakshya076 avatar Mar 08 '21 07:03 lakshya076

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 avatar May 17 '21 02:05 ekrekeler

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

ekrekeler avatar May 19 '21 00:05 ekrekeler