# mendia-scraper
CLI client for the [mendia server](https://crates.io/crates/mendia). Scans local media directories for movie files, enriches metadata via TMDb and ffprobe, stores a local cache in SQLite, and publishes newly discovered movies to the server.
Part of the [mendia ecosystem](#ecosystem).
## Prerequisites
- `ffprobe` (part of [ffmpeg](https://ffmpeg.org/download.html)) must be in `$PATH`
- A running mendia server and a user account on it
## Installation
Download the latest binary from the [GitLab releases page](https://gitlab.com/derfreak/mendia/-/releases), or install from crates.io:
```console
cargo install mendia-scraper
```
## Setup
Run the interactive setup wizard once to configure credentials and media directories:
```console
mendia-scraper --setup
```
This stores the configuration in `~/.mendiafilescrapper/config.toml`.
## Usage
### Scan for new movies
```console
mendia-scraper --scan
```
Walks all configured directories, hashes new files, queries TMDb for metadata, and saves results to the local database. Nothing is sent to the server.
### Scan and publish in one step
```console
mendia-scraper --scan --publish
```
After scanning, immediately pushes the full current movie list to the mendia server. The server reconciles the list per user (removing stale entries and inserting new ones) and sends a Telegram notification for each new entry.
### Suppress Telegram notifications (silent mode)
```console
mendia-scraper --scan --publish --silent
```
Runs a full scan and publish without triggering any Telegram notifications. Useful for initial database population or re-syncs where notifications would be excessive.
The same behaviour can be activated via the environment variable `MENDIA_SILENT` (any non-empty value):
```console
MENDIA_SILENT=1 mendia-scraper --scan --publish
```
### Debug logging
```console
mendia-scraper --scan --publish --debug
```
Enables verbose console output. All log levels are always written to `~/.mendiafilescrapper/log.txt`.
## Local files
| `~/.mendiafilescrapper/config.toml` | Credentials and media directory list |
| `~/.mendiafilescrapper/database.db` | Local SQLite cache of scanned movies |
| `~/.mendiafilescrapper/log.txt` | Debug log |
## Ecosystem
| [mendia](https://crates.io/crates/mendia) | WebSocket server |
| [mendia-api](https://crates.io/crates/mendia-api) | Shared WebSocket protocol types |
| **mendia-scraper** | This package — the file scraper client |
| [mendia (npm)](https://www.npmjs.com/package/mendia) | Web frontend |