Updated API

This commit is contained in:
2017-06-27 14:38:36 +02:00
parent 2b471b871d
commit ab253000ef
9 changed files with 103 additions and 7 deletions

View File

@ -11,7 +11,7 @@ func main() {
color.Yellow("Adding empty anime lists to users who don't have one")
// Get a stream of all users
allUsers, err := arn.AllUsers()
allUsers, err := arn.StreamUsers()
if err != nil {
panic(err)

View File

@ -6,7 +6,7 @@ import (
func main() {
// Get a stream of all users
allUsers, err := arn.AllUsers()
allUsers, err := arn.StreamUsers()
if err != nil {
panic(err)

View File

@ -6,7 +6,7 @@ func main() {
// color.Yellow("Deleting private user data")
// // Get a stream of all users
// allUsers, err := arn.AllUsers()
// allUsers, err := arn.StreamUsers()
// if err != nil {
// panic(err)

View File

@ -13,7 +13,7 @@ func main() {
arn.DB.DeleteTable("GoogleToUser")
// Get a stream of all users
allUsers, err := arn.AllUsers()
allUsers, err := arn.StreamUsers()
if err != nil {
panic(err)

View File

@ -0,0 +1,34 @@
package main
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
// Get a stream of all anime
allAnime, err := arn.AllAnime()
if err != nil {
panic(err)
}
// Iterate over the stream
for _, anime := range allAnime {
for _, trailer := range anime.Trailers {
// trailer.ServiceID = trailer.DeprecatedVideoID
println(trailer.DeprecatedVideoID)
trailer.ServiceID = trailer.DeprecatedVideoID
}
if anime.Trailers == nil {
anime.Trailers = []*arn.ExternalMedia{}
}
err := anime.Save()
if err != nil {
color.Red("Error saving anime: %v", err)
}
}
}