Added new patch to mark current anime

This commit is contained in:
Eduard Urbach 2018-07-01 10:58:08 +09:00
parent 2d615279e0
commit dba7159082

View File

@ -0,0 +1,32 @@
package main
import (
"fmt"
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
color.Yellow("Marking current month as current")
defer color.Green("Finished")
defer arn.Node.Close()
now := time.Now()
currentYear := now.Year()
currentMonth := now.Month()
for anime := range arn.StreamAnime() {
animeStart := anime.StartDateTime()
if anime.Status != "current" && animeStart.Year() == currentYear && animeStart.Month() == currentMonth {
fmt.Println(anime)
anime.Status = "current"
anime.Save()
}
}
time.Sleep(1 * time.Second)
}