These are Python scripts designed to bridge the gap between .CBZ manga automatically downloaded from FMD2 and indexing by Komf for Kavita.
The Manga Metadata Fixer is a Python script designed to automatically add basic metadata to your manga library by generating ComicInfo.xml files for .cbz archives. It works seamlessly with manga management tools like Komf and Kavita, bridging the gap for missing metadata in your library.
The script scans your manga library, processes .cbz files, and ensures that every manga archive has a ComicInfo.xml file containing the series name, title, and other necessary metadata.
- Automatically scans your manga library.
- Adds
ComicInfo.xmlto.cbzfiles that don't have it. - Tracks processed files using an SQLite database to avoid reprocessing.
- Handles large libraries by processing files in batches and periodically updating the database.
- Displays a simple text-based progress bar to show the status of the scan.
Note: For the "First Run" script only.
- Python 3.x
zipfileandsqlite3(included in Python's standard library)
The program works out-of-the-box without any external dependencies.
- Download the scripts and place them in a directory.
- Ensure that your manga library is accessible and organized.
- Make sure your
.cbzfiles are properly named, and the folder name containing them matches the manga title. (FMD2 does this automatically.)
The script will look for a file called Manga Library Location in the same directory to determine the path to your manga library. If the file does not exist, it will prompt you to enter the directory path.
An SQLite database (processed_files.db) is used to track which files have been processed, preventing redundant operations.
- Place the script in any directory.
- Run the script in the terminal or command prompt.
If you have never run the script before, use the "First Run" script to build your database (it’s much faster).
On the first run, the script will initialize the database and begin scanning your manga library. If the database already exists, the script will skip previously processed files and only process new ones. The script will display a progress bar showing the percentage of files processed.
The main script will loop and scan every 5 minutes, whereas the "First Run" script will close when finished. Both scripts can build the database, but one is optimized for speed while the other is better suited for continuous monitoring.
- The script scans all
.cbzfiles in your manga library. - For each
.cbzfile that does not already contain aComicInfo.xml, the script generates a basic XML file with metadata such as the series name and title. - The script updates the SQLite database to mark the file as processed.
The program supports large libraries and can process files in batches to improve performance.
- Log File: All actions are logged in a file called
process_log.txtin the script directory. The log file is deleted and recreated if it gets too large. - Database: The script uses an SQLite database (
processed_files.db) to track processed files and ensure they aren’t processed again. - Journal Files: If the script is interrupted unexpectedly, journal files (
.db-journal) may be left behind. The script cleans these up at startup to prevent issues.
This script is free to use for personal purposes. It is provided "as is" with no warranty or guarantee. When using tools like this with Komf/Kavita/FMD2 together, a lot can happen, so testing is strongly advised before using it on your main manga library. (You can always delete or change the location file in the script directory.)