Added soundtrack download

This commit is contained in:
Eduard Urbach 2018-03-11 02:10:49 +01:00
parent 796a9b2b96
commit 2d88ffd0a8
2 changed files with 40 additions and 0 deletions

3
audio/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*
!*/
!.gitignore

View File

@ -0,0 +1,37 @@
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() {
fmt.Println(track.ID, track.Title)
err := track.Download()
if err != nil {
color.Red(err.Error())
continue
}
fmt.Println(track.File)
// Save the file information
track.Save()
// Delay a little
time.Sleep(delayBetweenRequests)
}
color.Green("Finished.")
}