Пример #1
0
		public AnimeGroup_User GetUserRecord(ISession session, int userID)
		{
			AnimeGroup_UserRepository repUser = new AnimeGroup_UserRepository();
			return repUser.GetByUserAndGroupID(session, userID, this.AnimeGroupID);
		}
Пример #2
0
        public void UpdateGroupFilterUsingGroup(int groupid)
        {
            AnimeGroupRepository repGroups = new AnimeGroupRepository();
            AnimeGroup_UserRepository repUserGroups = new AnimeGroup_UserRepository();
            JMMUserRepository repUser = new JMMUserRepository();
            GroupFilterRepository repGrpFilter = new GroupFilterRepository();

            AnimeGroup grp = repGroups.GetByID(groupid);
            if (grp.AnimeGroupParentID.HasValue)
                return;
            foreach (JMMUser user in repUser.GetAll())
            {
                AnimeGroup_User userRec = repUserGroups.GetByUserAndGroupID(user.JMMUserID, groupid);
            
                Dictionary<int, HashSet<int>> groupfilters;
                if (StatUserGroupFilter.ContainsKey(user.JMMUserID))
                    groupfilters = StatUserGroupFilter[user.JMMUserID];
                else
                {
                    groupfilters = new Dictionary<int, HashSet<int>>();
                    StatUserGroupFilter.Add(user.JMMUserID, groupfilters);
                }
                List<GroupFilter> gfs = repGrpFilter.GetAll();
                GroupFilter gfgf = new GroupFilter();
                gfgf.GroupFilterName = "All";
                gfs.Add(gfgf);

                foreach (GroupFilter gf in gfs)
                {
                    HashSet<int> groups;
                    if (groupfilters.ContainsKey(gf.GroupFilterID))
                        groups = groupfilters[gf.GroupFilterID];
                    else
                    {
                        groups = new HashSet<int>();
                        groupfilters.Add(gf.GroupFilterID, groups);
                    }
                    if (groups.Contains(groupid))
                        groups.Remove(groupid);
                    if (EvaluateGroupFilter(gf, grp, user, userRec))
                        groups.Add(grp.AnimeGroupID);
                }
            }
        }
Пример #3
0
        public void UpdatePlexAnimeGroup(ISession session, AnimeGroup grp, List<AnimeSeries> allSeries)
	    {
            JMMUserRepository repUser = new JMMUserRepository();
            AnimeGroup_UserRepository repUserGroups = new AnimeGroup_UserRepository();
	        foreach (JMMUser user in repUser.GetAll(session))
	        {
                AnimeGroup_User userRec = repUserGroups.GetByUserAndGroupID(session, user.JMMUserID, grp.AnimeGroupID);
	            Dictionary<int, Video> cdic;
	            if (StatPlexGroupsCache.ContainsKey(user.JMMUserID))
	                cdic = StatPlexGroupsCache[user.JMMUserID];
	            else
	            {
	                cdic = new Dictionary<int, Video>();
	                StatPlexGroupsCache[user.JMMUserID] = cdic;
	            }
	            cdic[grp.AnimeGroupID]=JMMServiceImplementationPlex.VideoFromAnimeGroup(session,grp,user.JMMUserID,allSeries);
	        }
	    }
Пример #4
0
        public void UpdateGroupFilterUsingUser(int userid)
        {
            AnimeGroupRepository repGroups = new AnimeGroupRepository();
            AnimeGroup_UserRepository repUserGroups = new AnimeGroup_UserRepository();
            JMMUserRepository repUser = new JMMUserRepository();
            GroupFilterRepository repGrpFilter = new GroupFilterRepository();
            JMMUser user = repUser.GetByID(userid);
            if (user == null)
                return;
            Dictionary<int, HashSet<int>> groupfilters;
            if (StatUserGroupFilter.ContainsKey(user.JMMUserID))
                groupfilters = StatUserGroupFilter[user.JMMUserID];
            else
            {
                groupfilters = new Dictionary<int, HashSet<int>>();
                StatUserGroupFilter.Add(user.JMMUserID, groupfilters);
            }
            List<GroupFilter> gfs = repGrpFilter.GetAll();
		    GroupFilter gfgf = new GroupFilter();
			gfgf.GroupFilterName = "All";
            gfs.Add(gfgf);
            foreach(GroupFilter gf in gfs)
            {
                HashSet<int> groups;
                if (groupfilters.ContainsKey(gf.GroupFilterID))
                    groups = groupfilters[gf.GroupFilterID];
                else
                {
                    groups = new HashSet<int>();
                    groupfilters.Add(gf.GroupFilterID, groups);
                }
                groups.Clear();
                List<AnimeGroup> allGrps = repGroups.GetAllTopLevelGroups(); // No Need of subgroups

                foreach (AnimeGroup grp in allGrps)
                {
                    AnimeGroup_User userRec = repUserGroups.GetByUserAndGroupID(user.JMMUserID, grp.AnimeGroupID);
                    if (EvaluateGroupFilter(gf, grp, user, userRec))
                        groups.Add(grp.AnimeGroupID);
                }
            }
        }
Пример #5
0
 public void UpdateKodiAnimeGroup(ISession session, AnimeGroup grp, List<AnimeSeries> allSeries)
 {
     JMMUserRepository repUser = new JMMUserRepository();
     AnimeGroup_UserRepository repUserGroups = new AnimeGroup_UserRepository();
     foreach (JMMUser user in repUser.GetAll(session))
     {
         AnimeGroup_User userRec = repUserGroups.GetByUserAndGroupID(session, user.JMMUserID, grp.AnimeGroupID);
         Dictionary<int, JMMContracts.KodiContracts.Video> cdic;
         if (StatKodiGroupsCache.ContainsKey(user.JMMUserID))
             cdic = StatKodiGroupsCache[user.JMMUserID];
         else
         {
             cdic = new Dictionary<int, JMMContracts.KodiContracts.Video>();
             StatKodiGroupsCache[user.JMMUserID] = cdic;
         }
         cdic[grp.AnimeGroupID] = KodiHelper.VideoFromAnimeGroup(session, grp, user.JMMUserID, allSeries);
     }
 }