update changelog/docs etc for new metadata feature
All checks were successful
ci/woodpecker/push/tests Pipeline was successful
All checks were successful
ci/woodpecker/push/tests Pipeline was successful
This commit is contained in:
parent
d7c3d511fe
commit
4d5b0f4dee
9 changed files with 81 additions and 18 deletions
|
@ -9,7 +9,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
- Add support for more sites
|
- Add support for more sites
|
||||||
|
|
||||||
## [2.2.21] - 2023-02-11
|
## [2.3.0] - 2023-02-11
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,10 @@ include *.properties
|
||||||
include *.py
|
include *.py
|
||||||
include *.txt
|
include *.txt
|
||||||
include *.yml
|
include *.yml
|
||||||
|
include *.xml
|
||||||
recursive-include contrib *.py
|
recursive-include contrib *.py
|
||||||
recursive-include mangadlp *.py
|
recursive-include mangadlp *.py
|
||||||
|
recursive-include mangadlp *.xml
|
||||||
recursive-include tests *.py
|
recursive-include tests *.py
|
||||||
|
recursive-include tests *.xml
|
||||||
recursive-include tests *.txt
|
recursive-include tests *.txt
|
||||||
|
|
|
@ -117,6 +117,7 @@ verbosity: [mutually_exclusive]
|
||||||
--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
|
--cache-path PATH Where to store the cache-db. If no path is given, cache is disabled
|
||||||
|
--add-metadata / --no-metadata Enable/disable creation of metadata via ComicInfo.xml [default: add-metadata]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contribution / Bugs
|
## Contribution / Bugs
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# api template for manga-dlp
|
# api template for manga-dlp
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
class YourAPI:
|
class YourAPI:
|
||||||
|
@ -97,21 +98,60 @@ class YourAPI:
|
||||||
The metadata as a dict
|
The metadata as a dict
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# metadata types. have to be correct to be valid
|
# metadata types. have to be valid
|
||||||
|
# {key: (type, default value, valid values)}
|
||||||
{
|
{
|
||||||
"Title": str,
|
"Title": (str, None, []),
|
||||||
"Series": str,
|
"Series": (str, None, []),
|
||||||
"Number": str,
|
"Number": (str, None, []),
|
||||||
"Count": int,
|
"Count": (int, None, []),
|
||||||
"Volume": int,
|
"Volume": (int, None, []),
|
||||||
"Summary": str,
|
"AlternateSeries": (str, None, []),
|
||||||
"Genre": str,
|
"AlternateNumber": (str, None, []),
|
||||||
"Web": str,
|
"AlternateCount": (int, None, []),
|
||||||
"PageCount": int,
|
"Summary": (str, None, []),
|
||||||
"LanguageISO": str,
|
"Notes": (
|
||||||
"Format": str,
|
str,
|
||||||
"ScanInformation": str,
|
"Downloaded with https://github.com/olofvndrhr/manga-dlp",
|
||||||
"SeriesGroup": str,
|
[],
|
||||||
|
),
|
||||||
|
"Year": (int, None, []),
|
||||||
|
"Month": (int, None, []),
|
||||||
|
"Day": (int, None, []),
|
||||||
|
"Writer": (str, None, []),
|
||||||
|
"Colorist": (str, None, []),
|
||||||
|
"Publisher": (str, None, []),
|
||||||
|
"Genre": (str, None, []),
|
||||||
|
"Web": (str, None, []),
|
||||||
|
"PageCount": (int, None, []),
|
||||||
|
"LanguageISO": (str, None, []),
|
||||||
|
"Format": (str, None, []),
|
||||||
|
"BlackAndWhite": (str, None, ["Yes", "No", "Unknown"]),
|
||||||
|
"Manga": (str, "Yes", ["Yes", "No", "Unknown", "YesAndRightToLeft"]),
|
||||||
|
"ScanInformation": (str, None, []),
|
||||||
|
"SeriesGroup": (str, None, []),
|
||||||
|
"AgeRating": (
|
||||||
|
str,
|
||||||
|
None,
|
||||||
|
[
|
||||||
|
"Unknown",
|
||||||
|
"Adults Only 18+",
|
||||||
|
"Early Childhood",
|
||||||
|
"Everyone",
|
||||||
|
"Everyone 10+",
|
||||||
|
"G",
|
||||||
|
"Kids to Adults",
|
||||||
|
"M",
|
||||||
|
"MA15+",
|
||||||
|
"Mature 17+",
|
||||||
|
"PG",
|
||||||
|
"R18+",
|
||||||
|
"Rating Pending",
|
||||||
|
"Teen",
|
||||||
|
"X18+",
|
||||||
|
],
|
||||||
|
),
|
||||||
|
"CommunityRating": (int, None, [1, 2, 3, 4, 5]),
|
||||||
}
|
}
|
||||||
|
|
||||||
# example
|
# example
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
└── <download path>/
|
└── <download path>/
|
||||||
└── <manga title>/
|
└── <manga title>/
|
||||||
└── <chapter title>/
|
└── <chapter title>/
|
||||||
|
└── ComicInfo.xml (optional)
|
||||||
|
└── 001.png
|
||||||
|
└── 002.png
|
||||||
|
└── etc.
|
||||||
```
|
```
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
@ -167,3 +171,12 @@ chapters will be
|
||||||
tracked there, and the script doesn't have to check on disk if you already downloaded it.
|
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.
|
If the option is unset (default), then no caching will be done.
|
||||||
|
|
||||||
|
## Add metadata
|
||||||
|
|
||||||
|
manga-dlp supports the creation of metadata files in the downloaded chapter.
|
||||||
|
The metadata is based on the newer [ComicRack/Anansi](https://anansi-project.github.io/docs/introduction) standard.
|
||||||
|
The default option is to add the metadata in the folder/archive with the name `ComicInfo.xml`.
|
||||||
|
If you don't want metadata, you can pass the `--no-metadata` flag.
|
||||||
|
|
||||||
|
> pdf format does not support metadata at the moment
|
|
@ -115,6 +115,7 @@ verbosity: [mutually_exclusive]
|
||||||
--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
|
--cache-path PATH Where to store the cache-db. If no path is given, cache is disabled
|
||||||
|
--add-metadata / --no-metadata Enable/disable creation of metadata via ComicInfo.xml [default: add-metadata]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contribution / Bugs
|
## Contribution / Bugs
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "2.2.21"
|
__version__ = "2.3.0"
|
||||||
|
|
|
@ -4,8 +4,10 @@ from typing import Any
|
||||||
import xmltodict
|
import xmltodict
|
||||||
from loguru import logger as log
|
from loguru import logger as log
|
||||||
|
|
||||||
|
METADATA_FILENAME = "ComicInfo.xml"
|
||||||
METADATA_TEMPLATE = Path("mangadlp/metadata/ComicInfo_v2.0.xml")
|
METADATA_TEMPLATE = Path("mangadlp/metadata/ComicInfo_v2.0.xml")
|
||||||
# define metadata types and valid values. an empty list means no value check
|
# define metadata types, defaults and valid values. an empty list means no value check
|
||||||
|
# {key: (type, default value, valid values)}
|
||||||
METADATA_TYPES: dict[str, tuple[type, Any, list]] = {
|
METADATA_TYPES: dict[str, tuple[type, Any, list]] = {
|
||||||
"Title": (str, None, []),
|
"Title": (str, None, []),
|
||||||
"Series": (str, None, []),
|
"Series": (str, None, []),
|
||||||
|
@ -105,7 +107,7 @@ def write_metadata(chapter_path: Path, metadata: dict) -> None:
|
||||||
log.warning("Can't add metadata for pdf format. Skipping")
|
log.warning("Can't add metadata for pdf format. Skipping")
|
||||||
return
|
return
|
||||||
|
|
||||||
metadata_file = chapter_path / "ComicInfo.xml"
|
metadata_file = chapter_path / METADATA_FILENAME
|
||||||
|
|
||||||
log.debug(f"Metadata items: {metadata}")
|
log.debug(f"Metadata items: {metadata}")
|
||||||
metadata_valid = validate_metadata(metadata)
|
metadata_valid = validate_metadata(metadata)
|
||||||
|
|
|
@ -30,6 +30,7 @@ dependencies = [
|
||||||
"loguru>=0.6.0",
|
"loguru>=0.6.0",
|
||||||
"click>=8.1.3",
|
"click>=8.1.3",
|
||||||
"click-option-group>=0.5.5",
|
"click-option-group>=0.5.5",
|
||||||
|
"xmltodict>=0.13.0"
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
@ -60,6 +61,8 @@ dependencies = [
|
||||||
"loguru>=0.6.0",
|
"loguru>=0.6.0",
|
||||||
"click>=8.1.3",
|
"click>=8.1.3",
|
||||||
"click-option-group>=0.5.5",
|
"click-option-group>=0.5.5",
|
||||||
|
"xmltodict>=0.13.0",
|
||||||
|
"xmlschema>=2.2.1",
|
||||||
"img2pdf>=0.4.4",
|
"img2pdf>=0.4.4",
|
||||||
"hatch>=1.6.0",
|
"hatch>=1.6.0",
|
||||||
"hatchling>=1.11.0",
|
"hatchling>=1.11.0",
|
||||||
|
|
Loading…
Reference in a new issue