|
|
|
@ -7,6 +7,7 @@ import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"log"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"gitea.ravianand.me/Dan6erbond/listy/core"
|
|
|
|
|
"gitea.ravianand.me/Dan6erbond/listy/lists"
|
|
|
|
@ -35,6 +36,13 @@ to quickly create a Cobra application.`,
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
repeat, err := cmd.Flags().GetDuration("repeat")
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for range time.Tick(repeat) {
|
|
|
|
|
for _, user := range users {
|
|
|
|
|
numAdded, err := lists.SyncMonthlyList(ctx, app, user)
|
|
|
|
|
|
|
|
|
@ -47,6 +55,11 @@ to quickly create a Cobra application.`,
|
|
|
|
|
} else {
|
|
|
|
|
fmt.Printf("Added %d songs for %s", numAdded, user.SpotifyID)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if repeat == time.Duration(0) {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
@ -62,5 +75,5 @@ func init() {
|
|
|
|
|
|
|
|
|
|
// Cobra supports local flags which will only run when this command
|
|
|
|
|
// is called directly, e.g.:
|
|
|
|
|
// syncCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
|
|
|
|
syncCmd.Flags().DurationP("repeat", "r", 0, "Repeat duration for sync process")
|
|
|
|
|
}
|
|
|
|
|