MCPcopy Index your code
hub / github.com/elsbrock/plundrio

github.com/elsbrock/plundrio @v0.10.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.10.6 ↗ · + Follow
170 symbols 664 edges 24 files 123 documented · 72%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🌊 plundrio

Sailing the digital seas with ease,

Fetching treasures as we please.

With *arr at helm and put.io's might,

Downloads flow through day and night.

plundrio (/ˈplʌndriˌoʊ/) is a put.io download client designed to seamlessly integrate with the *arr stack (Sonarr, Radarr, Lidarr, etc.). Files are automatically added to put.io and downloaded to the local disk once complete.

By using plundrio, you can benefit from faster downloads if the file is already cached by put.io, allowing you to download it locally immediately. This is especially useful if you have a low bandwidth connection, as you can easily saturate it by downloading from put.io instead of the original source. Additionally, if put.io already has the file cached, you can skip the initial download step from the origin to put.io, saving time and bandwidth. However, in all other cases, a direct download from the origin may be more beneficial, as put.io essentially performs the same download process.

📋 Table of Contents

🚀 Features

  • 🔄 Seamless integration with Sonarr, Radarr, and other *arr applications supporting Transmission RPC
  • 🌐 Stateless architecture; multiple instances per put.io account supported
  • ⚡ Fast and efficient downloads from put.io (with resume support)
  • 🔄 Parallel downloads with configurable worker count to maximize bandwidth
  • 🧹 Automatic cleanup of completed transfers
  • 🔒 Secure OAuth token handling for put.io authentication
  • 📊 Comprehensive transfer logging with detailed metadata for all transfers
  • 🔁 Automatic retry of failed transfers with configurable retry attempts

🔧 How It Works

plundrio makes downloading from put.io simple and automatic:

graph LR
    A[*arr Application] -->|Sends download request| B[plundrio]
    B -->|Adds transfer to| C[put.io]
    C -->|Transfer completes| D[plundrio monitors]
    D -->|Downloads files| E[Local Storage]
    D -->|Cleans up| C
  1. Your *arr application sends a download request to plundrio via Transmission RPC
  2. plundrio forwards this request to put.io
  3. plundrio tracks all put.io transfers pointing at the specified target directory
  4. Once a transfer completes, it automatically downloads all files to your local folder
  5. Downloads are parallelized with multiple workers to optimize speed
  6. Transfers and their files are cleaned up when all files are present locally and the transfer finished seeding

Transfer State Tracking for *arr Integration

plundrio implements a specialized state tracking system to ensure seamless integration with *arr applications:

  1. Transfer Record Preservation:
  2. When a transfer completes and files are downloaded, plundrio removes the files from put.io but keeps the transfer record
  3. This transfer record acts as a central entity that *arr applications can query to determine completion status
  4. Transfers are only fully removed when explicitly requested via torrent-remove RPC call

  5. Progress Calculation:

  6. put.io download progress (0-100%) is mapped to 0-50% of the total progress
  7. Local download progress (0-100%) is mapped to 50-100% of the total progress
  8. For transfers being processed: progress = (put.io_progress / 2) + (local_progress * 0.5)
  9. For completed transfers: progress = 100% with "seeding" status
  10. This two-phase progress tracking gives *arr applications accurate visibility into both remote and local download status

This approach ensures reliable integration with *arr applications while optimizing put.io storage usage.

📋 Prerequisites

Before installing plundrio, ensure you have:

  1. put.io Account: An active put.io subscription
  2. OAuth Token: A valid put.io OAuth token (instructions for obtaining below)
  3. Storage Space: Sufficient disk space for your downloads
  4. Network Bandwidth: Adequate bandwidth for parallel downloads
  5. One or more *arr Applications: Sonarr, Radarr, Lidarr, etc. (optional, but recommended)

📦 Installation

Using Go

go install github.com/elsbrock/plundrio/cmd/plundrio@latest

Using NixOS

