Tracks have permalinks now
This commit is contained in:
37
jobs/refresh-track-titles/main.go
Normal file
37
jobs/refresh-track-titles/main.go
Normal file
@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Refreshing track titles")
|
||||
|
||||
// Get a stream of all soundtracks
|
||||
soundtracks, err := arn.StreamSoundTracks()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Iterate over the stream
|
||||
for track := range soundtracks {
|
||||
sync(track)
|
||||
}
|
||||
|
||||
color.Green("Finished.")
|
||||
}
|
||||
|
||||
func sync(track *arn.SoundTrack) {
|
||||
for _, media := range track.Media {
|
||||
media.RefreshMetaData()
|
||||
println(media.Service, media.Title)
|
||||
}
|
||||
|
||||
err := track.Save()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user