Fix blurred episodes
This commit is contained in:
parent
7d72ddb79a
commit
f5f4a78cb9
@ -2,6 +2,7 @@ package arn
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/aerogo/nano"
|
"github.com/aerogo/nano"
|
||||||
"github.com/animenotifier/notify.moe/arn/validate"
|
"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).
|
// Available tells you whether the episode is available (triggered when it has a link).
|
||||||
func (episode *Episode) Available() bool {
|
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.
|
if err != nil {
|
||||||
func (episode *Episode) AvailableOn(serviceName string) bool {
|
return false
|
||||||
return episode.Links[serviceName] != ""
|
}
|
||||||
|
|
||||||
|
return time.Now().UnixNano() > availableDate.UnixNano()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Previous returns the previous episode, if available.
|
// Previous returns the previous episode, if available.
|
||||||
|
Loading…
Reference in New Issue
Block a user