From f5f4a78cb91e2ac841a4822bd7eef4a6a00e53a5 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 28 Nov 2019 10:00:08 +0900 Subject: [PATCH] Fix blurred episodes --- arn/Episode.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arn/Episode.go b/arn/Episode.go index 2ecde62e..fa815cc6 100644 --- a/arn/Episode.go +++ b/arn/Episode.go @@ -2,6 +2,7 @@ package arn import ( "fmt" + "time" "github.com/aerogo/nano" "github.com/animenotifier/notify.moe/arn/validate" @@ -66,12 +67,13 @@ func (episode *Episode) Link() string { // Available tells you whether the episode is available (triggered when it has a link). func (episode *Episode) Available() bool { - return len(episode.Links) > 0 -} + availableDate, err := time.Parse(time.RFC3339, episode.AiringDate.End) -// AvailableOn tells you whether the episode is available on a given service. -func (episode *Episode) AvailableOn(serviceName string) bool { - return episode.Links[serviceName] != "" + if err != nil { + return false + } + + return time.Now().UnixNano() > availableDate.UnixNano() } // Previous returns the previous episode, if available.