Metadata-Version: 2.4
Name: mifpy
Version: 1.0.0
Summary: A Python library for reading and writing Movie Information Format (.mif) containers.
License: MIT
Author: OmgRod
Author-email: rod@omgrod.me
Requires-Python: >=3.10
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Description-Content-Type: text/markdown

# MIFpy

`mifpy` is a lightweight Python library for the Movie Information Format (`.mif`), a ZIP-based container format for movie metadata, subtitles, actor appearance timelines, and associated assets.

## Features

- Load and save `.mif` archives using Python `zipfile`
- Validate required package files and formats
- Parse `manifest.ini`, `meta.ini`, `appearances.json`, and `subtitles.srt`
- Add content assets under `content/`
- CLI support: `inspect`, `extract`, and `create`

## Package structure

A valid `.mif` archive contains:

- `manifest.ini`
- `meta.ini`
- `subtitles.srt`
- `appearances.json`
- `content/` (optional)

## Installation

Install with Poetry:

```bash
poetry install
```

## Usage

```python
from mifpy import MIFPackage

pkg = MIFPackage.create(
    meta={"title": "The Matrix", "year": 1999, "runtime_ms": 8160000},
    subtitles="1\n00:00:00,000 --> 00:00:02,000\nWake up, Neo.\n",
    appearances={
        "actors": {
            "keanu_reeves": {
                "name": "Keanu Reeves",
                "image": "content/keanu.png",
            }
        },
        "appearances": [
            {"actor": "keanu_reeves", "start_ms": 1000, "end_ms": 10000}
        ],
    },
)

pkg.add_content_file("keanu.png", b"<raw-image-bytes>")
pkg.save("movie.mif")
```

## CLI

```bash
mifpy inspect movie.mif
mifpy extract movie.mif ./out
mifpy create sample.mif
```

## Testing

Run tests with:

```bash
poetry run pytest
```

