Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #80
RedWhiteMiko opened this issue Sep 9, 2023 · 2 comments
Closed
Tracked by #80

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

RedWhiteMiko opened this issue Sep 9, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@RedWhiteMiko
Copy link

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.

@RedWhiteMiko RedWhiteMiko added the enhancement New feature or request label Sep 9, 2023
@mansuf
Copy link
Owner

mansuf commented Sep 29, 2023

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.

def _check_db_locked(self):
if config.no_track:
return False
# https://github.com/mansuf/mangadex-downloader/issues/52
db = sqlite3.connect(**self._kwargs_sqlite_con)
with self._lock:
try:
db.execute("CREATE TABLE IF NOT EXISTS 'test' ('test' TEXT NOT NULL)")
db.execute("INSERT INTO 'test' ('test') VALUES ('123')")
db.commit()
db.execute("DROP TABLE 'test'")
db.commit()
db.close()
except sqlite3.OperationalError as e:
msg = str(e)
if "database is locked" in msg:
return True
finally:
db.close()
return False

This bug is caused by #52. I will add this on v3.0.0 to-do list

@mansuf mansuf added bug Something isn't working and removed enhancement New feature or request labels Sep 29, 2023
@mansuf mansuf mentioned this issue Sep 4, 2023
29 tasks
@mansuf
Copy link
Owner

mansuf commented Dec 19, 2023

This issue has been fixed in v3.0.0 branch (commit d607fa5).

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 👍

@mansuf mansuf closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants