Skip to content

Longbatman09/MetaInject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MetaInject

A small Python tool for assigning permanent IDs into files metadata and tracking everything in ID_RECS.csv. Useful for tracking items wich are constantly being renamed but needed an another pointer id.

image alt

What it does

  • Scans Input/ for files
  • Injects a persistent ID into each file
  • Reuses existing IDs on later scans
  • Detects renamed files by embedded ID
  • Removes deleted files from the CSV on each scan
  • Opens files by ID
  • Shows the current record list in a table
  • Supports custom ID injection through a file picker]

image alt

Files

File Purpose
app\\test.py Main scan/inject command
app\\open.py Opens a file by ID
app\\show.py Displays the current CSV records
app\\custom.py Lets you pick a file and inject a custom ID
app\\metainject_core.py Shared logic used by all scripts
run.bat Windows menu launcher
ID_RECS.csv ID registry generated by the app

Supported file types

  • .jpg
  • .jpeg
  • .png
  • .pdf
  • Any other file type can still receive an ID using the fallback marker mode.

Installation

Install the required Python packages:

pip install Pillow piexif pypdf

Usage

Menu launcher

Run the Windows menu:

run.bat

Scan and inject IDs

python app\\test.py

This scans Input/, injects IDs, updates ID_RECS.csv, and prints a table of results.

Open a file by ID

python app\\open.py <ID>

Example:

python open.py 3

Show records

python app\\show.py

Custom ID injection

python app\\custom.py

This opens a file picker, lets you choose a file, and then asks for the custom ID.

How IDs are stored

  • JPG/JPEG: EXIF ImageDescription
  • PNG: ImageDescription text chunk
  • PDF: /Keywords
  • Other files: trailing __METAID__:<id>:__END__ marker

CSV format

ID_RECS.csv always uses this schema:

actual_name,assigned_id
example.jpg,0
example2.png,1

Behavior notes

  • Existing embedded IDs are preserved
  • Renamed files are detected by ID, not by filename
  • Deleted files are removed from the CSV on the next scan
  • show.py never modifies files
  • open.py only reads metadata and opens the matching file

Developer notes

Shared logic lives in metainject_core.py so the CLI scripts stay thin and easier to reuse in other tools.

Project layout

project-root/
├── Input/
├── README.md
├── run.bat
├── app/
│   ├── custom.py
│   ├── metainject_core.py
│   ├── open.py
│   ├── show.py
│   └── test.py
└── ID_RECS.csv

About

A Python CLI tool that injects sequential numeric IDs into PDF, PNG, and JPG file metadata using pure Python libraries. It tracks records in a CSV, supports file lookup by ID, and provides a Windows batch menu for easy operation.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors