Cross-platform support (macOS + Linux): venv-based install, launchd & systemd autostart, CLI-override bugfix
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
# Image Folder Watcher
|
||||
|
||||
Überwacht einen Ordner. Sobald ein **Unterordner mit Bildern** hineingeschoben
|
||||
wird, werden alle Bilder automatisch:
|
||||
|
||||
1. In einen `Backup/`-Unterordner kopiert (Originale bleiben erhalten)
|
||||
2. Web-sicher umbenannt: `<ordnername>-00.jpg`, `<ordnername>-01.jpg`, …
|
||||
(Umlaute → `ae/oe/ue/ss`, Leerzeichen → `-`, alles klein)
|
||||
3. Auf **1920 px Breite** (proportional) und **72 DPI** skaliert
|
||||
4. Als JPEG unter **1 MB** gehalten (Qualität wird bei Bedarf abgesenkt)
|
||||
|
||||
Unterstützte Formate: JPEG, PNG, WEBP, TIFF, BMP, GIF, AVIF, HEIC/HEIF.
|
||||
|
||||
Läuft auf **macOS** und **Linux** (gleiche Codebasis).
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
git clone git@git.datenhimmel.work:claude-ai/image-folder-watcher.git
|
||||
cd image-folder-watcher
|
||||
./install.sh
|
||||
```
|
||||
|
||||
Das Script:
|
||||
- prüft/installiert Python (Homebrew auf macOS, pacman/apt/dnf/zypper auf Linux),
|
||||
- legt ein **virtuelles Environment** an (`~/image-folder-watcher/.venv`) und
|
||||
installiert Pillow, watchdog und pillow-heif darin – **kein**
|
||||
`--break-system-packages` nötig,
|
||||
- erstellt den Überwachungsordner
|
||||
(`~/Pictures/Eingang` auf macOS, `~/Bilder/Eingang` auf Linux),
|
||||
- bietet optional Autostart an (launchd auf macOS, systemd auf Linux).
|
||||
|
||||
Eigenen Pfad festlegen:
|
||||
|
||||
```bash
|
||||
WATCH_DIR="$HOME/mein/eingang" ./install.sh
|
||||
```
|
||||
|
||||
## Manuell starten
|
||||
|
||||
```bash
|
||||
~/image-folder-watcher/.venv/bin/python ~/image-folder-watcher/watcher.py "<überwachter-ordner>"
|
||||
```
|
||||
|
||||
Mit Optionen:
|
||||
|
||||
```bash
|
||||
... watcher.py "<ordner>" --width 1920 --dpi 72 --format JPEG --quality 92 --delay 5
|
||||
```
|
||||
|
||||
| Option | Bedeutung | Standard |
|
||||
|-------------|---------------------------------------------|----------|
|
||||
| `--width` | Zielbreite in Pixel | 1920 |
|
||||
| `--dpi` | Ziel-DPI | 72 |
|
||||
| `--format` | Ausgabeformat (JPEG/PNG/WEBP) | JPEG |
|
||||
| `--quality` | JPEG-Qualität (1–100) | 92 |
|
||||
| `--delay` | Wartezeit bis Ordner als "fertig" gilt (s) | 5 |
|
||||
|
||||
> Bei Netzwerk-/SMB-Kopien (z. B. vom Mac auf einen Linux-Share) `--delay`
|
||||
> höher setzen, damit das Tool wartet, bis wirklich alle Dateien angekommen sind.
|
||||
|
||||
## Autostart
|
||||
|
||||
**macOS (launchd):**
|
||||
```bash
|
||||
launchctl print gui/$(id -u)/work.datenhimmel.image-watcher # Status
|
||||
launchctl bootout gui/$(id -u)/work.datenhimmel.image-watcher # Stoppen/Entfernen
|
||||
tail -f ~/image-folder-watcher/watcher.out.log # Logs
|
||||
```
|
||||
|
||||
**Linux (systemd):**
|
||||
```bash
|
||||
sudo systemctl status image-watcher
|
||||
journalctl -u image-watcher -f
|
||||
```
|
||||
|
||||
## Plattform-Hinweise
|
||||
|
||||
- macOS nutzt FSEvents, Linux nutzt inotify – `watchdog` wählt das automatisch.
|
||||
- Auf macOS gibt es keine `--break-system-packages`-Problematik, weil alles im
|
||||
venv landet.
|
||||
- Der systemd-Dienst läuft als System-Service unter deinem User; der
|
||||
launchd-Agent läuft als User-Agent (startet beim Login).
|
||||
Reference in New Issue
Block a user