SeerrBridge

repository·main·Indexed 43 days ago

https://github.com/woahai321/seerrbridge

A browser automation tool that bridges Jellyseerr and Overseerr with Debrid Media Manager and Real-Debrid. It automates the media fetching process from request to torrent download using Selenium, eliminating the need for traditional 'Arr' stacks like Radarr or Sonarr.

Tokens
6.8K
Snippets
21
Records
25
Agent score
55%

What's inside SeerrBridge

  1. How TV Show Subscriptions work

    main

    SeerrBridge includes a smart subscription system for TV shows that automates episode fetching. It provides:

    • Episode-level automation: Automatically fetches individual episodes when full season packs are unavailable.
    • Interval checking: Periodically checks for new content via a subscription system.
    • Automatic retries: Handles missed or failed episode fetches automatically.
    • Integration: Fully integrated with Debrid Media Manager and Real-Debrid.
  2. How SeerrBridge automation works

    main

    SeerrBridge operates through a four-step automated pipeline:

    1. Seerr Webhook: Listens for incoming movie/show requests from Jellyseerr or Overseerr.
    2. Automated Search: Uses Selenium to automate searching for the requested media on the Debrid Media Manager website.
    3. Torrent Fetching: Once a suitable torrent is found, it automates the download process via Real-Debrid.
    4. Queue Management: Requests are processed asynchronously through a queue to ensure stability.

    Tip: Debugging Automation To see the automation in real-time, set HEADLESS_MODE=false in your .env file. This will launch a visible Chrome browser. Do not interact with the browser while it is running, as this can break the automation script.

  3. Configure Trakt API Client ID

    main

    To use Trakt integration, you must create a new application on Trakt.tv:

    1. Navigate to Settings > Your API Apps > New Application on Trakt.tv.
    2. Use https://google.com as the redirect URI.
    3. Save the Client ID and provide it to SeerrBridge via the web dashboard or .env file.
  4. Configure Jellyseerr / Overseerr Webhooks

    main

    To automate movie requests, configure Jellyseerr or Overseerr to send webhooks to SeerrBridge.

    1. Webhook URL: Set the webhook URL to http://localhost:8777/jellyseer-webhook/ (or http://seerrbridge:8777/jellyseer-webhook/ if both are in the same Docker network).
    2. Notification Type: Set notifications to "Request Automatically Approved".
    3. User Settings: Ensure the user is set to automatic approvals.
    4. Payload: The JSON payload must follow the specific structure required by SeerrBridge to parse media and request details correctly.
    {
        "notification_type": "{{notification_type}}",
        "event": "{{event}}",
        "subject": "{{subject}}",
        "message": "{{message}}",
        "image": "{{image}}",
        "{{media}}": {
            "media_type": "{{media_type}}",
            "tmdbId": "{{media_tmdbid}}",
            "tvdbId": "{{media_tvdbid}}",
            "status": "{{media_status}}",
            "status4k": "{{media_status4k}}"
        },
        "{{request}}": {
            "request_id": "{{request_id}}",
            "requestedBy_email": "{{requestedBy_email}}",
            "requestedBy_username": "{{requestedBy_username}}",
            "requestedBy_avatar": "{{requestedBy_avatar}}",
            "requestedBy_settings_discordId": "{{requestedBy_settings_discordId}}",
            "requestedBy_settings_telegramChatId": "{{requestedBy_settings_telegramChatId}}"
        },
        "{{issue}}": {
            "issue_id": "{{issue_id}}",
            "issue_type": "{{issue_type}}",
            "issue_status": "{{issue_status}}",
            "reportedBy_email": "{{reportedBy_email}}",
            "reportedBy_username": "{{reportedBy_username}}",
            "reportedBy_avatar": "{{reportedBy_avatar}}",
            "reportedBy_settings_discordId": "{{reportedBy_settings_discordId}}",
            "reportedBy_settings_telegramChatId": "{{reportedBy_settings_telegramChatId}}"
        },
        "{{comment}}": {
            "comment_message": "{{comment_message}}",
            "commentedBy_email": "{{commentedBy_email}}",
            "commentedBy_username": "{{commentedBy_username}}",
            "commentedBy_avatar": "{{commentedBy_avatar}}",
            "commentedBy_settings_discordId": "{{commentedBy_settings_discordId}}",
            "commentedBy_settings_telegramChatId": "{{commentedBy_settings_telegramChatId}}"
        },
        "{{extra}}": []
    }
  5. Install SeerrBridge via Docker

    main

    Run the following command to start SeerrBridge in a Docker container. This command sets up persistent storage for MySQL data, logs, and application data, and maps the necessary ports for the dashboard and webhooks.

    Ports mapped:

    • 3777: Web Dashboard
    • 8777: Jellyseerr/Overseerr Webhook
    • 8778: (Internal/Other)
    • 3307: MySQL

    ⚠️ Security Warning: The default installation uses default passwords and is NOT recommended for public internet exposure.

    docker run -d --name seerrbridge --restart unless-stopped -p 3777:3777 -p 8777:8777 -p 8778:8778 -p 3307:3306 -v seerrbridge_mysql_data:/var/lib/mysql -v ./logs:/app/logs -v ./data:/app/data ghcr.io/woahai321/seerrbridge:latest
  6. Configure Real-Debrid and Debrid Media Manager

    main

    SeerrBridge uses browser automation via Selenium to interact with Debrid Media Manager. You must provide authentication credentials obtained from your browser's local storage.

    How to get credentials:

    1. Log in to Debrid Media Manager in your browser.
    2. Open Developer Tools (Inspect > Application > Local Storage).
    3. Copy the required values into your .env file or the web dashboard.

    Required Environment Variables:

    RD_ACCESS_TOKEN={"value":"your_token","expiry":123}
    RD_CLIENT_ID=YOUR_CLIENT_ID
    RD_CLIENT_SECRET=YOUR_CLIENT_SECRET
    RD_REFRESH_TOKEN=YOUR_REFRESH_TOKEN
  7. Configure file size limits for Movies and Episodes

    main

    SeerrBridge allows you to set maximum file size thresholds to control the quality and storage impact of fetched media.

    Movies: Supported values are 0 (unlimited), 1, 3, 5 (default), 15, 30, or 60 GB. Episodes: Supported values are 0 (unlimited), 0.1, 0.3, 0.5, 1 (default), 3, or 5 GB.

  8. How TV show season validation works

    main

    The process_tv_show_seasons function performs deep validation of requested TV seasons to ensure data consistency between Trakt and the local database.

    Logic Flow:

    1. Discrepancy Check: It checks if the specific (show, season) pair is already recorded in the DISCREPANCY_REPO_FILE to avoid redundant processing.
    2. Trakt Fetching: Retrieves episode_count and aired_episodes for the season from Trakt.
    3. Discrepancy Detection:
      • A real discrepancy is defined as aired_episodes > episode_count (indicating a data error where more episodes are marked aired than exist in the season metadata).
      • Note: episode_count > aired_episodes is considered normal for in-progress seasons and is not marked as a discrepancy.
    4. Error Logging: If a real discrepancy is found, the details are appended to the DISCREPANCY_REPO_FILE (JSON format) for tracking.
    5. Database Update: Uses EnhancedSeasonManager.update_tv_show_seasons to persist the validated season data (including unprocessed_episodes, status, and is_discrepant flags) to the database.
    async def process_tv_show_seasons(
        media_title: str, 
        requested_seasons: List[str], 
        media_details: Dict[str, Any], 
        tmdb_id: int, 
        imdb_id: str, 
        request_id: int
    ) -> None:
  9. Deploy SeerrBridge using Docker Compose

    main

    SeerrBridge can be deployed as a unified container that includes a MySQL database, a Python backend, and a Nuxt frontend. The image is hosted on the GitHub Container Registry (ghcr.io/woahai321/seerrbridge:latest).

    Important Note on Configuration: While the Docker Compose file defines database and network settings, all application-level configuration (such as API keys, tokens, and advanced settings) is managed via the web interface and stored in the ./data/.env file.

    services:
      seerrbridge:
        image: ghcr.io/woahai321/seerrbridge:latest
        container_name: seerrbridge
        restart: unless-stopped
        environment:
          MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-seerrbridge_root}
          DB_HOST: localhost
          DB_PORT: 3306
          DB_NAME: ${DB_NAME:-seerrbridge}
          DB_USER: ${DB_USER:-seerrbridge}
          DB_PASSWORD: ${DB_PASSWORD:-seerrbridge}
          USE_DATABASE: "true"
          NUXT_PORT: 3777
        ports:
          - "3307:3306"  # MySQL
          - "3777:3777"  # Nuxt frontend
          - "8777:8777"  # SeerrBridge API
          - "8778:8778"  # Setup API server
        volumes:
          - mysql_data:/var/lib/mysql
          - ./logs:/app/logs
          - ./data:/app/data
    
    volumes:
      mysql_data:
        driver: local
        name: seerrbridge_mysql_data
  10. Configure the SeerrBridge Dashboard appearance

    main

    The app.config.ts file allows you to customize the visual identity of the SeerrBridge Dashboard. You can modify the application metadata, the color theme, and the UI color palette.

    App Metadata

    • name: The display name of the application.
    • description: A brief description of the dashboard's purpose.

    Theme Configuration

    • theme.primary: The primary color used for branding (e.g., 'purple').
    • theme.darkMode: Controls how dark mode is applied. Setting this to 'class' enables dark mode via a CSS class.

    UI Configuration

    • ui.primary: The primary color for UI components.
    • ui.gray: The shade of gray used for neutral elements (e.g., 'slate').
    export default defineAppConfig({
      // App configuration
      name: 'DarthVadarr',
      description: 'SeerrBridge Dashboard - Monitor and manage your SeerrBridge service',
    
    // Theme configuration
      theme: {
        primary: 'purple',
        darkMode: 'class'
      },
    
    // UI configuration
      ui: {
        primary: 'purple',
        gray: 'slate'
      }
    })
  11. Filter content using Custom Regex

    main

    You can use regular expressions to filter out unwanted content from your media fetching.

    Default Regex: This pattern excludes items with 【...】 formatting, Cyrillic characters, or items marked [esp]:

    ^(?!.*【.*?】)(?!.*[\u0400-\u04FF])(?!.*\[esp\]).*$

    Common Filter Patterns:

    • Resolution Filter (1080p or 2160p): `^(?=.(1080p|2160p))(?!.【.?】)(?!.[\u0400-\u04FF])(?!.[esp]).$
    • Torrent Types (Remux, BluRay, etc.): `^(?=.(Remux|BluRay|BDRip|BRRip))(?!.【.?】)(?!.[\u0400-\u04FF])(?!.[esp]).$
    • Types + Resolutions: `^(?=.(1080p|2160p)(?=.(Remux|BluRay|BDRip|BRRip))(?!.【.?】)(?!.[\u0400-\u04FF])(?!.[esp]).*$
    • Resolution Only: `^(?=.(1080p|2160p)).$
    • Types Only: ^(?=.*(Remux|BluRay|BDRip|BRRip)).*$
  12. Process Jellyseerr/Overseerr webhooks

    main

    The /jellyseer-webhook/ POST endpoint processes incoming webhooks from Jellyseerr or Overseerr.

    Workflow:

    1. Payload Parsing: Parses the JSON payload into a WebhookPayload model.
    2. Media Enrichment: Fetches detailed media information (title, year, IMDb ID, Trakt ID) from Trakt using the provided TMDB ID.
    3. Queueing:
      • For movies: Adds the request to the movie queue via add_movie_to_queue.
      • For TV shows: Extracts requested seasons (supporting both integer arrays and string formats like Season X), adds the request to the TV queue via add_tv_to_queue, and triggers process_tv_show_seasons for comprehensive season validation.
    4. Tracking: If USE_DATABASE is enabled, it starts media processing tracking and caches images via fetch_and_cache_images_if_needed.

    Note: A TEST_NOTIFICATION event type is supported for testing the webhook integration.

    POST /jellyseer-webhook/
    
    Payload must include:
    - `media`: object containing `tmdbId`, `media_type`, etc.
    - `request`: object containing `request_id`, `requestedBy_username`.
    - `extra`: list of objects (can contain `requested_seasons`).