Fixed episode deletion

This commit is contained in:
2019-10-10 15:01:16 +09:00
parent 3a77455422
commit 5ec435cf99
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,25 @@
package main
import (
"github.com/akyoto/color"
"github.com/animenotifier/notify.moe/arn"
)
func main() {
color.Yellow("Fixing non-existing anime relations")
defer arn.Node.Close()
count := 0
for episode := range arn.StreamEpisodes() {
anime := episode.Anime()
if anime == nil {
color.Yellow(episode.AnimeID)
episode.Delete()
count++
}
}
color.Green("Finished deleting %d episodes.", count)
}