StreamOrganizer is a Python-based utility designed to synchronize watch status between Jellyfin and media management tools like Radarr and Sonarr. It automatically identifies movies and series marked as "Played" in Jellyfin and updates their status/tags in Radarr and Sonarr, helping you keep your media library organized.
- Jellyfin Integration: Retrieves played status for movies and series from Jellyfin.
- Radarr & Sonarr Synchronization: Tags watched content and synchronizes state between platforms.
- Automatic Organization: Automatically moves watched content to specified archive paths in Radarr and Sonarr.
- Jellyfin Path Sync: Automatically updates the file path in Jellyfin after a move to preserve watch status and library integrity.
- Logging: Robust logging system replacing print statements for better monitoring and debugging.
- Extensible Architecture: Modular service-based design with a shared
BaseServicefor consistent API interaction and error handling.
- Python 3.x
- Access to Jellyfin, Radarr, and Sonarr instances with API keys enabled.
-
Clone the repository:
git clone https://github.com/mcamin/StreamOrganizer.git cd StreamOrganizer -
Install dependencies:
pip install -r requirements.txt
The application uses environment variables for configuration. You can use the provided .env.default as a template.
-
Copy
.env.defaultto.env:cp .env.default .env
-
Edit
.envand fill in your server details and API keys:# Jellyfin Configuration JELLYFIN_SERVER_URL=http://your-jellyfin-url:8096 JELLYFIN_API_KEY=your_jellyfin_api_key JELLYFIN_USERNAME=your_username # Sonarr Configuration SONARR_SERVER_URL=http://your-sonarr-url:8989 SONARR_API_KEY=your_sonarr_api_key SONARR_ARCHIVE_PATH=/path/to/your/tv/archive # Radarr Configuration RADARR_SERVER_URL=http://your-radarr-url:7878 RADARR_API_KEY=your_radarr_api_key RADARR_ARCHIVE_PATH=/path/to/your/movie/archive
To run the main synchronization script:
python main.py- It connects to Jellyfin and fetches all items marked as played.
- For each played movie:
- It searches for it in Radarr.
- Tags it as
watchedin both Jellyfin and Radarr. - Moves the movie to the specified
RADARR_ARCHIVE_PATH. - Updates the file path in Jellyfin to the new location to preserve watch status.
- For each played series:
- It searches for it in Sonarr.
- Tags it as
watchedin both Jellyfin and Sonarr. - Moves the series to the specified
SONARR_ARCHIVE_PATH. - Updates the file path in Jellyfin to the new location.
main.py: The entry point of the application.services/: Contains API wrappers for Jellyfin, Radarr, and Sonarr.base.py: Shared base class for all services, handling API requests, logging, and environment loading.jellyfin.py: Interaction with Jellyfin API.radarr.py: Interaction with Radarr API.sonarr.py: Interaction with Sonarr API.
helpers/: Utility functions.helper.py: Path normalization and joining utilities.
requirements.txt: Python dependencies.