plundrio can be integrated directly into your NixOS configuration as a service:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    plundrio.url = "github:elsbrock/plundrio";
  };

  outputs = { self, nixpkgs, plundrio, ... }: {
    nixosConfigurations.mySystem = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        plundrio.nixosModules.default
        {
          services.plundrio = {
            enable = true;
            targetDir = "/var/lib/plundrio/downloads";
            putioFolder = "plundrio";
            authTokenFile = "/run/credentials/plundrio.service/token";
            # Optional configurations with defaults:
            # listenAddr = ":9091";
            # workerCount = 4;
            # logLevel = "info";
            # user = "plundrio";
            # group = "plundrio";
          };
        }
      ];
    };
  };
}

The NixOS module: - Creates a dedicated system user and group (plundrio) - Sets up a systemd service with proper security hardening - Creates the target directory with appropriate permissions - Automatically starts at boot and restarts on failure

Using Docker

docker run --rm -it ghcr.io/elsbrock/plundrio:latest -- --help

Make sure to expose the transmission RPC port (default 9091) and mount the download directory:

docker run -d \
  --name plundrio \
  -p 9091:9091 \
  -v /path/to/downloads:/downloads \
  -e PLDR_TOKEN=your-token \
  -e PLDR_TARGET=/downloads \
  -e PLDR_FOLDER=plundrio \
  ghcr.io/elsbrock/plundrio:latest

The Docker image is available for both x86_64 and ARM64 architectures. Docker will automatically pull the correct version for your platform.

From Releases

Download the latest binary package for your platform (x86_64-linux or aarch64-linux) from the releases page. The multi-arch Docker image is available on GHCR (see Using Docker).

🚀 Getting Started

1. Obtain a put.io OAuth Token

plundrio get-token

This will guide you through the OAuth authentication process and provide you with a token.

2. Generate a Configuration File (Optional)

plundrio generate-config

This creates a template configuration file that you can customize.

3. Configure Your Download Directory

Edit your configuration file or set environment variables to specify your download directory and put.io folder.

4. Start plundrio

plundrio run \
  --target /path/to/downloads \
  --folder "plundrio" \
  --token YOUR_PUTIO_TOKEN \
  --workers 4

5. Configure Your *arr Application

Add plundrio as a Transmission download client in your *arr application (see Configuring *arr Applications below).

⚙️ Configuration

plundrio supports multiple configuration methods:

  1. Config file (YAML format):
target: /path/to/downloads     # Target directory for downloads
folder: "plundrio"             # Folder name on put.io
token: ""                      # Put.io OAuth token (prefer env var)
listen: ":9091"                # Transmission RPC server address
workers: 4                     # Number of download workers
log_level: "info"              # Log level (trace,debug,info,warn,error,fatal,panic,none,pretty)
  1. Command-line flags (see full list with plundrio run --help)

  2. Environment variables (prefixed with PLDR_):

export PLDR_TARGET=/path/to/downloads
export PLDR_TOKEN=your-putio-token
export PLDR_FOLDER=plundrio
export PLDR_LISTEN=:9091
export PLDR_WORKERS=4
export PLDR_LOG_LEVEL=info

Configuration Priority

Configuration values are loaded in the following order, with later sources overriding earlier ones:

  1. Default values
  2. Configuration file
  3. Environment variables
  4. Command-line flags

💡 Security Note: Store OAuth tokens in environment variables rather than config files or command-line arguments for better security.

🔌 Configuring *arr Applications

To add plundrio to your *arr application (Sonarr, Radarr, etc.):

  1. Go to Settings > Download Clients
  2. Click the + button to add a new client
  3. Select "Transmission" from the list
  4. Fill in the following details:
  5. Name: plundrio (or any name you prefer)
  6. Host: localhost (or your server IP)
  7. Port: 9091 (or your configured port)
  8. Use SSL: leave unchecked
  9. URL Base (if shown): keep default value of /transmission/
  10. Username: leave empty
  11. Password: leave empty
  12. Category: keep default value
  13. Click "Test" to verify the connection
  14. Save if the test is successful

plundrio will now automatically handle downloads from your *arr application through put.io.

🎮 Commands

Run the download manager

plundrio run \
  --target /path/to/downloads \
  --folder "plundrio" \
  --token YOUR_PUTIO_TOKEN \
  --workers 4

Generate configuration file

plundrio generate-config

Get OAuth token

plundrio get-token

