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

Do not change Date Modified if there's no new files added #89

Closed RedWhiteMiko closed 8 months ago

RedWhiteMiko commented 12 months ago

The idea

When all files are verified and there is no need to re-download, the Date Modified for the folder still changes since download.db is modified.

This make hard to know if there's any new chapter or not in a directory.

Why this feature should be added to the app ?

By not modifying download.db when there's no need to, user can sort the directory by Time Modified to know if there's new chapter added.

mansuf commented 11 months ago

I consider this as a bug. When initializing database for tracker, the database checks if the file is locked or not, so we can write the data on it. I implemented some checks that will cause to write some data to ensure that the database is not locked.

https://github.com/mansuf/mangadex-downloader/blob/a569e8c842ba1d1635a9ab5e80749c61adf50f2c/mangadex_downloader/tracker/sqlite.py#L97-L118

This bug is caused by https://github.com/mansuf/mangadex-downloader/issues/52. I will add this on v3.0.0 to-do list

mansuf commented 8 months ago

This issue has been fixed in v3.0.0 branch (commit https://github.com/mansuf/mangadex-downloader/commit/d607fa58686220eee4018c06427b95c783dae8be).

MINGW64 /d/mangadex-downloader (v3.0.0)
$ ls /d/Manga/Tamamo\ no\ Koi/English/

MINGW64 /d/mangadex-downloader (v3.0.0)
$ python -m mangadex_downloader "tamamo no koi" -s --input-pos 1 -uci --start-chapter 1 --end-chapter 1 --no-oneshot-chapter --start-page 1 --end-page 5 -f raw-single --log-level ERROR
File sizes: 100%|████████████████████████████| 260k/260k [00:00<00:00, 3.18MB/s]
File sizes: 100%|████████████████████████████| 137k/137k [00:00<00:00, 13.6MB/s]
File sizes: 100%|████████████████████████████| 234k/234k [00:00<00:00, 12.2MB/s]
File sizes: 100%|████████████████████████████| 233k/233k [00:00<00:00, 11.6MB/s]
File sizes: 100%|████████████████████████████| 174k/174k [00:00<00:00, 12.8MB/s]
File sizes: 100%|████████████████████████████| 154k/154k [00:00<00:00, 12.8MB/s]

MINGW64 /d/mangadex-downloader (v3.0.0)
$ ls /d/Manga/Tamamo\ no\ Koi/English/
'Ch. 1 - Ch. 1'/   cover.jpg   download.db

MINGW64 /d/mangadex-downloader (v3.0.0)
$ python -c "import os; print(os.stat('/Manga/Tamamo no Koi/English').st_mtime)"
1702981666.6400971

MINGW64 /d/mangadex-downloader (v3.0.0)
$ python -m mangadex_downloader "tamamo no koi" -s --input-pos 1 -uci --start-chapter 1 --end-chapter 1 --no-oneshot-chapter --start-page 1 --end-page 5 -f raw-single --log-level ERROR

MINGW64 /d/mangadex-downloader (v3.0.0)
$ python -c "import os; print(os.stat('/Manga/Tamamo no Koi/English').st_mtime)"
1702981666.6400971

You can test it yourself by installing patched version.

Installation guide

If you have git, you can use git with pip:

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

If you're installing mangadex-downloader from github releases, you can download the development version in here:

https://github.com/mansuf/mangadex-downloader/actions/runs/7260431915

The download files are available in "artifacts" section

If you have a problem or issue, just let me know 👍