Skip to content

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.

License

Notifications You must be signed in to change notification settings

Mcamin/StreamOrganizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreamOrganizer

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.

Features

  • 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 BaseService for consistent API interaction and error handling.

Prerequisites

  • Python 3.x
  • Access to Jellyfin, Radarr, and Sonarr instances with API keys enabled.

Installation

  1. Clone the repository:

    git clone https://github.com/mcamin/StreamOrganizer.git
    cd StreamOrganizer
  2. Install dependencies:

    pip install -r requirements.txt

Configuration

The application uses environment variables for configuration. You can use the provided .env.default as a template.

  1. Copy .env.default to .env:

    cp .env.default .env
  2. Edit .env and 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

Usage

To run the main synchronization script:

python main.py

How it works:

  1. It connects to Jellyfin and fetches all items marked as played.
  2. For each played movie:
    • It searches for it in Radarr.
    • Tags it as watched in 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.
  3. For each played series:
    • It searches for it in Sonarr.
    • Tags it as watched in both Jellyfin and Sonarr.
    • Moves the series to the specified SONARR_ARCHIVE_PATH.
    • Updates the file path in Jellyfin to the new location.

Project Structure

  • 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.

License

MIT

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages