This commit is contained in:
parent
70b56a2d55
commit
58548f2c8a
5 changed files with 39 additions and 19 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -9,6 +9,16 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
- Add support for more sites
|
- Add support for more sites
|
||||||
|
|
||||||
|
## [2.2.19] - 2023-02-XX
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- First version of the chapter cache (very basic functionality)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Simplified chapter download loop
|
||||||
|
|
||||||
## [2.2.18] - 2023-01-21
|
## [2.2.18] - 2023-01-21
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
10
README.md
10
README.md
|
@ -96,27 +96,27 @@ Script to download mangas from various sites
|
||||||
Options:
|
Options:
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
--version Show the version and exit.
|
--version Show the version and exit.
|
||||||
|
|
||||||
source: [mutually_exclusive, required]
|
source: [mutually_exclusive, required]
|
||||||
-u, --url, --uuid TEXT URL or UUID of the manga
|
-u, --url, --uuid TEXT URL or UUID of the manga
|
||||||
--read FILE Path of file with manga links to download. One per line
|
--read FILE Path of file with manga links to download. One per line
|
||||||
|
|
||||||
verbosity: [mutually_exclusive]
|
verbosity: [mutually_exclusive]
|
||||||
--loglevel INTEGER Custom log level [default: 20]
|
--loglevel INTEGER Custom log level
|
||||||
--warn Only log warnings and higher
|
--warn Only log warnings and higher
|
||||||
--debug Debug logging. Log EVERYTHING
|
--debug Debug logging. Log EVERYTHING
|
||||||
|
|
||||||
-c, --chapters TEXT Chapters to download
|
-c, --chapters TEXT Chapters to download
|
||||||
-p, --path PATH Download path [default: downloads]
|
-p, --path PATH Download path [default: downloads]
|
||||||
-l, --language TEXT Manga language [default: en]
|
-l, --language TEXT Manga language [default: en]
|
||||||
--list List all available chapters
|
--list List all available chapters
|
||||||
--format TEXT Archive format to create. An empty string means dont archive the folder [default: cbz]
|
--format [cbz|cbr|zip|pdf|] Archive format to create. An empty string means dont archive the folder [default: cbz]
|
||||||
|
--name-format TEXT Naming format to use when saving chapters. See docs for more infos [default: {default}]
|
||||||
|
--name-format-none TEXT String to use when the variable of the custom name format is empty
|
||||||
--forcevol Force naming of volumes. For mangas where chapters reset each volume
|
--forcevol Force naming of volumes. For mangas where chapters reset each volume
|
||||||
--wait FLOAT Time to wait for each picture to download in seconds(float) [default: 0.5]
|
--wait FLOAT Time to wait for each picture to download in seconds(float) [default: 0.5]
|
||||||
--hook-manga-pre TEXT Commands to execute before the manga download starts
|
--hook-manga-pre TEXT Commands to execute before the manga download starts
|
||||||
--hook-manga-post TEXT Commands to execute after the manga download finished
|
--hook-manga-post TEXT Commands to execute after the manga download finished
|
||||||
--hook-chapter-pre TEXT Commands to execute before the chapter download starts
|
--hook-chapter-pre TEXT Commands to execute before the chapter download starts
|
||||||
--hook-chapter-post TEXT Commands to execute after the chapter download finished
|
--hook-chapter-post TEXT Commands to execute after the chapter download finished
|
||||||
|
--cache-path PATH Where to store the cache-db. If no path is given, cache is disabled
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contribution / Bugs
|
## Contribution / Bugs
|
||||||
|
|
|
@ -159,3 +159,11 @@ link3
|
||||||
`python3 manga-dlp.py --read mangas.txt --list`
|
`python3 manga-dlp.py --read mangas.txt --list`
|
||||||
|
|
||||||
This will list all available chapters for link1, link2 and link3.
|
This will list all available chapters for link1, link2 and link3.
|
||||||
|
|
||||||
|
## Create basic cache
|
||||||
|
|
||||||
|
With the `--cache-path <cache file>` option you can let the script create a very basic json cache. Your downloaded
|
||||||
|
chapters will be
|
||||||
|
tracked there, and the script doesn't have to check on disk if you already downloaded it.
|
||||||
|
|
||||||
|
If the option is unset (default), then no caching will be done.
|
||||||
|
|
|
@ -94,27 +94,27 @@ Script to download mangas from various sites
|
||||||
Options:
|
Options:
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
--version Show the version and exit.
|
--version Show the version and exit.
|
||||||
|
|
||||||
source: [mutually_exclusive, required]
|
source: [mutually_exclusive, required]
|
||||||
-u, --url, --uuid TEXT URL or UUID of the manga
|
-u, --url, --uuid TEXT URL or UUID of the manga
|
||||||
--read FILE Path of file with manga links to download. One per line
|
--read FILE Path of file with manga links to download. One per line
|
||||||
|
|
||||||
verbosity: [mutually_exclusive]
|
verbosity: [mutually_exclusive]
|
||||||
--loglevel INTEGER Custom log level [default: 20]
|
--loglevel INTEGER Custom log level
|
||||||
--warn Only log warnings and higher
|
--warn Only log warnings and higher
|
||||||
--debug Debug logging. Log EVERYTHING
|
--debug Debug logging. Log EVERYTHING
|
||||||
|
|
||||||
-c, --chapters TEXT Chapters to download
|
-c, --chapters TEXT Chapters to download
|
||||||
-p, --path PATH Download path [default: downloads]
|
-p, --path PATH Download path [default: downloads]
|
||||||
-l, --language TEXT Manga language [default: en]
|
-l, --language TEXT Manga language [default: en]
|
||||||
--list List all available chapters
|
--list List all available chapters
|
||||||
--format TEXT Archive format to create. An empty string means dont archive the folder [default: cbz]
|
--format [cbz|cbr|zip|pdf|] Archive format to create. An empty string means dont archive the folder [default: cbz]
|
||||||
|
--name-format TEXT Naming format to use when saving chapters. See docs for more infos [default: {default}]
|
||||||
|
--name-format-none TEXT String to use when the variable of the custom name format is empty
|
||||||
--forcevol Force naming of volumes. For mangas where chapters reset each volume
|
--forcevol Force naming of volumes. For mangas where chapters reset each volume
|
||||||
--wait FLOAT Time to wait for each picture to download in seconds(float) [default: 0.5]
|
--wait FLOAT Time to wait for each picture to download in seconds(float) [default: 0.5]
|
||||||
--hook-manga-pre TEXT Commands to execute before the manga download starts
|
--hook-manga-pre TEXT Commands to execute before the manga download starts
|
||||||
--hook-manga-post TEXT Commands to execute after the manga download finished
|
--hook-manga-post TEXT Commands to execute after the manga download finished
|
||||||
--hook-chapter-pre TEXT Commands to execute before the chapter download starts
|
--hook-chapter-pre TEXT Commands to execute before the chapter download starts
|
||||||
--hook-chapter-post TEXT Commands to execute after the chapter download finished
|
--hook-chapter-post TEXT Commands to execute after the chapter download finished
|
||||||
|
--cache-path PATH Where to store the cache-db. If no path is given, cache is disabled
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contribution / Bugs
|
## Contribution / Bugs
|
||||||
|
|
|
@ -15,14 +15,16 @@ class CacheDB:
|
||||||
self._prepare()
|
self._prepare()
|
||||||
|
|
||||||
self.db_data = self.read_db()
|
self.db_data = self.read_db()
|
||||||
|
# create db key entry if not found
|
||||||
if not self.db_data.get(self.db_key):
|
if not self.db_data.get(self.db_key):
|
||||||
self.db_data[self.db_key] = {}
|
self.db_data[self.db_key] = {}
|
||||||
self.db_uuid_data: dict = self.db_data[self.db_key]
|
self.db_uuid_data: dict = self.db_data[self.db_key]
|
||||||
self.db_uuid_chapters: list = self.db_uuid_data.get("chapters") or []
|
self.db_uuid_chapters: list = self.db_uuid_data.get("chapters") or []
|
||||||
|
|
||||||
def _prepare(self):
|
def _prepare(self):
|
||||||
if self.db_path.exists() and self.db_path.is_file():
|
if self.db_path.exists():
|
||||||
return
|
return
|
||||||
|
# create empty cache
|
||||||
try:
|
try:
|
||||||
self.db_path.touch()
|
self.db_path.touch()
|
||||||
self.db_path.write_text(json.dumps({}), encoding="utf8")
|
self.db_path.write_text(json.dumps({}), encoding="utf8")
|
||||||
|
|
Loading…
Reference in a new issue