mansuf / mangadex-downloader

A command-line tool to download manga from MangaDex, written in Python.
https://mangadex-dl.mansuf.link/
MIT License
472 stars 37 forks source link

"cover:url" fails on v2.10.2 #82

Closed snarkyyy closed 1 year ago

snarkyyy commented 1 year ago

What happened ?

$ mangadex-dl "cover:https://mangadex.org/title/a6bfedbc-9846-4a97-9fcb-77a426d978e6/ubunchu" 
[ERROR] Unhandled exception, AttributeError: 'NoneType' object has no attribute 'id'
Traceback (most recent call last):
  File "./mangadex-downloader/mangadex_downloader/cli/__init__.py", line 73, in _main
    build_url(parser, args)
  File "./mangadex-downloader/mangadex_downloader/cli/url.py", line 238, in build_url
    result = command.prompt(args.input_pos)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./mangadex-downloader/mangadex_downloader/cli/command.py", line 654, in prompt
    result = super().prompt(input_pos)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./mangadex-downloader/mangadex_downloader/cli/command.py", line 273, in prompt
    return [answer.id]
            ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'

I consistently get this error even with different urls.

What did you expect to happen ?

prompt which covers to download

OS version

Linux

App version

mangadex-downloader v2.10.2 (https://github.com/mansuf/mangadex-downloader) Python: 3.11.3 arch: x64 bundled executable: no

Installation origin

git clone && python setup.py install

Installation origin (other sources)

No response

Reproducible command

mangadex-dl "cover:https://mangadex.org/title/a6bfedbc-9846-4a97-9fcb-77a426d978e6/ubunchu"

Additional context

The command works when I'm checked out on older version (v2.9.0) , which was the version that introduced the "cover:" feature.

mansuf commented 1 year ago

Starting from v2.10.x volume covers locale are now following --language value by default. It seems the manga didn't have English covers so it should throw error. But i forgot to put error handler for "cover" command for this case. Sorry about that.

NOTE: If you set --volume-cover-language, the covers will looking for locale from --volume-cover-language instead of --language

I've made PR #83 to fix this, you can test it by installing development version.

Installation with git + pip:

pip uninstall mangadex-downloader
pip install git+https://github.com/mansuf/mangadex-downloader.git@6d4e93b6acd104ca03bdc23d81c91bd7f3a7314e

Let me know if you have problem during installing and testing this patch 😉


If you want to show all covers, you can use all language

For example:

mangadex-dl "cover:https://mangadex.org/title/a6bfedbc-9846-4a97-9fcb-77a426d978e6/ubunchu" --language "all"
snarkyyy commented 1 year ago

Thanks for a quick reply, I tested the patch and it seems to work