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

Option to download volumes as volumes but the rest as chapters #77

Closed Razzeli closed 5 months ago

Razzeli commented 1 year ago

The idea

I would like an option to download volumes as volumes, like it is currently doing for example with "--save-as cbz-volume", but the rest of the chapters not in volumes (yet), would be downloaded separately like with "--save-as cbz" would do.

So instead of having Vol 1.cbz, Vol 2.cbz, Vol 3.cbz, and then No Volume.cbz which includes all the mixed stuff not included in volumes, like old extras and new chapters which haven't been assigned to volumes yet mixed together, they would instead be downloaded as separate chapters.

So I would like they would be downloaded like in the second picture (chapters could be downloaded to root or for example to Chapters folder), instead of the first picture, or one with where all volumes are as single chapters.

Sure I can achieve that by running the command two separate times as "--save-as cbz-volume" and then later another time with "--save-as cbz" and then deleting the duplicate files not in format I'd like, but I'd prefer if I could do that as a single command.

Näyttökuva 2023-06-20 084314

Näyttökuva 2023-06-20 084447

I tried to search if this is already possible, but I could not find an option to do this at least. Sorry if that is already the case.

Why this feature should be added to the app ?

Would make it easier to know what to read and when while keeping the volume format, instead of having to guess what is included in the "No Volume.cbz" file.

mansuf commented 1 year ago

Hmmmmmm, i'm thinking additional format options that users can put in to customize each formats. So in this case, it would be like:

mangadex-dl "insert MangaDex URL here" --format-options "create_no_volume=false"

Is that okay with you ?

Razzeli commented 1 year ago

Yes, that sound great!

mansuf commented 1 year ago

Nice, this feature is planned to be added in v3.0.0. But i cannot guarantee when v3.0.0 is out, because there is no ETA and it's still very early work in progress.

mansuf commented 5 months ago

Hello, the feature has been added in commit 1e404ec (v3.0.0 branch). Sorry for waiting too long, i don't have motivation in the past working on this project, hopefully in the future i will keep maintenance for this project though.

You can try the feature by installing the development version:

If you install mangadex-downloader from Github Release, you can download it from this link (in "artifacts" section)

If you installing mangadex-downloader from PyPI (Python Package Index)

Note: You will need git before doing this

pip uninstall mangadex-downloader
pip install -U git+https://github.com/mansuf/mangadex-downloader.git@bdf7afe1384a81788846b396f8415d96ed81b04b
Razzeli commented 5 months ago

Hi and thank you for adding this feature! I sent a couple cups of coffee to your way.

However I'm having a problem with this, when I try to use this feature using for example a text file including two or more mangas. Let me know if I'm doing something wrong.

The first manga downloads correctly, with volumes and chapters separately when the chapters are not (yet) included in any volumes, but I get an error message when it tries to download the second manga, probably because it switches from cbz-volume to cbz to download the chapters in first one, it doesn't seem to change back to cbz-volume before trying to download the second manga, and my config file has changed to show "save_as":"cbz" instead of cbz-volume like it was in the beginning when it crashes.

Here is the test.txt file contents for the two test mangas, which causes crash for me during the second one, I selected mangas which both include volumes and chapters to test the new feature:

https://mangadex.org/title/92542740-1ed9-46e0-a04d-661c41f22331/the-onee-san-who-just-wanted-to-say https://mangadex.org/title/f093706a-f96a-4bef-8ef1-d1db1fa8a7c1/hazure-skill-kinomi-master

The config file is as follows when starting the test:

mangadex-dl "conf"

Config 'login_cache' is set to False
Config 'language' is set to 'en'
Config 'cover' is set to 'none'
Config 'save_as' is set to 'cbz-volume'
Config 'use_chapter_title' is set to False
Config 'use_compressed_image' is set to False
Config 'force_https' is set to False
Config 'path' is set to 'Y:\\Test_Mangadex\\{manga.title}'
Config 'filename_chapter' is set to '{manga.title} {chapter.simple_name}{file_ext}'
Config 'filename_volume' is set to '{manga.title} Vol. {volume}{file_ext}'
Config 'filename_single' is set to 'All chapters{file_ext}'
Config 'dns_over_https' is set to None
Config 'no_group_name' is set to True
Config 'sort_by' is set to 'volume'
Config 'no_progress_bar' is set to False
Config 'http_retries' is set to 5
Config 'write_tachiyomi_info' is set to False
Config 'download_mode' is set to 'default'
Config 'use_chapter_cover' is set to False
Config 'use_volume_cover' is set to True
Config 'no_track' is set to False
Config 'volume_cover_language' is set to 'ja'
Config 'stacked_progress_bar_order' is set to 'volumes, chapters, pages, file sizes, convert'
Config 'log_level' is set to 'INFO'
Config 'progress_bar_layout' is set to 'default'
Config 'ignore_missing_chapters' is set to False
Config 'create_no_volume' is set to False

and the command to run the program is:

mangadex-dl "test.txt" --delay-requests 0.5

and the error message I receive at the start of the second manga is:

[ERROR] Unhandled exception, OperationalError: no such table: file_info_cbz_volume
Traceback (most recent call last):
  File "mangadex_downloader\cli\__init__.py", line 87, in _main
  File "mangadex_downloader\cli\download.py", line 34, in download
  File "mangadex_downloader\cli\url.py", line 187, in __call__
  File "mangadex_downloader\cli\url.py", line 105, in download_manga
  File "mangadex_downloader\main.py", line 193, in download
  File "mangadex_downloader\main.py", line 131, in download_manga
  File "mangadex_downloader\tracker\__init__.py", line 162, in get_tracker
  File "mangadex_downloader\tracker\sqlite.py", line 81, in __init__
  File "mangadex_downloader\tracker\sqlite.py", line 99, in init_write_mode
  File "mangadex_downloader\tracker\sqlite.py", line 388, in _load
  File "mangadex_downloader\tracker\sql_migrations\__init__.py", line 33, in migrate
    migrate_cls.migrate()
  File "C:\Sekalaiset pikkuprogut\mangadex-dl_x64\_internal\mangadex_downloader\tracker\sql_migrations\00001_add_table_db_info_and_alter_table_file_info.py", line 143, in migrate
    cursor.execute(f"SELECT {column_name} FROM {table}")
sqlite3.OperationalError: no such table: file_info_cbz_volume

and from the config.json file, the "save as" has changed from cbz-volume to cbz.

mansuf commented 5 months ago

Hi and thank you for adding this feature! I sent a couple cups of coffee to your way.

Thank you so much 💖.

probably because it switches from cbz-volume to cbz to download the chapters in first one, it doesn't seem to change back to cbz-volume before trying to download the second manga, and my config file has changed to show "save_as":"cbz" instead of cbz-volume like it was in the beginning when it crashes.

I was forgot to turn it back the original save_as config when switching to cbz, sorry about that. I have provide a patch https://github.com/mansuf/mangadex-downloader/commit/b8cc5c4ce5ee470a78f1388af5a1eec4af240e9b for that, you can try it now !

Link download: https://github.com/mansuf/mangadex-downloader/actions/runs/8447198933 (available once it show success status)

If you have any problem again, please let me know.