From cf28f42db458d8f9405d4dd6607ae59f028f6344 Mon Sep 17 00:00:00 2001 From: Mukhtar Akere Date: Sat, 29 Mar 2025 00:23:10 +0100 Subject: [PATCH] Update readme, fix minor config bugs --- .gitignore | 1 - README.md | 50 ++++++++++++++++++++++++++++++--------- doc/compose.yml | 20 ++++++++++++++++ doc/config.full.json | 23 ++++++++++-------- doc/rclone.conf | 6 +++++ internal/config/config.go | 22 ++++++++++------- 6 files changed, 92 insertions(+), 30 deletions(-) create mode 100644 doc/compose.yml create mode 100644 doc/rclone.conf diff --git a/.gitignore b/.gitignore index b8c9c79..f2d5a46 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ data/ config.json -docker-compose.yml .idea/ .DS_Store *.torrent diff --git a/README.md b/README.md index 7a9eb79..ff6627e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This is an implementation of QbitTorrent with a **Multiple Debrid service suppor - [Connecting to Sonarr/Radarr](#connecting-to-sonarrradarr) - [Sample Config](#sample-config) - [Config Notes](#config-notes) - - [Log Level](#log-level) + - [Log Level]() - [Max Cache Size](#max-cache-size) - [Debrid Config](#debrid-config) - [Proxy Config](#proxy-config) @@ -23,19 +23,19 @@ This is an implementation of QbitTorrent with a **Multiple Debrid service suppor - [Arrs Config](#arrs-config) - [Proxy](#proxy) - [Repair Worker](#repair-worker) +- [WebDAV](#webdav) + - [WebDAV Config](#webdav-config) - [Changelog](#changelog) - [TODO](#todo) ### Features -- Mock Qbittorent API that supports the Arrs(Sonarr, Radarr, etc) +- Mock Qbittorent API that supports the Arrs(Sonarr, Radarr, Lidarr etc) - A Full-fledged UI for managing torrents - Proxy support for the Arrs -- Real Debrid Support -- Torbox Support -- Debrid Link Support -- Multi-Debrid Providers support -- Repair Worker for missing files (**BETA**) +- Multiple Debrid providers +- WebDAV server support for each debrid provider +- Repair Worker for missing files The proxy is useful for filtering out un-cached Debrid torrents @@ -61,7 +61,8 @@ You can use either hub.docker.com or ghcr.io to pull the image. The image is ava - `latest`: The latest stable release - `beta`: The latest beta release - `vX.Y.Z`: A specific version (e.g `v0.1.0`) -- `nightly`: The latest nightly build. This is highly unstable +- `nightly`: The latest nightly build. This is usually unstable +- `experimental`: The latest experimental build. This is highly unstable!! ```yaml @@ -139,7 +140,7 @@ This is the default config file. You can create a `config.json` file in the root "qbittorrent": { "port": "8282", "download_folder": "/mnt/symlinks/", - "categories": ["sonarr", "radarr"], + "categories": ["sonarr", "radarr"] }, "repair": { "enabled": false, @@ -164,22 +165,27 @@ Full config are [here](doc/config.full.json) - The `allowed_file_types` key is an array of allowed file types that can be downloaded. By default, all movie, tv show and music file types are allowed - The `use_auth` is used to enable basic authentication for the UI. The default value is `false` - The `discord_webhook_url` is used to send notifications to discord +- The `min_file_size` and `max_file_size` keys are used to set the minimum and maximum file size of the torrents that can be downloaded. The default value is `0` and `0` respectively. No min/max file size will be set ##### Debrid Config - The `debrids` key is an array of debrid providers - The `name` key is the name of the debrid provider - The `host` key is the API endpoint of the debrid provider -- The `api_key` key is the API key of the debrid provider +- The `api_key` key is the API key of the debrid provider. This can be comma separated for multiple API keys - The `folder` key is the folder where your debrid folder is mounted(webdav, rclone, zurg etc). e.g `data/realdebrid/torrents/`, `/media/remote/alldebrid/magnets/` - The `rate_limit` key is the rate limit of the debrid provider(null by default) - The `download_uncached` bool key is used to download uncached torrents(disabled by default) - The `check_cached` bool key is used to check if the torrent is cached(disabled by default) +- The `use_webdav` is used to create a webdav server for the debrid Read the [webdav](#webdav) section for more information -##### Repair Config (**BETA**) +- The `use_webdav` bool key is used to create a webdav server for the debrid provider. The default value is `false`. Read the [webdav](#webdav) section for more information + +##### Repair Config The `repair` key is used to enable the repair worker - The `enabled` key is used to enable the repair worker - The `interval` key is the interval in either minutes, seconds, hours, days. Use any of this format, e.g 12:00, 5:00, 1h, 1d, 1m, 1s. - The `run_on_start` key is used to run the repair worker on start +- The `use_webdav` key is used to enable the webdav server for the repair worker. The default value is `false`. Read the [webdav](#webdav) section for more information - The `zurg_url` is the url of the zurg server. Typically `http://localhost:9999` or `http://zurg:9999` - The `auto_process` is used to automatically process the repair worker. This will delete broken symlinks and re-search for missing files @@ -219,6 +225,28 @@ The repair worker is a simple worker that checks for missing files in the Arrs(S - Search for deleted/unreadable files +### WebDAV + +URL: `http://localhost:8282/webdav` or `http://:8080/webdav` +The webdav server is a simple webdav server that allows you to access your debrid files over the web.While most(if not all) debrid providers have their own webdav server, this is useful for fast access to your debrid files. The webdav server is disabled by default. You can disable it by setting the `use_webdav` key to `false` in the config file of the debrid provider. The webdav server listens on port `8080` by default. +##### WebDAV Config +You can set per-debrid provider webdav config in the debrid provider config or globally in the config file using "webdav" key + +You can use the webdav server with media players like Infuse, VidHub or mount it locally with Rclone(See [here](https://rclone.org/webdav/)). A sample rclone file is [here](doc/rclone.conf) + +- The `torrents_refresh_interval` key is used to set the interval in to refresh the torrents. The default value is `15s`. E,g `15s`, `1m`, `1h`, `1d` +- The `download_links_refresh_interval` key is used to set the interval in to refresh the download links. The default value is `40m`. E,g `15s`, `1m`, `1h`, `1d` +- The `workers` key is the maximum number of goroutines for the webdav server. The default value is your CPU cores x 50. This is useful for limiting the number of concurrent requests to the webdav server. + - The `folder_naming` key is used to set the folder naming convention. The default value is `original_no_ext`. The available options are: + - `original_no_ext`: The original file name without the extension + - `original`: The original file name with the extension + - `filename`: The torrent filename + - `filename_no_ext`: The torrent filename without the extension + - `id`: The torrent id +- The `auto_expire_links_after` Download links are deemed old after this time. The default value is `3d`. E,g `15s`, `1m`, `1h`, `1d` +- The `rc_url`, `rc_user`, `rc_pass` keys are used to trigger a vfs refresh on your rclone. This speeds up the process of getting the files. This is useful for rclone users. T + + ### Proxy #### **Note**: Proxy has stopped working for Real Debrid, Debrid Link, and All Debrid. It still works for Torbox. This is due to the changes in the API of the Debrid Providers. diff --git a/doc/compose.yml b/doc/compose.yml new file mode 100644 index 0000000..a3a662c --- /dev/null +++ b/doc/compose.yml @@ -0,0 +1,20 @@ +services: + decypharr: + image: cy01/blackhole:latest # or cy01/blackhole:beta + container_name: decypharr + ports: + - "8282:8282" # qBittorrent + - "8181:8181" # Proxy + user: "1000:1000" + volumes: + - /mnt/:/mnt + - ~/plex/configs/decypharr/:/app # config.json must be in this directory + environment: + - PUID=1000 + - PGID=1000 + - UMASK=002 + - QBIT_PORT=8282 + - PORT=8181 + restart: unless-stopped + depends_on: + - rclone # If you are using rclone with docker \ No newline at end of file diff --git a/doc/config.full.json b/doc/config.full.json index f3eddeb..6f512b6 100644 --- a/doc/config.full.json +++ b/doc/config.full.json @@ -1,14 +1,5 @@ { "debrids": [ - { - "name": "torbox", - "host": "https://api.torbox.app/v1", - "api_key": "torbox_api_key", - "folder": "/mnt/remote/torbox/torrents/", - "rate_limit": "250/minute", - "download_uncached": false, - "check_cached": true - }, { "name": "realdebrid", "host": "https://api.real-debrid.com/rest/1.0", @@ -17,7 +8,19 @@ "rate_limit": "250/minute", "download_uncached": false, "check_cached": false, - "use_webdav": true + "use_webdav": true, + "torrents_refresh_interval": "15s", + "folder_naming": "original_no_ext", + "auto_expire_links_after": "3d" + }, + { + "name": "torbox", + "host": "https://api.torbox.app/v1", + "api_key": "torbox_api_key", + "folder": "/mnt/remote/torbox/torrents/", + "rate_limit": "250/minute", + "download_uncached": false, + "check_cached": true }, { "name": "debridlink", diff --git a/doc/rclone.conf b/doc/rclone.conf new file mode 100644 index 0000000..be52f6f --- /dev/null +++ b/doc/rclone.conf @@ -0,0 +1,6 @@ +[realdebrid] + +type = webdav +url = http://your-ip-address/webdav/realdebrid +vendor = other +pacer_min_sleep = 0 \ No newline at end of file diff --git a/internal/config/config.go b/internal/config/config.go index ba6a5a4..26a7437 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,6 +7,7 @@ import ( "github.com/goccy/go-json" "os" "path/filepath" + "strings" "sync" ) @@ -89,7 +90,6 @@ type WebDav struct { type Config struct { LogLevel string `json:"log_level"` - Debrid Debrid `json:"debrid"` Debrids []Debrid `json:"debrids"` Proxy Proxy `json:"proxy"` MaxCacheSize int `json:"max_cache_size"` @@ -128,12 +128,8 @@ func (c *Config) loadConfig() error { return fmt.Errorf("error unmarshaling config: %w", err) } - if c.Debrid.Name != "" { - c.Debrids = append(c.Debrids, c.Debrid) - } - for i, debrid := range c.Debrids { - c.Debrids[i] = c.GetDebridWebDav(debrid) + c.Debrids[i] = c.updateDebrid(debrid) } if len(c.AllowedExt) == 0 { @@ -312,7 +308,17 @@ func (c *Config) NeedsSetup() bool { return false } -func (c *Config) GetDebridWebDav(d Debrid) Debrid { +func (c *Config) updateDebrid(d Debrid) Debrid { + + apiKeys := strings.Split(d.APIKey, ",") + newApiKeys := make([]string, 0, len(apiKeys)) + for _, key := range apiKeys { + key = strings.TrimSpace(key) + if key != "" { + newApiKeys = append(newApiKeys, key) + } + } + d.APIKey = strings.Join(newApiKeys, ",") if !d.UseWebDav { return d @@ -331,7 +337,7 @@ func (c *Config) GetDebridWebDav(d Debrid) Debrid { d.FolderNaming = cmp.Or(c.WebDav.FolderNaming, "original_no_ext") } if d.AutoExpireLinksAfter == "" { - d.AutoExpireLinksAfter = cmp.Or(c.WebDav.AutoExpireLinksAfter, "24h") + d.AutoExpireLinksAfter = cmp.Or(c.WebDav.AutoExpireLinksAfter, "3d") // 2 days } return d }