Skip to content

About

GPT 5.6 & Claude Sonnet 5 WIP port of antpe.be Ant Movie Catalogue (AMC) to Python

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AMC Python

A cross-platform Python catalog inspired by Ant Movie Catalog. It provides a reusable model, JSON persistence, import and export tools, command-line and desktop interfaces, and a read-only web view.

Quick start

AMC Python requires Python 3.10 or newer. Install it in a virtual environment, then create a catalog and add your first movie:

python -m venv .venv
source .venv/bin/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1
python -m pip install -e .
amc -c movies.json add "The Apartment" --year 1960 --director "Billy Wilder"
amc -c movies.json list

The first modifying command creates movies.json; later commands load and update that file. Use amc COMMAND --help for command-specific options. For importing an existing collection, choosing a format, and running the graphical interfaces, see the getting-started guide. The documentation index links the user, contributor, and compatibility references.

Caution

This project is a prototype. Keep the source catalog and a separate backup while evaluating it. Native .amc writing is experimental; XML export from Ant Movie Catalog is the safer migration path until native compatibility is verified.

Project status: prototype. This is currently a clean-room partial reimplementation, not yet a feature-complete port. Native .amc files, upstream scripts, catalog-level metadata, and verified cross-version compatibility remain planned work. See the implementation plan, compatibility matrix, and architecture before relying on it for migration. The current evidence-based progress assessment is in the port audit. License and source-snapshot redistribution findings, including unresolved release blockers, are tracked in THIRD_PARTY_NOTICES.md. Upstream status: an extracted source snapshot is now checked in under src/original/ with its companion components under src/antcomponents/. Its two supplied archives, reported source page, sizes, digests, and exact expanded-tree comparisons are recorded in the archive provenance record. The precise download time and an independently published checksum are unavailable, so origin authentication remains incomplete. Initial source-unit mapping is recorded in the upstream source inventory; no Python codec is yet verified against an upstream-generated catalog. Native AMC 1.0–4.2 headers can be identified non-destructively. Catalog owner, mail, site, and description can be read for versions 3.1–4.2, and custom-field definitions can be read for versions 4.0–4.2. Movie records can be read for versions 1.0–4.2, including AMC 4.2 supplementary records. Native files can be imported into JSON without modifying the source; exact native headers are detected even when the file does not use an .amc suffix; catalog metadata, embedded pictures, and supplementary records are retained in JSON. Native reads apply configurable file, movie-count, individual/cumulative-picture, cumulative-string, custom-field/list-value, and per-movie/cumulative supplementary-record limits. Two genuine, upstream-generated fixture sets are now registered and checked in continuous integration — empty/one-movie AMC 3.5/4.1/4.2 catalogs, and a populated AMC 3.5/4.2 pair (AMC's own bundled demo catalog) with custom fields and embedded pictures — which found and fixed two real reader/writer bugs. This is not the same as verified: no status may move to that word without also a documented cross-application test (writing a catalog here, then reopening it in genuine AMC), which remains pending.

For porting work, the checked-in Delphi snapshot is treated as the user-designated authoritative source baseline. Its equality with the checked-in archives is verified, but the reported download origin is not presented as independent publisher authentication or compatibility verification.

Port progress

36% — 17 of 47 implementation-plan checklist items complete

█████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 17 / 47

This bar is calculated from the checked boxes in the implementation plan; it is an auditable project-task indicator, not a claim that 28% of every upstream feature is compatible. A task is only checked off when its tests, documentation, and required compatibility evidence are complete. In particular, native AMC support remains investigating until genuine upstream-generated fixtures and cross-application verification exist. See the compatibility matrix for capability-level status and the port audit for the evidence gaps behind the number.

Install and use

python -m pip install -e .
amc -c movies.json import-xml MyCatalog.xml
amc -c movies.json import additional.csv
amc -c movies.json import additional.json --collision skip --metadata keep
amc -c movies.json import legacy.amc  # read-only conversion; source is untouched
amc -c movies.json import legacy.amc --native-encoding cp1251
amc -c movies.json import legacy.amc --max-input-bytes 1073741824 --max-movies 100000
amc -c movies.json import-media Movie.mkv Trailer.wav
amc -c movies.json import-media MediaFolder/ --recursive
amc -c movies.json import-media MediaFolder/ --max-depth 2
amc -c movies.json import-media MediaFolder/ --merge-parts
amc -c movies.json import-media MediaFolder/ --import-pictures embed
amc -c movies.json import-media MediaFolder/ --extract defer
amc -c movies.json import-media MediaFolder/ --extensions default --title-filter-regex '1080p'
amc -c movies.json import-media MediaFolder/ --recursive --extensions mkv,mp4,wav
amc -c movies.json import-media MediaFolder/ --recursive --progress
amc -c movies.json add "The Apartment" --year 1960 --director "Billy Wilder"
amc -c movies.json list
amc -c movies.json list --json
amc -c movies.json search Wilder
amc -c movies.json search Wilder --field director
amc -c movies.json search Wilder --field director --whole-field
amc -c movies.json search Wilder --reverse
amc -c movies.json remove 2
amc -c movies.json edit 1 --title "The Apartment" --year 1960
amc -c movies.json edit 1 --set 'rating=8.5' --set 'checked=true'
amc -c movies.json export-xml MyCatalog.xml
amc -c movies.json export-xml MyCatalog.xml --scope checked
amc -c movies.json export-xml MyCatalog.xml --sort-by year --sort-reverse
amc -c movies.json export-csv movies.csv
amc -c movies.json export-html movies.html
amc -c movies.json export-html movies.html --template template.html
amc -c movies.json export-html movies.html --row-template movie-row.html
amc -c movies.json export-html-template movies.html --full-template full.html --individual-template item.html
amc -c movies.json export-amc movies.amc
amc -c movies.json export-amc movies.amc --max-output-bytes 104857600
amc -c movies.json picture-set 12 cover.jpg --embed
amc -c movies.json picture-set 12 cover.jpg --embed --crop 10,10,300,450
amc -c movies.json picture-set-many --assign 12=cover12.jpg --assign 13=cover13.jpg --embed
amc -c movies.json picture-export 12 exported-cover.jpg
amc -c movies.json picture-clear 12
amc -c movies.json picture-clear 12 13 14
amc -c movies.json stats
amc -c movies.json stats --json
amc -c movies.json duplicates --json
amc -c movies.json renumber
amc -c movies.json backup movies.backup.json
amc -c movies.json restore movies.backup.json
amc -c movies.json loan-out 12 "Sam Bell"
amc -c movies.json loan-in 12
amc -c movies.json loan-out 12 "Sam Bell" --include-media-label
amc -c movies.json loan-out 12 "Sam Bell" --include-native-number
amc -c movies.json loan-history --json
amc -c movies.json loan-history-export "Loans history.csv"
amc -c movies.json borrower-add "Sam Bell"
amc -c movies.json borrowers
amc -c movies.json gui
amc-web movies.json
amc inspect movies.json --json
amc validate movies.json
amc inspect-script scripts/provider.ifs
amc list-scripts scripts/
amc -c movies.json imdb-lookup 12 --api-key "$OMDB_API_KEY"
amc -c movies.json imdb-lookup 12 --api-key "$OMDB_API_KEY" --apply

The desktop interface requires Tk. Tk ships with the official Windows and macOS Python installers, but many Linux distributions package it separately; on Debian/Ubuntu install it with sudo apt install python3-tk before running amc-gui or amc gui. python3-tk is an operating-system package rather than a Python distribution, so it cannot correctly be declared as a wheel dependency. The built wheel exposes both amc and amc-gui, and the packaging check imports tkinter and amc.gui from an isolated wheel installation.

The JSON representation is UTF-8, human-readable, versioned, and written atomically. Catalog metadata is validated as finite JSON data and isolated from caller-owned mutable objects. Import accepts both attribute-based AMC XML and element-based exports. Unknown XML attributes and elements are retained in each movie's extras mapping. Catalog owner/contact properties and custom-field definitions are also retained, so these supported structures are not discarded during XML/JSON conversion. Structured movie extras that XML cannot represent losslessly are rejected instead of flattened. AMC 4.2 writer, composer, certification, media file path, user rating, and color tag values are modeled directly and round-trip through native, JSON, XML, and CSV. The internal JSON v1 contract and compatibility policy are documented in docs/data-formats/json-v1.md.

CSV files can also be used as input (-c movies.csv) or exported for spreadsheet editing. Headers may use Python field names (original_title) or AMC names (OriginalTitle), and a UTF-8 byte-order mark is emitted for Excel compatibility. The generic import command merges JSON, XML, or CSV input and automatically renumbers duplicate movie numbers by default. Use --collision error, skip, replace, or renumber to select movie-number behavior, and --metadata error, keep, replace, or namespace for conflicting catalog metadata. namespace stores each complete incoming metadata object under a deterministic amc_python_merge_namespaces.import_N key. Failed error merges leave the in-memory destination unchanged. JSON, XML, and CSV output files are replaced atomically so a failed write does not truncate an existing catalog. HTML export produces a dependency-free, self-contained table and escapes all catalog text. A bounded UTF-8 template may contain exactly one {{MOVIES}} marker; a bounded row template supports escaped uppercase modeled-field markers such as {{NUMBER}}, {{ORIGINAL_TITLE}}, and {{DESCRIPTION}}, plus {{DISPLAY_TITLE}}. Upstream AMC's full template/tag compatibility remains pending. import-media records portable path/name/extension/size facts. PCM WAV, FLAC, AIFF/AIFF-C, MP3, MP4/M4A/MOV, and OGG Vorbis files also provide duration and bitrate using only Python's standard library — WAV and uncompressed AIFF bitrate come from the PCM format; FLAC, compressed AIFF-C, and MP3 without a parsed Xing/VBRI header use an average bitrate computed from file size and duration; MP3 duration comes from its first MPEG frame header; MP4 duration comes from the ISOBMFF moov/mvhd box (movie-level only); OGG comes from the Vorbis identification header and the stream's last granule position. AIFF's sample rate is decoded from its 80-bit extended float without the deprecated, Python-3.13-removed aifc module. Video-track resolution, framerate, and a real codec name remain an optional-provider gap. Directory expansion is deterministic, opt-in recursive with an optional --max-depth level cap, optionally extension-filtered (--extensions default selects a shared common-video set), and bounded to 100,000 files per invocation. --merge-parts combines adjacent, same-directory CD1/CD2-style files into one movie entry, summing length/size and averaging bitrate the way upstream does; --import-pictures link|embed attaches a same-stem or configured folder-image poster; --extract full|defer|skip controls how much media metadata is read immediately versus deferred or skipped; and --title-filter-regex strips matching text from a filename-derived title. --progress reports inspection progress to stderr for large trees; the catalog is only written after every file is inspected, so interrupting the command at any point leaves it untouched. Legacy .ifs script metadata can be inspected and inventoried without executing Pascal code. Script execution and network providers remain intentionally disabled until a sandboxed, timeout-bound provider boundary is implemented. Integrators can validate provider-produced movie and extra-field proposals with amc.scripts.preview_script_merge; it returns an isolated candidate plus a field-level change list and enforces the permissions declared in the script header.

list, search, stats, and duplicates accept --json for stable machine-readable output. Duplicate groups use normalized display title plus year; untitled entries are excluded. search matches a fixed set of common fields by default; --field NAME restricts matching to one field, --whole-field requires an exact match instead of a substring, and --reverse returns movies that do not match. Every export-* command accepts --scope {all,checked} (default all) and --sort-by FIELD [--sort-reverse] to select and order which movies are written without changing the catalog's own saved order. The output shapes and stable exit statuses are documented in the command-line contract. backup and restore validate the source catalog, copy its original bytes through an fsynced temporary file, validate those exact copied bytes, and atomically replace the destination only on success. Native export-amc also preserves an existing destination as a sibling .bak file before installing the fully serialized replacement. Both backup and catalog replacement use same-directory temporary files; a serialization or backup-copy failure leaves the existing catalog unchanged. On POSIX systems, the parent directory is fsynced after each replacement so the renamed entries are durable; Python cannot obtain an equivalent directory handle on Windows. edit --set FIELD=JSON can update any modeled field except the catalog number and applies the same type/range validation as JSON loading before saving.

The optional desktop interface uses Python's built-in Tk toolkit. It provides a field-scoped searchable, sortable movie list (Table/Details/Poster/HTML layouts — HTML renders the selected movie live through a chosen Ant Movie Catalog template, via the tkinterweb dependency), file import/export with an Export-options "movies to include"/sort dialog, open/save-as, validated backup/restore, loan controls, Previous/Next movie navigation, and catalog review tools. Setup, supported workflows, and explicit limitations are documented in the desktop guide.

AMC Python also includes a read-only web interface at http://0.0.0.0:6910/ via amc-web movies.json. This is a new convenience interface beyond the upstream port, but its searchable table, All/Loaned/Available/Checked/Unchecked views, details, and poster presentation intentionally mirror the desktop/original GUI vocabulary. The default bind exposes the catalog to every network interface; use amc-web movies.json --host 127.0.0.1 for local-only access. See the web interface guide.

Development

Work is source-driven and test-first. The next milestone is provenance recovery, detailed native-format analysis, and read-only native-format inspection—not additional unrelated CRUD features. See CONTRIBUTING.md for checks, fixture requirements, and the definition of an acceptable compatibility change. The ordered near-term work and blocking exit criteria are in the critical port sprints.

Install the project together with its development checks, then run both canonical commands from the repository root:

python -m pip install -e .[dev]
python tools/check.py
python tools/check_package.py

check.py runs the focused Ruff rule set, mypy in its default mode, the complete test suite with branch coverage (minimum 80%), bytecode compilation, fixture-manifest validation, a source-tree CLI smoke test, and whitespace checks. check_package.py separately builds and inspects a source distribution, rejects accidental inclusion of retained historical evidence trees, builds and installs a wheel in an isolated virtual environment, and exercises the installed console entry points. Ruff formatting, focused linting, mypy, and the branch-coverage floor are canonical gates; see the engineering baseline in the implementation plan.

About

GPT 5.6 & Claude Sonnet 5 WIP port of antpe.be Ant Movie Catalogue (AMC) to Python

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages