qb-scripts is a collection of Node.js scripts designed to enhance and automate various tasks related to qBittorrent. These scripts provide functionality for managing upload limits, purging download directories, and interacting with the qBittorrent Web API.
Clone this repository:
git clone https://github.com/KevinWang15/qb-scripts
cd qb-scripts
Install dependencies:
npm install
Create a config.json file in the project root with your settings (see Configuration section below).
Create a config.json file in the project root. The required fields depend on which scripts you're using. Here's a comprehensive example with all possible options:
{
"qbittorrent": {
"url": "http://your-qbittorrent-webui-url",
"username": "your-username",
"password": "your-password",
"downloadRoot": "/path/to/download/directory"
},
"ssh": {
"host": "your-ssh-host",
"username": "your-ssh-username",
"privateKeyPath": "/path/to/your/private/key"
},
"uploadLimiter": {
"uploadRatioThreshold": 3,
"uploadLimitKBps": 100,
"checkIntervalSeconds": 30
},
"proxy": {
"type": "socks5",
"host": "proxy-host",
"port": 1080,
"url": "socks5://username:password@proxy-host:1080"
}
}
qbittorrent: Required for all scripts
url: The URL of your qBittorrent Web UIusername and password: Your qBittorrent Web UI credentialsdownloadRoot: The root directory where qBittorrent stores downloads (required for purge-downloaddir.js)ssh: Required only for purge-downloaddir.js
host: The hostname or IP address of your SSH serverusername: Your SSH usernameprivateKeyPath: Path to your SSH private key fileuploadLimiter: Required only for auto-upload-limiter.js
uploadRatioThreshold: The ratio at which to start limiting upload speeduploadLimitKBps: The upload speed limit in KB/scheckIntervalSeconds: How often to check and adjust upload limitsproxy: Optional for all scripts
type: The type of proxy. Can be "socks5", "http", or "https"host and port: The proxy server's hostname/IP and porturl: An alternative way to specify the proxy (can be used instead of host and port)The scripts support three types of proxies:
SOCKS5 Proxy:
"proxy": {
"type": "socks5",
"host": "proxy-host",
"port": 1080
}
Or using the url format:
"proxy": {
"type": "socks5",
"url": "socks5://username:password@proxy-host:1080"
}
HTTP Proxy:
"proxy": {
"type": "http",
"host": "proxy-host",
"port": 8080
}
Or using the url format:
"proxy": {
"type": "http",
"url": "http://username:password@proxy-host:8080"
}
HTTPS Proxy:
"proxy": {
"type": "https",
"host": "proxy-host",
"port": 8443
}
Or using the url format:
"proxy": {
"type": "https",
"url": "https://username:password@proxy-host:8443"
}
Note: When using the url format, you don't need to specify host and port separately.
For auto-upload-limiter.js:
{
"qbittorrent": {
"url": "http://your-qbittorrent-webui-url",
"username": "your-username",
"password": "your-password"
},
"uploadLimiter": {
"uploadRatioThreshold": 3,
"uploadLimitKBps": 100,
"checkIntervalSeconds": 30
}
}
For purge-downloaddir.js:
{
"qbittorrent": {
"url": "http://your-qbittorrent-webui-url",
"username": "your-username",
"password": "your-password",
"downloadRoot": "/path/to/download/directory"
},
"ssh": {
"host": "your-ssh-host",
"username": "your-ssh-username",
"privateKeyPath": "/path/to/your/private/key"
}
}
Remember to adjust the configuration according to your specific setup and requirements.
Run the auto upload limiter script:
node auto-upload-limiter.js
This script will continuously monitor your torrents and adjust their upload limits based on the configured ratio threshold.
Run the purge script:
node purge-downloaddir.js
This script will compare the torrents in qBittorrent with the actual directories in your download folder, allowing you to clean up any discrepancies.
A Dockerfile is provided for containerizing the application. To build and run the Docker container:
Build the image:
docker build -t qb-scripts .
Run the container:
docker run -v /path/to/your/config.json:/app/config.json qb-scripts /app/your-script.js
Make sure to mount your config.json file and any necessary SSH keys into the container.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
Content type
Image
Digest
sha256:9a917677e…
Size
365.7 MB
Last updated
almost 2 years ago
docker pull kevinwang15/qb-scripts