return f.GID.Group()
}
-func (f *File) MyList() {
- _ = f.LID[0]
+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
return nil
}
+func (u *User) MyListAnime(aid AID) *MyListAnime {
+ if u != nil {
+ return u.UID.MyListAnime(aid)
+ }
+ return nil
+}
+
+func (a *Anime) MyList(adb *AniDB) <-chan *MyListAnime {
+ ch := make(chan *MyListAnime, 1)
+
+ if a == nil {
+ ch <- nil
+ close(ch)
+ return ch
+ }
+
+ go func() {
+ user := <-adb.GetCurrentUser()
+ if user == nil || user.UID < 1 {
+ ch <- nil
+ close(ch)
+ return
+ }
+
+ ch <- <-adb.MyListAnime(a.AID)
+ close(ch)
+ }()
+ return ch
+}
+
func (adb *AniDB) MyListAnime(aid AID) <-chan *MyListAnime {
ch := make(chan *MyListAnime, 1)
var _ cacheable = &MyListEntry{}
+func (uid UID) MyList(fid FID) *MyListEntry {
+ if f := fid.File(); f == nil {
+ return nil
+ } else if lid := f.LID[uid]; lid < 1 {
+ return nil
+ } else {
+ return f.LID[uid].MyListEntry()
+ }
+}
+
func (lid LID) MyListEntry() *MyListEntry {
var e MyListEntry
if CacheGet(&e, "lid", lid) == nil {