40 lines
549 B
Go
Raw Normal View History

2018-03-11 01:10:49 +00:00
package main
import (
"fmt"
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
const delayBetweenRequests = 1000
func main() {
color.Yellow("Downloading soundtracks")
defer arn.Node.Close()
for track := range arn.StreamSoundTracks() {
2018-03-11 01:29:46 +00:00
if track.IsDraft {
continue
}
2018-03-11 01:20:30 +00:00
fmt.Println(track.Title)
2018-03-11 01:10:49 +00:00
err := track.Download()
if err != nil {
color.Red(err.Error())
continue
}
// Save the file information
track.Save()
// Delay a little
time.Sleep(delayBetweenRequests)
}
color.Green("Finished.")
}