Skip to content

hdshock/MangaMetadataFixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Manga Metadata Fixer

These are Python scripts designed to bridge the gap between .CBZ manga automatically downloaded from FMD2 and indexing by Komf for Kavita.

Purpose

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.

Features

  • Automatically scans your manga library.
  • Adds ComicInfo.xml to .cbz files 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.

Requirements

  • Python 3.x
  • zipfile and sqlite3 (included in Python's standard library)

The program works out-of-the-box without any external dependencies.

Installation

  1. Download the scripts and place them in a directory.
  2. Ensure that your manga library is accessible and organized.
  3. Make sure your .cbz files are properly named, and the folder name containing them matches the manga title. (FMD2 does this automatically.)

Setup

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.

Usage

  1. Place the script in any directory.
  2. 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.

How It Works

  1. The script scans all .cbz files in your manga library.
  2. For each .cbz file that does not already contain a ComicInfo.xml, the script generates a basic XML file with metadata such as the series name and title.
  3. 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.

Notes

  • Log File: All actions are logged in a file called process_log.txt in 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.

License

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.)

About

Python scripts that help bridge the gap between manga downloaded from FMD2 to be indexed by Komf for Kavita.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages