Added patch to fix airing dates
This commit is contained in:
parent
52e83a4a37
commit
b6d6ce92da
@ -24,6 +24,7 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The rest gets sorted by airing status
|
||||||
switch anime.Status {
|
switch anime.Status {
|
||||||
case "current":
|
case "current":
|
||||||
highPriority = append(highPriority, anime)
|
highPriority = append(highPriority, anime)
|
||||||
|
44
patches/fix-airing-dates/fix-airing-dates.go
Normal file
44
patches/fix-airing-dates/fix-airing-dates.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
"github.com/fatih/color"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
now := time.Now()
|
||||||
|
futureThreshold := 8 * 7 * 24 * time.Hour
|
||||||
|
|
||||||
|
for anime := range arn.MustStreamAnime() {
|
||||||
|
modified := false
|
||||||
|
|
||||||
|
// Try to find incorrect airing dates
|
||||||
|
for _, episode := range anime.Episodes().Items {
|
||||||
|
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 = ""
|
||||||
|
|
||||||
|
modified = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if modified == true {
|
||||||
|
arn.PanicOnError(anime.Episodes().Save())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user