:chore: Initialisation du projet
This commit is contained in:
1 parent
75a8c6addd
commit
6278d19618
27 files changed
+4418
-81
No files matched your search
@@ -1,93 +1,113 @@
|
||||
# MKVTool
|
||||
|
||||
MKVTool sera un service web auto-hébergé consacré aux films. Il détecte les images ISO connues de Radarr, permet de lancer leur conversion manuellement, puis réimporte le MKV obtenu dans Radarr.
|
||||
|
||||
## Faisabilité
|
||||
|
||||
## Getting started
|
||||
| Besoin | Faisable | Approche retenue |
|
||||
| --- | --- | --- |
|
||||
| Récupérer les films et leurs chemins | Oui | API REST Radarr v3, avec sa clé API |
|
||||
| Détecter les fichiers ISO | Oui | Inventaire Radarr, puis contrôle du chemin et du système de fichiers |
|
||||
| Convertir une ISO en MKV | Oui, avec limites | MakeMKV pour extraire sans réencoder; sélection du titre principal ou choix manuel si le disque contient plusieurs titres |
|
||||
| Afficher détectés, en attente, en cours, terminés et erreurs | Oui | État persistant en base et progression du worker envoyée à l'interface |
|
||||
| Démarrer une conversion avec un bouton | Oui | Création explicite d'une tâche; aucune conversion automatique dans le MVP |
|
||||
| Scanner manuellement | Oui | Bouton lançant immédiatement un nouvel inventaire Radarr |
|
||||
| Planifier et désactiver les scans | Oui | Planification enregistrée en base, configurable dans l'interface |
|
||||
| Faire apparaître le MKV dans Jellyfin | Oui | Le meilleur emplacement est le dossier du film géré par Radarr, que Jellyfin analyse déjà. Un lien dur est possible seulement sur le même système de fichiers |
|
||||
| Mettre à jour Radarr | Oui | Import/scan via son API après écriture atomique du MKV; aucune modification directe de sa base |
|
||||
| Supprimer le torrent et l'ISO dans qBittorrent | Oui, sous conditions | Retrouver le hash à partir du `downloadId`/de l'historique ou du chemin, puis supprimer via l'API qBittorrent seulement après validation et import réussis |
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
### Limites importantes
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
- Une ISO peut contenir le film, une version longue, des bonus ou plusieurs playlists. La détection automatique du bon titre n'est pas fiable à 100 %. L'interface affichera les titres trouvés et proposera le plus long par défaut, tout en permettant un choix manuel.
|
||||
- Un lien dur (`ln`) ne fonctionne que si la source et la destination sont sur le même volume. Un lien symbolique fonctionne entre volumes, mais les chemins doivent être valides dans MKVTool, Radarr et Jellyfin. En pratique, placer le MKV directement dans le dossier du film est plus robuste.
|
||||
- Supprimer un torrent avec ses données peut supprimer tout son dossier, pas seulement l'ISO. MKVTool devra refuser cette action si le torrent contient d'autres fichiers utiles et devra respecter une option de conservation/seeding.
|
||||
- Tous les services doivent monter les médias avec le même chemin, par exemple `/data/media` et `/data/downloads`, ou utiliser des mappings configurés dans MKVTool.
|
||||
|
||||
## Add your files
|
||||
## Flux sûr proposé
|
||||
|
||||
* [Create](https://docs.gitlab.com/user/project/repository/web_editor/#create-a-file) or [upload](https://docs.gitlab.com/user/project/repository/web_editor/#upload-a-file) files
|
||||
* [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
|
||||
1. Le scanner lit la liste des films et fichiers de Radarr et enregistre ceux dont le fichier se termine par `.iso`.
|
||||
2. L'utilisateur ouvre un élément, inspecte les titres du disque et démarre la conversion.
|
||||
3. Le worker extrait vers un fichier temporaire `Film.mkv.partial` dans le dossier final. MakeMKV conserve les flux vidéo, audio et sous-titres sans perte.
|
||||
4. MKVTool vérifie le MKV avec `ffprobe` et MediaInfo, puis le renomme atomiquement en `.mkv`.
|
||||
5. MKVTool demande à Radarr de rescanner/importer et vérifie que le nouveau fichier est reconnu comme fichier du film.
|
||||
6. Jellyfin voit le fichier dans la bibliothèque au prochain scan; un rafraîchissement Jellyfin pourra être ajouté.
|
||||
7. Après cette validation seulement, MKVTool propose ou exécute, selon le réglage choisi, la suppression du torrent et de ses données via qBittorrent.
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin https://gitlab.orionis-home.fr/deposit/mkvtool.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
Si une étape échoue, l'ISO reste intacte et la tâche peut être relancée. Le service doit être idempotent: rescanner ou relancer ne doit ni créer de doublon ni effacer un fichier validé.
|
||||
|
||||
## Architecture recommandée
|
||||
|
||||
- **API :** Python 3.13, FastAPI, SQLAlchemy et Alembic.
|
||||
- **Interface :** React, TypeScript et Vite.
|
||||
- **Base :** SQLite pour une seule instance; PostgreSQL pourra être proposé pour les grosses installations.
|
||||
- **Tâches :** worker Python séparé. Une seule conversion à la fois par défaut afin de ne pas saturer le NAS. APScheduler suffit pour les scans; les tâches et leurs états restent en base.
|
||||
- **Conversion :** `makemkvcon`, puis `ffprobe` et MediaInfo pour contrôler la sortie. FFmpeg servira aux inspections et aux éventuels remux, pas à lire seul toutes les ISO.
|
||||
- **Déploiement :** image Docker avec volumes `/config`, `/data/media` et `/data/downloads`. L'API et le worker doivent voir exactement les mêmes montages.
|
||||
|
||||
Les clés API et mots de passe seront stockés dans `/config`, jamais renvoyés à l'interface après enregistrement. Une authentification locale et un journal d'audit des suppressions sont nécessaires avant une utilisation réelle.
|
||||
|
||||
## Modèle du MVP Radarr
|
||||
|
||||
Chaque élément détecté sera lié à `radarrMovieId` et `radarrMovieFileId`. MKVTool conservera aussi le chemin ISO observé, sa taille et sa date de modification afin de reconnaître un fichier déjà scanné sans dépendre uniquement de son nom.
|
||||
|
||||
Une conversion suivra les états suivants :
|
||||
|
||||
`detected` → `analyzing` → `ready` → `queued` → `converting` → `validating` → `importing` → `completed`
|
||||
|
||||
Un état `failed` conservera l'étape et un message exploitable. Un ISO disparu sera marqué `missing`; son historique ne sera pas supprimé. Au redémarrage du service, une tâche interrompue sera marquée en échec et pourra être reprise après vérification des fichiers temporaires.
|
||||
|
||||
Le premier MVP ne convertira jamais pendant un scan. Le scan ne fait que mettre l'inventaire à jour. Une conversion exige toujours une action sur le bouton **Convertir**.
|
||||
|
||||
### Intégration Radarr
|
||||
|
||||
MKVTool utilisera uniquement l'API publique `/api/v3` pour :
|
||||
|
||||
- lire les films et leurs `movieFile`;
|
||||
- demander un rafraîchissement ou un rescan du dossier du film;
|
||||
- suivre la commande Radarr jusqu'à sa fin;
|
||||
- vérifier que Radarr référence bien le MKV avant toute suppression.
|
||||
|
||||
Le fichier temporaire ne portera pas immédiatement l'extension `.mkv`, afin que Radarr et Jellyfin ne l'indexent pas pendant son écriture. Le remplacement de l'ISO sera traité comme une opération contrôlée avec sauvegarde de l'état précédent. MKVTool ne modifiera jamais directement `radarr.db`.
|
||||
|
||||
## Écrans du MVP
|
||||
|
||||
- Tableau de bord avec nombres d'ISO détectées, en conversion, terminées et en erreur.
|
||||
- Liste filtrable avec titre du film, année, chemin, taille et état.
|
||||
- Fiche d'une ISO avec titres détectés, piste choisie, progression, logs utiles et bouton **Convertir**.
|
||||
- Configuration des connexions, mappings de chemins et comportement qBittorrent.
|
||||
- Planification du scan avec activation, fréquence et bouton **Scanner maintenant**.
|
||||
|
||||
## Ordre de développement
|
||||
|
||||
1. Connexion et test de l'API Radarr, puis inventaire des ISO de films.
|
||||
2. Base, scanner manuel et interface de liste.
|
||||
3. Analyse MakeMKV, conversion manuelle, progression et validation du résultat.
|
||||
4. Réimport Radarr et gestion sûre de qBittorrent.
|
||||
5. Planification des scans et paramètres depuis l'interface.
|
||||
6. Notifications Jellyfin, authentification, sauvegarde et durcissement du déploiement.
|
||||
|
||||
Sonarr et les séries restent hors périmètre. Ils pourront faire l'objet d'une évolution distincte lorsque le flux Radarr sera stable.
|
||||
|
||||
## Environnement de développement
|
||||
|
||||
Prérequis: Docker Desktop (ou Docker Engine), l'extension Dev Containers de l'IDE, et Git.
|
||||
|
||||
Ouvrir le dépôt dans le devcontainer fournit Python, Node.js, FFmpeg, MediaInfo et les outils SQLite. Les ports `8000` (API) et `5173` (interface) sont exposés. MakeMKV n'est pas installé automatiquement car sa distribution et sa clé bêta changent; il sera intégré dans l'image du worker avec une version et une licence explicitement configurées.
|
||||
|
||||
Après création du squelette applicatif, les commandes prévues seront :
|
||||
|
||||
```bash
|
||||
# API
|
||||
uv run uvicorn app.main:app --host 0.0.0.0 --reload
|
||||
|
||||
# Interface
|
||||
cd web && npm run dev -- --host 0.0.0.0
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
## Décisions à prendre avant l'intégration réelle
|
||||
|
||||
* [Set up project integrations](https://gitlab.orionis-home.fr/deposit/mkvtool/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
* [Invite team members and collaborators](https://docs.gitlab.com/user/project/members/)
|
||||
* [Create a new merge request](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/)
|
||||
* [Automatically close issues from merge requests](https://docs.gitlab.com/user/project/issues/managing_issues/#closing-issues-automatically)
|
||||
* [Enable merge request approvals](https://docs.gitlab.com/user/project/merge_requests/approvals/)
|
||||
* [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
* [Get started with GitLab CI/CD](https://docs.gitlab.com/ci/quick_start/)
|
||||
* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/user/application_security/sast/)
|
||||
* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/topics/autodevops/requirements/)
|
||||
* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/user/clusters/agent/)
|
||||
* [Set up protected environments](https://docs.gitlab.com/ci/environments/protected_environments/)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
## Project status
|
||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||
- Les chemins montés dans Radarr, qBittorrent, Jellyfin et le futur conteneur MKVTool.
|
||||
- Le type de lien souhaité, si un lien reste nécessaire, et la confirmation que les deux dossiers sont sur le même volume.
|
||||
- La politique qBittorrent: garder pour le seeding, retirer le torrent sans données, ou supprimer torrent et données après import.
|
||||
- Le comportement lorsque MakeMKV trouve plusieurs titres plausibles.
|
||||
Reference in new issue
Block a user