Metron-Tagger
Quick Description
A command-line tool to tag comic archives with metadata from metron.cloud.
Installation
PyPi
Or install it yourself:
pipx install metron-tagger
There are optional dependencies which can be installed by specifying one or more of them in braces e.g. metron-tagger[7zip]
The optional dependencies are:
- 7zip: Provides support for reading/writing to CB7 files.
- pdf: Provides support for reading/writing to PDF files.
- redis: Provides a Redis-backed rate limiter for the Metron API.
FAQ
How do I use the Redis rate limiter?
-
Install the
redisextra (e.g.pipx install metron-tagger[redis]), and setredis_urlin the[metron]section of yoursettings.ini:[metron] redis_url = redis://localhost:6379/0
Every metron-tagger process using the same Metron account and Redis server will then share one rate limit, so running several at once won't exceed Metron's limits. If Redis can't be reached, metron-tagger falls back to its local rate limiter. If Redis fails partway through a run, metron-tagger stops processing the remaining files.
How do I share the rate limit with other mokkari-based software?
-
Other software using mokkari's
RedisRateLimiterwill share metron-tagger's rate limit as long as it uses the same Redis server and database, mokkari's defaultkey_prefix(mokkari:ratelimit), and the sameaccountname. metron-tagger derives theaccountname from your Metron credentials:- With an API token:
token-followed by the first 16 hex characters of the token's SHA-256 hash. The token itself is never used, since the account name appears in Redis key names. - With a username and password (deprecated): the username.
For example:
import hashlib from mokkari.redis_rate_limit import RedisRateLimiter account = f"token-{hashlib.sha256(api_token.encode()).hexdigest()[:16]}" rate_limiter = RedisRateLimiter(redis_client, account)
- With an API token:
What comics formats are supported?
- Metron-Tagger supports CBZ, CBR, CBT, CB7 (optional), and PDF (optional) comics.
How to enable RAR support?
- It depends on the unrar command-line utility, and expects it to be in your
$PATH.
NOTE: unrar only supports reading archives, so you will need to convert the archive to a cbz to write to it. To do so you can use
-z, --export-to-cbzand if you want you can remove the orginal .cbr archive with--delete-originalafter successful conversion.
Help
usage: metron-tagger [-h] [-r] [-o] [-m] [-c] [--id ID] [-d] [--ignore-existing] [--accept-only] [--skip-multiple] [--ignore-modified] [--missing] [-s] [-z] [--validate] [--remove-non-valid] [--delete-original] [--duplicates] [--migrate] [--version]
path [path ...]
Read in a file or set of files, and return the result.
positional arguments:
path Path of a file or a folder of files.
options:
-h, --help show this help message and exit
-r, --rename Rename comic archive from the files metadata. (default: False)
-o, --online Search online and attempt to identify comic archive. (default: False)
-m, --metroninfo Write, delete, or validate MetronInfo.xml. (default: False)
-c, --comicinfo Write, delete, or validate ComicInfo.xml. (default: False)
--id ID Identify file for tagging with the Metron Issue Id, or restrict directory matches to issues from a specific Metron Series Id. (default: None)
-d, --delete Delete the metadata tags from the file. (default: False)
--ignore-existing Ignore files that have existing metadata tag. (default: False)
--accept-only Automatically accept the match when exactly one valid match is found. (default: False)
--skip-multiple Skip files that have multiple matches instead of prompting for selection. (default: False)
--ignore-modified Retag files with an existing Metron ID without using the last modified date, forcing a full refresh from the API. Useful for pulling in changes, such as an updated community rating, that don't update the issue's modified date. (default: False)
--missing List files without metadata. (default: False)
-s, --sort Sort files that contain metadata tags. (default: False)
-z, --export-to-cbz Export a CBR (rar) archive to a CBZ (zip) archive. (default: False)
--validate Verify that comic archive has a valid metadata xml. (default: False)
--remove-non-valid Remove metadata xml from comic if not valid. Used with --validate option (default: False)
--delete-original Delete the original archive after successful export to another format. (default: False)
--duplicates Identify and give the option to delete duplicate pages in a directory of comics. (Experimental) (default: False)
--migrate Migrate information from a ComicInfo.xml into a *new* MetronInfo.xml (default: False)
--version Show the version number and exit
Examples
To tag all comics in a directory with MetronInfo.xml that don't already have one:
metron-tagger -om --ignore-existing /path/to/comics
To remove any ComicInfo.xml from a directory of comics:
metron-tagger -dc /path/to/comics
To validate any metadata, ComicInfo.xml and MetronInfo.xml, would be done by running the following:
metron-tagger -cm --validate /path/to/comics
To write MetronInfo.xml metadata from comics with ComicInfo.xml data, and migrate data for comics that don't exist at the Metron Comic Database:
metron-tagger -om --migrate /path/to/comics
To remove duplicate pages from comics (which should be only ran on a directory of weekly release since we scan all the pages within a comic), would be done by running the following:
metron-tagger --duplicates /path/to/weekly/comics
Bugs/Requests
Please use the GitHub issue tracker to submit bugs or request features.
License
This project is licensed under the GPLv3 License.
Metadata
Release files for metron-tagger 4.17.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| metron_tagger-4.17.0.tar.gz | 78.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| metron_tagger-4.17.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 135.2 kB
Release files / metron_tagger-4.17.0.tar.gz
| Download URL | metron_tagger-4.17.0.tar.gz |
|---|---|
| Size | 78.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
293f564a03969b87743d520b3db92108ff30756ed180a12639801604cf31f11d
|
|
BLAKE2b-256 checksum How to use checksums |
c58140b50aef9b92e2f893f5c04db23c45b14e29b4a46f01f541c6e4a1e6b593
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / metron_tagger-4.17.0-py3-none-any.whl
| Download URL | metron_tagger-4.17.0-py3-none-any.whl |
|---|---|
| Size | 56.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2091a80852108a87f01ec06143d5508ef2e9574424e9ccf7006894bd4c618be9
|
|
BLAKE2b-256 checksum How to use checksums |
84816abc75326b772acd6cd35087856f15e03503d0d07adc2b4cc0f01380274d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|