Metadata-Version: 2.5
Name: mediatheque-agent
Version: 0.2.0
Summary: Médiathèque agent: scan, fingerprint, dedupe, and compress local media libraries
Project-URL: Homepage, https://mediatheque.pro
Author: coex
License: # Functional Source License, Version 1.1, MIT Future License
        
        ## Abbreviation
        
        FSL-1.1-MIT
        
        ## Notice
        
        Copyright 2026 coex
        
        ## Terms and Conditions
        
        ### Licensor ("We")
        
        The party offering the Software under these Terms and Conditions.
        
        ### The Software
        
        The "Software" is each version of the software that we make available under
        these Terms and Conditions, as indicated by our inclusion of these Terms and
        Conditions with the Software.
        
        ### License Grant
        
        Subject to your compliance with this License Grant and the Patents,
        Redistribution and Trademark clauses below, we hereby grant you the right to
        use, copy, modify, create derivative works, publicly perform, publicly display
        and redistribute the Software for any Permitted Purpose identified below.
        
        ### Permitted Purpose
        
        A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
        means making the Software available to others in a commercial product or
        service that:
        
        1. substitutes for the Software;
        
        2. substitutes for any other product or service we offer using the Software
           that exists as of the date we make the Software available; or
        
        3. offers the same or substantially similar functionality as the Software.
        
        Permitted Purposes specifically include using the Software:
        
        1. for your internal use and access;
        
        2. for non-commercial education;
        
        3. for non-commercial research; and
        
        4. in connection with professional services that you provide to a licensee
           using the Software in accordance with these Terms and Conditions.
        
        ### Patents
        
        To the extent your use for a Permitted Purpose would necessarily infringe our
        patents, the license grant above includes a license under our patents. If you
        make a claim against any party that the Software infringes or contributes to
        the infringement of any patent, then your patent license to the Software ends
        immediately.
        
        ### Redistribution
        
        The Terms and Conditions apply to all copies, modifications and derivatives of
        the Software.
        
        If you redistribute any copies, modifications or derivatives of the Software,
        you must include a copy of or a link to these Terms and Conditions and not
        remove any copyright notices provided in or with the Software.
        
        ### Disclaimer
        
        THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
        PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
        
        IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
        SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
        EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
        
        ### Trademarks
        
        Except for displaying the License Details and identifying us as the origin of
        the Software, you have no right under these Terms and Conditions to use our
        trademarks, trade names, service marks or product names.
        
        ## Grant of Future License
        
        We hereby irrevocably grant you an additional license to use the Software under
        the MIT license that is effective on the second anniversary of the date we make
        the Software available. On or after that date, you may use the Software under
        the MIT license, in which case the following will apply:
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the "Software"), to deal in
        the Software without restriction, including without limitation the rights to
        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
        of the Software, and to permit persons to whom the Software is furnished to do
        so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: compression,dedupe,duplicates,library,media,video
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Video :: Conversion
Classifier: Topic :: System :: Archiving
Requires-Python: >=3.12
Requires-Dist: imagehash>=4.3
Requires-Dist: pillow>=10.0
Requires-Dist: pydantic>=2.7
Requires-Dist: websockets>=12
Description-Content-Type: text/markdown

# mediatheque-agent

Local agent for [Médiathèque](https://mediatheque.pro) — the media library
service that finds duplicate files and recompresses video so your libraries
take only the space they deserve.

The agent runs **where your media lives** (your machine, NAS, or server) and
does all the heavy work locally: scanning, fingerprinting, duplicate
detection, and video compression. Your files never leave your equipment —
only metadata and small thumbnails travel to the control plane.

## Install

```bash
pip install mediatheque-agent
```

ffmpeg must be on PATH (video fingerprints, thumbnails, compression).

## Quick start

```bash
mediatheque-agent init        # writes ./mediatheque.toml
# edit libraries + add server_url / agent_id / device_token from the dashboard
mediatheque-agent scan        # index your libraries
mediatheque-agent dedupe      # report duplicate groups
mediatheque-agent daemon      # connect to the control plane (review + compress)
```

## What it finds

- **Exact duplicates** — byte-identical images (BLAKE2b)
- **Re-encoded duplicates** — videos matched by 3-frame perceptual
  fingerprints, so a HEVC/AV1 copy of the same clip still matches
- **Compression wins** — HEVC/AV1 (CPU or VAAPI) or quality-targeted ab-av1
  encoding, with a per-file "no worthwhile encode" verdict cache

Removals are always **trash-first** with a JSONL audit log — nothing is ever
unlinked outright.

## Compression policy

Disabled by default; opt in globally or per library:

```toml
[compress]
enabled = true
codec = "hevc"       # hevc | av1
encoder = "cpu"      # cpu | gpu | abav1
min_duration = 60
```

## License

FSL-1.1-MIT — free for nearly all use; converts to MIT two years after each
release. See [LICENSE](LICENSE).
