🔧 MakeMKV: HOME=/config pour la cle d'activation persistante + erreur d'activation explicite
This commit is contained in:
1 parent
8e76fb7112
commit
acc1609b4d
4 files changed
+78
-1
No files matched your search
+5
-1
@@ -56,7 +56,11 @@ COPY app/ app/
|
|||||||
COPY --from=web /web/dist /app/web/dist
|
COPY --from=web /web/dist /app/web/dist
|
||||||
COPY docker/entrypoint.py /entrypoint.py
|
COPY docker/entrypoint.py /entrypoint.py
|
||||||
|
|
||||||
ENV MKVTOOL_CONFIG_DIR=/config \
|
# HOME pointe vers /config pour que MakeMKV y lise et y ecrite sa
|
||||||
|
# configuration (settings.conf, cle d'activation) : le processus tourne sous
|
||||||
|
# PUID/PGID et ne peut pas acceder a /root, et /config est le volume persistant.
|
||||||
|
ENV HOME=/config \
|
||||||
|
MKVTOOL_CONFIG_DIR=/config \
|
||||||
MKVTOOL_WEB_DIR=/app/web/dist \
|
MKVTOOL_WEB_DIR=/app/web/dist \
|
||||||
MKVTOOL_FILMS_DIR=/films \
|
MKVTOOL_FILMS_DIR=/films \
|
||||||
MKVTOOL_RADARR_FILMS_DIR=/nas_storage/jellyfin/films \
|
MKVTOOL_RADARR_FILMS_DIR=/nas_storage/jellyfin/films \
|
||||||
|
|||||||
@@ -29,6 +29,37 @@ MakeMKV (`makemkvcon`) est compile dans l'image a partir de la version definie
|
|||||||
par l'argument de build `MAKEMKV_VERSION` (par defaut `2.0.0`). Le build local
|
par l'argument de build `MAKEMKV_VERSION` (par defaut `2.0.0`). Le build local
|
||||||
reste possible : `docker build -t mkvtool .`.
|
reste possible : `docker build -t mkvtool .`.
|
||||||
|
|
||||||
|
## Activation de MakeMKV
|
||||||
|
|
||||||
|
MakeMKV est shareware : sans clé d'activation, `makemkvcon` ne peut pas
|
||||||
|
convertir en mode non interactif (il demande le lancement de la période
|
||||||
|
d'évaluation, puis s'arrête). Deux options :
|
||||||
|
|
||||||
|
- **Clé bêta gratuite**, publiée par l'éditeur sur le forum officiel
|
||||||
|
(https://forum.makemkv.com/forum/viewtopic.php?t=1053) et renouvelée tous
|
||||||
|
les un à deux mois tant que MakeMKV reste en bêta. C'est la voie gratuite
|
||||||
|
usuelle.
|
||||||
|
- **Clé permanente** achetée (~60 USD, achat à vie) — l'achat est
|
||||||
|
ponctuellement indisponible côté éditeur, la clé bêta fait alors foi.
|
||||||
|
|
||||||
|
L'image positionne `HOME=/config` : MakeMKV lit et écrit sa configuration
|
||||||
|
dans `/config/.MakeMKV/settings.conf`, donc sur le volume persistant. Pour
|
||||||
|
activer :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec mkvtool makemkvcon reg T-VOTRE-CLE
|
||||||
|
```
|
||||||
|
|
||||||
|
Ou en créant le fichier `<montage de /config>/.MakeMKV/settings.conf` sur
|
||||||
|
l'hôte :
|
||||||
|
|
||||||
|
```
|
||||||
|
app_MakeMKV_key = "T-VOTRE-CLE"
|
||||||
|
```
|
||||||
|
|
||||||
|
Si une conversion échoue avec le message d'activation, la clé a expiré :
|
||||||
|
reprenez la clé courante sur le forum et relancez la commande ci-dessus.
|
||||||
|
|
||||||
## Variables d'environnement
|
## Variables d'environnement
|
||||||
|
|
||||||
| Variable | Defaut image | Role |
|
| Variable | Defaut image | Role |
|
||||||
|
|||||||
@@ -94,6 +94,14 @@ def extract_mkv(movie: IsoMovie, mkv_path: Path) -> None:
|
|||||||
)
|
)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
detail = result.stderr.strip() or result.stdout.strip()
|
detail = result.stderr.strip() or result.stdout.strip()
|
||||||
|
if "purchase an activation key" in detail or "evaluation period" in detail:
|
||||||
|
raise RuntimeError(
|
||||||
|
"MakeMKV n'est pas activé: une clé est requise pour la conversion. "
|
||||||
|
"Utilisez la clé bêta gratuite du forum officiel MakeMKV ou une clé "
|
||||||
|
"achetée, puis `docker exec mkvtool makemkvcon reg <clé>` "
|
||||||
|
"(ou renseignez app_MakeMKV_key dans /config/.MakeMKV/settings.conf). "
|
||||||
|
"Voir IMAGE.md."
|
||||||
|
)
|
||||||
raise RuntimeError(f"MakeMKV a echoue: {detail}")
|
raise RuntimeError(f"MakeMKV a echoue: {detail}")
|
||||||
produced = sorted(mkv_path.parent.glob("*.mkv"))
|
produced = sorted(mkv_path.parent.glob("*.mkv"))
|
||||||
if not produced:
|
if not produced:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from fastapi.testclient import TestClient
|
|||||||
from httpx import Response
|
from httpx import Response
|
||||||
|
|
||||||
from app.config import settings
|
from app.config import settings
|
||||||
|
from app.converter import extract_mkv
|
||||||
from app.database import SessionLocal
|
from app.database import SessionLocal
|
||||||
from app.main import app
|
from app.main import app
|
||||||
from app.models import IsoMovie
|
from app.models import IsoMovie
|
||||||
@@ -161,3 +162,36 @@ def test_scan_marks_missing_radarr_files_as_unlinked() -> None:
|
|||||||
movie = client.get("/api/movies").json()[0]
|
movie = client.get("/api/movies").json()[0]
|
||||||
assert movie["radarr_linked"] is False
|
assert movie["radarr_linked"] is False
|
||||||
assert movie["status"] == "detected"
|
assert movie["status"] == "detected"
|
||||||
|
|
||||||
|
|
||||||
|
def test_extract_fails_with_activation_error_when_makemkv_unactivated(
|
||||||
|
monkeypatch, tmp_path
|
||||||
|
) -> None:
|
||||||
|
"""Sans cle MakeMKV (message shareware), l'erreur guide vers l'activation."""
|
||||||
|
from types import SimpleNamespace
|
||||||
|
|
||||||
|
monkeypatch.setattr(settings, "simulate_conversion", False)
|
||||||
|
monkeypatch.setattr("app.converter.shutil.which", lambda _: "/usr/bin/makemkvcon")
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"app.converter.subprocess.run",
|
||||||
|
lambda *args, **kwargs: SimpleNamespace(
|
||||||
|
returncode=10,
|
||||||
|
stdout=(
|
||||||
|
"This functionality is shareware. You may evaluate it for 30 days "
|
||||||
|
"after what you would need to purchase an activation key.\n"
|
||||||
|
"Do you want to start evaluation period now?\n"
|
||||||
|
"Evaluation version, 30 day(s) out of 30 remaining"
|
||||||
|
),
|
||||||
|
stderr="",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
movie = IsoMovie(
|
||||||
|
radarr_movie_id=1, radarr_movie_file_id=2, title="ISO Movie", path="/x.iso"
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
extract_mkv(movie, tmp_path / "out" / "movie.mkv")
|
||||||
|
except RuntimeError as error:
|
||||||
|
assert "MakeMKV n'est pas activé" in str(error)
|
||||||
|
assert "makemkvcon reg" in str(error)
|
||||||
|
else:
|
||||||
|
raise AssertionError("RuntimeError attendue")
|
||||||
Reference in new issue
Block a user