Skip to content

Instantly share code, notes, and snippets.

@JourneyOver
Last active January 22, 2025 06:42
Show Gist options
  • Save JourneyOver/c14b3f2fc6187eed6bf7a9f20d9cab50 to your computer and use it in GitHub Desktop.
Save JourneyOver/c14b3f2fc6187eed6bf7a9f20d9cab50 to your computer and use it in GitHub Desktop.
Plex Server with Real Debrid (RD) via Zurg on Windows

Plex Server with Real Debrid (RD) via Zurg on Windows

Requirements

Before starting, download and install the following tools:

  • WinFSP (Install using default settings)
  • Rclone (Download and extract the executable)
  • NSSM (Download and extract the executable)

Download and Set Up Zurg

  1. Go to the Zurg releases page and download the latest release package (e.g., zurg-vX.X.X-windows-amd64.zip).

  2. Extract the contents of the release package to your desired folder, such as ~/Documents/zurg-testing.

  3. From the Zurg repository:

  • Copy or download the following files into the same folder where zurg.exe is located:
    • config.yml
    • rclone.conf
    • scripts/plex_update.ps1
  1. Copy rclone.exe and nssm.exe and the plex_update.ps1 script into the same folder as zurg.exe.

Your folder structure should now look something like this example:

~/Documents/zurg-testing/
├── zurg.exe
├── rclone.exe
├── nssm.exe
├── config.yml
├── rclone.conf
├── plex_update.ps1

Configure Zurg and Rclone

  1. Edit config.yml
    Open the file in a text editor and replace token: ... with your Real Debrid token:

    token: ABC...XYZ
  2. Edit rclone.conf
    Replace the url reference to point to localhost. For example:

    url = http://localhost:9999/dav
    

Set Up Zurg and Rclone as Services

All commands assume you're in the folder where zurg.exe is located (e.g., ~/Documents/zurg-testing).

Zurg Service

  1. Run:
    nssm.exe install zurg
  2. In the popup:
    • For Path, select zurg.exe in the current folder.
  3. Click Install Service.

Rclone Service

  1. Run:
    nssm.exe install rclone
  2. In the popup:
    • For Path, select rclone.exe in the current folder.
    • For Arguments, use:
      mount zurg: Z: --dir-cache-time 10s --no-console --vfs-cache-mode=full --vfs-read-chunk-size 1M --vfs-read-chunk-size-limit 32M
      Replace Z: with your preferred drive letter, if desired.
  3. Click Install Service.

Start Services

  1. Open the Services app in Windows.
  2. Under Services (Local):
    • Locate and start the zurg service.
    • Locate and start the rclone service.
  • By default, these services should start automatically after a system reboot.

Confirm It's Working

  • In File Explorer, you should see a new drive (Z: by default) under This PC.
  • Access the drive to verify folders like movies, shows, etc.
  • Test further by visiting http://localhost:9999/ in your web browser.

Optional: Enhanced Rclone Configuration

To further optimize Rclone performance, you can enhance the arguments in the Rclone Service setup:

  • During the step where you specify arguments in the NSSM popup for the Rclone service:
    • Replace the default arguments with the following:
      mount zurg: Z: --attr-timeout 10y --buffer-size 128M --dir-cache-time 10s --poll-interval 60s --vfs-cache-max-age 2M --vfs-cache-max-size 50G --vfs-cache-min-free-space 2G --vfs-cache-mode full --vfs-cache-poll-interval 30s --vfs-disk-space-total-size 100G --vfs-fast-fingerprint --vfs-read-ahead 64M --vfs-read-chunk-size 1M --vfs-read-chunk-size-limit 32M --vfs-read-wait 40ms --vfs-refresh --transfers 32 --checkers 32 --multi-thread-streams 8 --fast-list --no-console
      Replace Z: with your preferred drive letter if needed.

Optional: Integrating with Plex

If using Plex:

If you want Plex to refresh the library after adding new content:

  1. Uncomment the on_library_update: Line in config.yml
    Open the config.yml file and locate the line beginning with #on_library_update:. Remove the # at the beginning to uncomment it. The updated line should look like this:

    on_library_update: '& powershell -ExecutionPolicy Bypass -File .\plex_update.ps1 --% "$args"'
  2. Comment Out the sh plex_update.sh Line in config.yml
    In the same config.yml file, find the line referring to sh plex_update.sh and add a # at the beginning to comment it out. The updated line should look like this:

    #on_library_update: sh plex_update.sh "$@"
  3. Edit plex_update.ps1 Script
    Open the plex_update.ps1 file in a text editor and update the following lines to match your setup:

    # Plex server details - EDIT BELOW
    $plexUrl = "http://plex-ip:32400"
    $plexToken = "your-plex-token"
    # Replace with your mount - EDIT BELOW
    $mount = "Z:"
    # Example path to a log - EDIT BELOW
    Start-Transcript -Path "C:\Path\To\zurg-testing\logs\plex_update.log"
    # Example usage - REPLACE WITH YOUR DIRECTORIES
    $directoriesToUpdate = @("Z:\movies","Z:\anime","Z:\shows","Z:\movies4k","Z:\shows4k")

Enjoy your enhanced streaming experience! 🎥

@profucius
Copy link

Thanks for sharing this! I already had my Plex/Zurg/Rclone set up, but your steps mirror the same I took when I did mine. However your optional steps at the end were the secret sauce I was missing before; Auto-updating Plex, and improved Rclone config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment