40 lines
861 B
Go
Raw Normal View History

2017-10-03 08:08:52 +02:00
package main
import (
"fmt"
"time"
2019-04-23 14:45:17 +09:00
"github.com/akyoto/color"
2019-06-03 18:32:43 +09:00
"github.com/animenotifier/notify.moe/arn"
2017-10-03 08:08:52 +02:00
)
func main() {
2017-11-01 20:11:05 +01:00
defer arn.Node.Close()
2017-10-03 08:08:52 +02:00
now := time.Now()
futureThreshold := 8 * 7 * 24 * time.Hour
2017-11-01 20:11:05 +01:00
for anime := range arn.StreamAnime() {
2017-10-03 08:08:52 +02:00
// Try to find incorrect airing dates
2019-08-28 17:06:42 +09:00
for _, episode := range anime.Episodes() {
2017-10-03 08:08:52 +02:00
if episode.AiringDate.Start == "" {
continue
}
startTime, err := time.Parse(time.RFC3339, episode.AiringDate.Start)
if err == nil && startTime.Sub(now) < futureThreshold {
continue
}
// Definitely wrong airing date on this episode
fmt.Printf("%s | %s | Ep %d | %s\n", anime.ID, color.YellowString(anime.Title.Canonical), episode.Number, episode.AiringDate.Start)
// Delete the wrong airing date
episode.AiringDate.Start = ""
episode.AiringDate.End = ""
2019-09-16 08:17:20 +09:00
episode.Save()
2017-10-03 08:08:52 +02:00
}
}
}