A standalone monitoring tool for throttling download speed based on Plex Media Player streams
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
helpers
systemd Added service file for running as daemon Aug 12, 2018
.gitignore Added git ignore Aug 9, 2018
Dockerfile Updated Dockerfil Nov 20, 2018
README.md Updated README Sep 4, 2018
config_example.json Updated example config Sep 5, 2018
nzb.py Added functionality to have a user-defined max instead of completely … Sep 4, 2018
plex.py Count streams that are buffering as active streams Sep 4, 2018
requirements.txt
throttle.py Initially, set speed to either unthrottled or user defined max_speed … Sep 4, 2018

README.md

nzbthrottle

Description

Nzbthrottle was designed in order to dynamically control the bandwidth allocation when users are actively streaming from Plex to avoid unnecessary buffering while still allowing the user to download at the fastest rate possible.

Installation

Note: Must have Python 3.5 or higher

  1. Run pip install -r requirements.txt from within the project root
  2. Copy config_example.json and name the new file config.json
  3. Edit the config with all of your appropriate credentials

Sample Config:

{
  "plex":
  {
    "url":"http://localhost:32400",
    "interval":60,
    "token": "daf32j3ik3l2k"
  },
  "nzbget":
  {
    "username":"test_user",
    "password":"test_pass",
    "url":"http://localhost:6789",
    "speeds":{
      "1":5000,
      "2":4000,
      "3":3000,
      "4":2000,
      "5":1000
    },
    "max_speed":80000
  }
}

Plex

url - URL of your Plex Server

interval - Interval with which to check for active streams (seconds)

token - Your X-Plex-Token

Nzbget

username - Username for Nzbget

password - Password for Nzbget

url - URL of your NZBGet Client

speeds - Define speed to throttle to (in kB/s) based on number of active streams

max_speed - Define maximum speed when the throttle is lifted (in kB/s). Set to 0 if you wish to not use a limit

Usage

Running script manually

python throttle.py [-h] [--log-level=['DEBUG','INFO','WARN']]

Running script as service

If you do not wish to run the script manually, the module can be daemonized by copying the service file and running the script as a service. May need to modify location of script based on your preference by changing the following line in 'nzbthrottle.service'

ExecStart=/usr/bin/python3 /opt/nzbthrottle/throttle.py

Running script in a Docker Container

docker run --name nzbthrottle -d -v /PATH/TO/CONFIG.json:/nzbthrottle/config.json daghaian/nzbthrottle