diff --git a/patches/animelist-replace-anime/animelist-replace-anime.go b/patches/animelist-replace-anime/animelist-replace-anime.go new file mode 100644 index 00000000..58cd0c8a --- /dev/null +++ b/patches/animelist-replace-anime/animelist-replace-anime.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "os" + + "github.com/animenotifier/notify.moe/arn" +) + +func main() { + defer arn.Node.Close() + + oldID := os.Args[1] + newID := os.Args[2] + + if oldID == "" || newID == "" { + fmt.Println("Parameters: [old ID] [new ID]") + os.Exit(1) + } + + for animeList := range arn.StreamAnimeLists() { + item := animeList.Find(oldID) + + if item == nil { + continue + } + + item.AnimeID = newID + animeList.Save() + } +}