Added patch to replace anime in user lists
This commit is contained in:
parent
186a00a240
commit
07403f01f2
31
patches/animelist-replace-anime/animelist-replace-anime.go
Normal file
31
patches/animelist-replace-anime/animelist-replace-anime.go
Normal file
@ -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()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user