Added soundtrack download
This commit is contained in:
parent
796a9b2b96
commit
2d88ffd0a8
3
audio/.gitignore
vendored
Normal file
3
audio/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!*/
|
||||||
|
!.gitignore
|
37
jobs/soundtrack-download/soundtrack-download.go
Normal file
37
jobs/soundtrack-download/soundtrack-download.go
Normal 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.")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user