Add a way to configure host

This commit is contained in:
Ben Sarmiento
2023-11-07 14:14:33 +01:00
parent d4f309072d
commit d5746fcf5a
5 changed files with 18 additions and 63 deletions

View File

@@ -1,77 +1,22 @@
# zurg-testing
A self-hosted Real-Debrid webdav server written from scratch, alternative to rclone_rd
A self-hosted Real-Debrid webdav server written from scratch, alternative to rclone_rd. Together with [rclone](https://rclone.org/) it can mount your Real-Debrid torrent library into your filesystem.
## How to run zurg in 5 steps
## How to run zurg in 5 steps for Plex
1. Clone this repo `git clone https://github.com/debridmediamanager/zurg-testing.git`
2. Add your token in `config.yml`
3. `sudo mkdir -p /mnt/zurg`
4. Run `docker compose up -d`
5. `time ls -1R /mnt/zurg` You're done!
5. `time ls -1R /mnt/zurg` You're done! If you do edits on your config.yml just do `docker compose restart zurg`.
The server is also exposed to your localhost via port 9999. You can point [Infuse](https://firecore.com/infuse) or any webdav clients to it.
A webdav server is also exposed to your localhost via port `9999`.
> Note: I have only tested this in Mac and Linux
## Why zurg? Why not rclone_rd? Why not Real-Debrid's own webdav?
## Why zurg? Why not X?
- Better performance than anything out there; changes in your library appear instantly (assuming Plex picks it up fast enough)
- You should be able to access every file even if the torrent names are the same so if you have a lot of these, you might notice that zurg will have more files compared to others (e.g. 2 torrents named "Simpsons" but have different seasons, zurg merges all contents in that directory)
- You can configure a flexible directory structure in `config.yml`; you can select individual torrents that should appear on a directory by the ID you see in [DMM](https://debridmediamanager.com/)
- You can configure a flexible directory structure in `config.yml`; you can select individual torrents that should appear on a directory by the ID you see in [DMM](https://debridmediamanager.com/).
- If you've ever experienced Plex scanner being stuck on a file and thereby freezing Plex completely, it should not happen anymore because zurg does a comprehensive check if a torrent is dead or not
## config.yml
You need a `config.yml` created before you can use zurg
```yaml
# Zurg configuration version
zurg: v1
token: YOUR_TOKEN_HERE
port: 9999
concurrent_workers: 10 # the higher the number the faster zurg runs through your library but too high and you will get rate limited
check_for_changes_every_secs: 15 # zurg polls real-debrid for changes in your library
info_cache_time_hours: 12 # how long do we want to check if a torrent is still alive or dead? 12 to 24 hours is good enough
# zurg can repair broken links, but it doesn't mean it will appear on the same location (especially if there's only 1 episode missing)
# e.g. i was missing e06 of Better.Call.Saul.S03.2160p.NF.WEBRip.DD5.1.x264-ViSUM
# after zurg re-added the file, it appeared on a different directory:
# Better.Call.Saul.S03E06.2160p.NF.WEBRip.DD5.1.x264-ViSUM.mkv
enable_repair: false # BEWARE! THERE CAN ONLY BE 1 INSTANCE OF ZURG THAT SHOULD REPAIR YOUR TORRENTS
# List of directory definitions and their filtering rules
directories:
# Configuration for TV shows
shows:
group: media # directories on different groups have duplicates of the same torrent
filters:
- regex: /season[\s\.]?\d/i # Capture torrent names with the term 'season' in any case
- regex: /saison[\s\.]?\d/i # For non-English namings
- regex: /stagione[\s\.]?\d/i # if there's french, there should be italian too
- regex: /s\d\d/i # Capture common season notations like S01, S02, etc.
- regex: /\btv/i # anything that has TV in it is a TV show, right?
- contains: complete
- contains: seasons
# Configuration for movies
movies:
group: media # because movies and shows are in the same group, and shows come first before movies, all torrents that doesn't fall into shows will fall into movies
filters:
- regex: /.*/ # you cannot leave a directory without filters because it will not have any torrents in it
"ALL MY STUFFS":
group: all # notice the group now is "all", which means it will have all the torrents of shows+movies combined because this directory is alone in this group
filters:
- regex: /.*/
"Kids":
group: kids
filters:
- not_contains: xxx # Ensures adult content is excluded
- id: XFPQ5UCMUVAEG # Specific inclusion by torrent ID
- id: VDRPYNRPQHEXC
- id: YELNX3XR5XJQM
```
## Please read our [wiki](https://github.com/debridmediamanager/zurg-testing/wiki) for more information!

View File

@@ -35,7 +35,7 @@ func main() {
mux := http.NewServeMux()
net.Router(mux, config, torrentMgr, cache)
addr := fmt.Sprintf(":%s", config.GetPort())
addr := fmt.Sprintf("%s:%s", config.GetHost(), config.GetPort())
server := &http.Server{Addr: addr, Handler: mux}
mountPoint := config.GetMountPoint()

View File

@@ -2,6 +2,7 @@
zurg: v1
token: YOUR_RD_API_TOKEN # https://real-debrid.com/apitoken
host: "[::]" # do not change this if you are running it inside a docker container
port: 9999 # do not change this if you are running it inside a docker container
concurrent_workers: 10
check_for_changes_every_secs: 15

View File

@@ -15,6 +15,7 @@ type ConfigInterface interface {
GetRefreshEverySeconds() int
GetCacheTimeHours() int
EnableRepair() bool
GetHost() string
GetPort() string
GetDirectories() []string
MeetsConditions(directory, torrentID, torrentName string, fileNames []string) bool

View File

@@ -3,6 +3,7 @@ package config
type ZurgConfig struct {
Version string `yaml:"zurg"`
Token string `yaml:"token"`
Host string `yaml:"host"`
Port string `yaml:"port"`
NumOfWorkers int `yaml:"concurrent_workers"`
RefreshEverySeconds int `yaml:"check_for_changes_every_secs"`
@@ -17,6 +18,13 @@ func (z *ZurgConfig) GetToken() string {
return z.Token
}
func (z *ZurgConfig) GetHost() string {
if z.Host == "" {
return "[::]"
}
return z.Host
}
func (z *ZurgConfig) GetPort() string {
if z.Port == "" {
return "9999"