Adding ability to output to stdout instead of Telegram.
This commit is contained in:
12
cmd/main.go
12
cmd/main.go
@ -15,12 +15,14 @@ func main() {
|
||||
var days int
|
||||
var sectionID int
|
||||
var check bool
|
||||
var text bool
|
||||
var delete bool
|
||||
|
||||
flag.StringVar(&c, "config", "", "Configuration to load")
|
||||
flag.IntVar(&days, "days", 0, "How many days of inactivity to look for on Plex.")
|
||||
flag.IntVar(§ionID, "sectionid", 0, "Plex Section ID")
|
||||
flag.BoolVar(&check, "check", true, "Perform only a check. This will send the message out to Telegram with what can be removed. Does not delete.")
|
||||
flag.BoolVar(&text, "check", false, "This will override the communication to Telegram and print to stdout.")
|
||||
flag.BoolVar(&delete, "delete", false, "Perform the delete task.")
|
||||
flag.Parse()
|
||||
|
||||
@ -42,9 +44,13 @@ func main() {
|
||||
ids, titles := locator.GetTitles(cfg, sectionID, days)
|
||||
|
||||
if check {
|
||||
err = communicator.TelegramPost(cfg, titles)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if text {
|
||||
communicator.StdoutPost(titles)
|
||||
} else {
|
||||
err = communicator.TelegramPost(cfg, titles)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user