💡 Tips & Optimization

  • Trash Bin Management: We recommend turning off the trash bin in your put.io settings. This helps keep your put.io account clean and saves space. The trash cannot be deleted programmatically.

  • Download Speed Optimization: Downloads are optimized using the grab library for maximum efficiency. The default worker count of 4 allows for parallel downloads to maximize your available bandwidth.

  • Worker Count Tuning:

  • For faster internet connections (100Mbps+), consider increasing worker count to 5-8
  • For slower connections, reduce worker count to 2-3 to avoid bandwidth saturation
  • Monitor system resource usage to find the optimal setting for your environment

  • Automatic Downloads: If you set the default download folder of put.io to the folder configured in plundrio, you can automatically download files added through other means (e.g., via chill.institute).

  • Security Best Practices:

  • Use environment variables for sensitive data like OAuth tokens
  • Consider using Docker secrets or a secure environment variable manager in production
  • Regularly rotate your OAuth tokens for enhanced security

🔍 Troubleshooting

Common Issues

  1. Connection Refused
  2. Ensure plundrio is running and the port (default 9091) is not blocked by a firewall
  3. Verify the correct host/IP is configured in your *arr application

  4. Authentication Failures

  5. Regenerate your OAuth token using plundrio get-token
  6. Check that the token is correctly set in your configuration

  7. Download Issues

  8. Verify your target directory is writable
  9. Check available disk space
  10. Ensure your put.io account is active and has the files available

  11. Performance Problems

  12. Adjust worker count based on your bandwidth and system capabilities
  13. Check for network throttling or limitations

❓ Frequently Asked Questions

Can I use plundrio without *arr applications?

Yes, plundrio will monitor and download any transfers in your configured put.io folder, regardless of how they were added.

How does plundrio compare to the official put.io client?

plundrio focuses on automation and integration with *arr applications, while the official client offers a more general-purpose interface.

Can I run multiple instances of plundrio?

Yes, plundrio is stateless and can be run in multiple instances, even pointing to the same put.io account with different configurations.

Does plundrio support VPNs or proxies?

plundrio uses your system's network configuration. If your system routes through a VPN or proxy, plundrio will use that connection.

How can I monitor plundrio's status?

plundrio logs its activities to stdout. You can redirect these logs to a file or use a log management system.

🤝 Contributing

Contributions to plundrio are welcome! Here's how you can contribute:

  1. Code Contributions:
  2. Fork the repository
  3. Create a feature branch
  4. Make your changes
  5. Submit a pull request

  6. Bug Reports:

  7. Open an issue describing the bug
  8. Include steps to reproduce
  9. Provide system information

  10. Feature Requests:

  11. Open an issue describing the feature
  12. Explain the use case and benefits

  13. Documentation:

  14. Help improve the README
  15. Add examples or tutorials

Please open an issue first to discuss what you would like to change for major fe

Extension points exported contracts — how you extend this code

PutioClient (Interface)
PutioClient abstracts the put.io API methods used by the RPC server. [1 implementers]
internal/server/server.go
PutioClient (Interface)
PutioClient abstracts the put.io API methods used by the download manager. [1 implementers]
internal/download/manager.go
DownloadService (Interface)
DownloadService abstracts the download manager for the RPC server. [1 implementers]
internal/server/server.go

Core symbols most depended-on inside this repo

Info
called by 51
internal/log/log.go
Debug
called by 46
internal/log/log.go
Error
called by 35
internal/log/log.go
GetState
called by 25
internal/download/types.go
Set
called by 16
internal/download/category.go
Error
called by 16
internal/download/errors.go
Get
called by 14
internal/download/category.go
Fatal
called by 13
internal/log/log.go

Shape

Method 96
Function 55
Struct 14
Interface 3
TypeAlias 2

Languages

Go100%

Modules by API surface

internal/download/manager.go21 symbols
internal/download/transfers.go19 symbols
internal/server/server.go18 symbols
internal/download/coordinator_test.go15 symbols
internal/api/client.go14 symbols
internal/download/types.go13 symbols
internal/log/log.go11 symbols
internal/download/coordinator.go11 symbols
internal/download/category.go7 symbols
internal/server/torrent.go6 symbols
internal/server/progress.go5 symbols
internal/download/errors.go5 symbols

For agents

$ claude mcp add plundrio \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page