forked from jrudio/go-sonarr-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
86 lines (71 loc) · 1.52 KB
/
main.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package main
import (
"fmt"
"os"
"github.com/urfave/cli"
)
const (
homeFolderName = ".go-sonarr-client"
)
func main() {
app := cli.NewApp()
app.Name = "sonarr"
app.Usage = "Use Sonarr from the terminal"
app.Version = "0.0.1"
// create a new goroutine to gracefully shutdown datastore
// shutdown := make(chan int, 1)
// wg := sync.WaitGroup{}
// cli.OsExiter = func(c int) {
// shutdown <- c
// }
// wg.Add(1)
// go func(shutdown chan int) {
// defer wg.Done()
// exitCode := <-shutdown
// db.Close()
// os.Exit(exitCode)
// }(shutdown)
app.Commands = []cli.Command{
cli.Command{
Name: "save",
Usage: "save will prompt you to enter the url and api key for sonarr",
Action: save,
},
cli.Command{
Name: "credentials",
Usage: "print your sonarr credentials",
Action: getCredentials,
},
cli.Command{
Name: "search",
Usage: "search tvdb for a show",
Action: search,
},
cli.Command{
Name: "show",
Usage: "display series info",
Action: showSeriesInfo,
},
cli.Command{
Name: "add",
Usage: "add a series to wanted",
Action: addSeries,
},
// cli.Command{
// Name: "delete",
// Usage: "delete a movie from wanted",
// Action: deleteMovie,
// },
cli.Command{
Name: "unlock",
Usage: "remove the PID lock file in the case a bug interrupts our app",
Action: unlock,
},
}
if err := app.Run(os.Args); err != nil {
fmt.Printf("cli for sonarr failed to run: %v\n", err)
os.Exit(1)
}
// shutdown <- 0
// wg.Wait()
}