add category & savepath params for torrents
This commit is contained in:
10
main.go
10
main.go
@@ -373,7 +373,15 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if err := torrentClient.AddTorrentFromMemory(data, map[string]string{}); err != nil {
|
||||
opts := make(map[string]string)
|
||||
if category, ok := os.LookupEnv("QBITTORRENT_CATEGORY"); ok {
|
||||
opts["category"] = category
|
||||
}
|
||||
if savePath, ok := os.LookupEnv("QBITTORRENT_SAVEPATH"); ok {
|
||||
opts["savepath"] = savePath
|
||||
}
|
||||
|
||||
if err := torrentClient.AddTorrentFromMemory(data, opts); err != nil {
|
||||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user