X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=file.go;h=73063117553cbab0850ca4c657c53285d8663dad;hb=fbcc6296ee6547aa88c6e6b4491a617a916ee107;hp=08da122f7e33612fdb8ca45bd2aeb26a9ac4a833;hpb=879efc4e59ea18f8d84fa57670adaf2e718853fc;p=go-anidb.git diff --git a/file.go b/file.go index 08da122..7306311 100644 --- a/file.go +++ b/file.go @@ -41,6 +41,7 @@ type File struct { GID GID LID LIDMap + EpisodeString string EpisodeNumber misc.EpisodeList Incomplete bool @@ -74,6 +75,25 @@ type File struct { Cached time.Time } +func (f *File) Anime() *Anime { + return f.AID.Anime() +} + +func (f *File) Episode() *Episode { + return f.EID.Episode() +} + +func (f *File) Group() *Group { + return f.GID.Group() +} + +func (f *File) UserMyList(user *User) *MyListEntry { + if f != nil && user != nil && f.LID[user.UID] > 0 { + return f.LID[user.UID].MyListEntry() + } + return nil +} + type RelatedEpisodes map[EID]float32 func (er RelatedEpisodes) MarshalJSON() ([]byte, error) {