-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsettings.go
61 lines (53 loc) · 1.15 KB
/
settings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"net/http"
"encoding/json"
)
type Settings struct {
// users configured
Users map[string]User
// require client to log in
RequireUser bool
// ===== source settings =====
// what.cd settings
WhatCD *WhatCDSetings
// === downloader settings ===
// transmission settings
TransmissionBT *TransmissionBTSettings
// === automation settings ===
// move files after download
MoveAfterDownload bool
// use github.com/go-fsnotify/fsnotify
UseNotify bool
// if not, how often to poll
PollInterval int
// root of music library
MoveRoot string
// match files with
}
type User struct {
Password string
}
type WhatCDSetings struct {}
type TransmissionBTSettings struct {}
func SettingsHandler(w http.ResponseWriter, r *http.Request) {
users := make(map[string]User)
users["Peter"] = User{
Password: "p@$$word",
}
settings := Settings{
Users: users,
RequireUser: false,
WhatCD: &WhatCDSetings{},
TransmissionBT: &TransmissionBTSettings{},
MoveAfterDownload: false,
UseNotify: false,
PollInterval: 300,
MoveRoot: "/tmp",
}
b, err := json.Marshal(settings)
if err != nil {
panic(err)
}
w.Write(b)
}