当前位置: 首页>>代码示例>>C#>>正文


C# AnimeSeriesRepository.GetAll方法代码示例

本文整理汇总了C#中JMMServer.Repositories.AnimeSeriesRepository.GetAll方法的典型用法代码示例。如果您正苦于以下问题:C# AnimeSeriesRepository.GetAll方法的具体用法?C# AnimeSeriesRepository.GetAll怎么用?C# AnimeSeriesRepository.GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JMMServer.Repositories.AnimeSeriesRepository的用法示例。


在下文中一共展示了AnimeSeriesRepository.GetAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IncrementalTvDBUpdate

		/// <summary>
		/// Used to get a list of TvDB Series ID's that require updating
		/// </summary>
		/// <param name="tvDBIDs">The list Of Series ID's that need to be updated. Pass in an empty list</param>
		/// <returns>The current server time before the update started</returns>
		public string IncrementalTvDBUpdate(ref List<int> tvDBIDs, ref bool tvDBOnline)
		{
			// check if we have record of doing an automated update for the TvDB previously
			// if we have then we have kept a record of the server time and can do a delta update
			// otherwise we need to do a full update and keep a record of the time

			List<int> allTvDBIDs = new List<int>();
			tvDBIDs = new List<int>();
			tvDBOnline = true;

			try
			{
				CrossRef_AniDB_TvDBRepository repCrossRef = new CrossRef_AniDB_TvDBRepository();
				AnimeSeriesRepository repSeries = new AnimeSeriesRepository();

				// record the tvdb server time when we started
				// we record the time now instead of after we finish, to include any possible misses
				string currentTvDBServerTime = CurrentServerTime;
				if (currentTvDBServerTime.Length == 0)
				{
					tvDBOnline = false;
					return currentTvDBServerTime;
				}

				foreach (AnimeSeries ser in repSeries.GetAll())
				{
					List<CrossRef_AniDB_TvDBV2> xrefs = ser.GetCrossRefTvDBV2();
					if (xrefs == null) continue;

					foreach (CrossRef_AniDB_TvDBV2 xref in xrefs)
					{
						if (!allTvDBIDs.Contains(xref.TvDBID)) allTvDBIDs.Add(xref.TvDBID);
					}
				}

				// get the time we last did a TvDB update
				// if this is the first time it will be null
				// update the anidb info ever 24 hours
				ScheduledUpdateRepository repSched = new ScheduledUpdateRepository();
				ScheduledUpdate sched = repSched.GetByUpdateType((int)ScheduledUpdateType.TvDBInfo);

				string lastServerTime = "";
				if (sched != null)
				{
					TimeSpan ts = DateTime.Now - sched.LastUpdate;
					logger.Trace("Last tvdb info update was {0} hours ago", ts.TotalHours.ToString());
					if (!string.IsNullOrEmpty(sched.UpdateDetails))
						lastServerTime = sched.UpdateDetails;

					// the UpdateDetails field for this type will actually contain the last server time from
					// TheTvDB that a full update was performed
				}


				// get a list of updates from TvDB since that time
				if (lastServerTime.Length > 0)
				{
					List<int> seriesList = GetUpdatedSeriesList(lastServerTime);
					logger.Trace("{0} series have been updated since last download", seriesList.Count.ToString());
					logger.Trace("{0} TvDB series locally", allTvDBIDs.Count.ToString());

					foreach (int id in seriesList)
					{
						if (allTvDBIDs.Contains(id)) tvDBIDs.Add(id);
					}
					logger.Trace("{0} TvDB local series have been updated since last download", tvDBIDs.Count.ToString());
				}
				else
				{
					// use the full list
					tvDBIDs = allTvDBIDs;
				}

				return currentTvDBServerTime;
			}
			catch (Exception ex)
			{
				logger.ErrorException("IncrementalTvDBUpdate: "+ ex.ToString(), ex);
				return "";
			}
		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:86,代码来源:TvDBHelper.cs

示例2: ScanForMatches

		public static void ScanForMatches()
		{
			AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
			List<AnimeSeries> allSeries = repSeries.GetAll();

			CrossRef_AniDB_OtherRepository repCrossRef = new CrossRef_AniDB_OtherRepository();
			foreach (AnimeSeries ser in allSeries)
			{
				AniDB_Anime anime = ser.GetAnime();
				if (anime == null) continue;

				if (anime.IsMovieDBLinkDisabled) continue;

				// don't scan if it is associated on the TvDB
				if (anime.GetCrossRefTvDBV2().Count > 0) continue;

				// don't scan if it is associated on the MovieDB
				if (anime.GetCrossRefMovieDB() != null) continue;

				// don't scan if it is not a movie
				if (!anime.SearchOnMovieDB)
					continue;

				logger.Trace("Found anime movie without MovieDB association: " + anime.MainTitle);

				CommandRequest_MovieDBSearchAnime cmd = new CommandRequest_MovieDBSearchAnime(ser.AniDB_ID, false);
				cmd.Save();
			}

		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:30,代码来源:MovieDBHelper.cs

示例3: ScanForMatches

		public static void ScanForMatches()
		{
			AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
			List<AnimeSeries> allSeries = repSeries.GetAll();

			CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository();
			List<CrossRef_AniDB_TvDBV2> allCrossRefs = repCrossRef.GetAll();
			List<int> alreadyLinked = new List<int>();
			foreach (CrossRef_AniDB_TvDBV2 xref in allCrossRefs)
			{
				alreadyLinked.Add(xref.AnimeID);
			}

			foreach (AnimeSeries ser in allSeries)
			{
				if (alreadyLinked.Contains(ser.AniDB_ID)) continue;

				AniDB_Anime anime = ser.GetAnime();

				if (anime!= null)
				{
					logger.Trace("Found anime without tvDB association: " + anime.MainTitle);
					if (!anime.SearchOnTvDB) continue;
					if (anime.IsTvDBLinkDisabled)
					{
						logger.Trace("Skipping scan tvDB link because it is disabled: " + anime.MainTitle);
						continue;
					}
				}

				CommandRequest_TvDBSearchAnime cmd = new CommandRequest_TvDBSearchAnime(ser.AniDB_ID, false);
				cmd.Save();
			}

		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:35,代码来源:TvDBHelper.cs

示例4: RecreateAllGroups

        public void RecreateAllGroups()
        {
            try
            {
                // pause queues
                JMMService.CmdProcessorGeneral.Paused = true;
                JMMService.CmdProcessorHasher.Paused = true;
                JMMService.CmdProcessorImages.Paused = true;

                AnimeGroupRepository repGroups = new AnimeGroupRepository();
                AnimeGroup_UserRepository repGroupUser = new AnimeGroup_UserRepository();
                AnimeSeriesRepository repSeries = new AnimeSeriesRepository();

                // get all the old groups
                List<AnimeGroup> oldGroups = repGroups.GetAll();
                List<AnimeGroup_User> oldGroupUsers = repGroupUser.GetAll();

                // create a new group, where we will place all the series temporarily
                AnimeGroup tempGroup = new AnimeGroup();
                tempGroup.GroupName = "AAA Migrating Groups AAA";
                tempGroup.Description = "AAA Migrating Groups AAA";
                tempGroup.SortName = "AAA Migrating Groups AAA";
                tempGroup.DateTimeUpdated = DateTime.Now;
                tempGroup.DateTimeCreated = DateTime.Now;
                repGroups.Save(tempGroup);

                // move all series to the new group
                foreach (AnimeSeries ser in repSeries.GetAll())
                {
                    ser.AnimeGroupID = tempGroup.AnimeGroupID;
                    repSeries.Save(ser, false);
                }

                // delete all the old groups
                foreach (AnimeGroup grp in oldGroups)
                    repGroups.Delete(grp.AnimeGroupID);

                // delete all the old group user records
                foreach (AnimeGroup_User grpUser in oldGroupUsers)
                    repGroupUser.Delete(grpUser.AnimeGroupID);

                // recreate groups
                foreach (AnimeSeries ser in repSeries.GetAll())
                {
                    bool createNewGroup = true;

                    if (ServerSettings.AutoGroupSeries)
                    {
                        List<AnimeGroup> grps = AnimeGroup.GetRelatedGroupsFromAnimeID(ser.AniDB_ID);

                        // only use if there is just one result
                        if (grps != null && grps.Count > 0 && !grps[0].GroupName.Equals("AAA Migrating Groups AAA"))
                        {
                            ser.AnimeGroupID = grps[0].AnimeGroupID;
                            createNewGroup = false;
                        }
                    }

                    if (createNewGroup)
                    {
                        AnimeGroup anGroup = new AnimeGroup();
                        anGroup.Populate(ser);
                        repGroups.Save(anGroup);

                        ser.AnimeGroupID = anGroup.AnimeGroupID;
                    }

                    repSeries.Save(ser, false);
                }

                // delete the temp group
                if (tempGroup.GetAllSeries().Count == 0)
                    repGroups.Delete(tempGroup.AnimeGroupID);

                // create group user records and update group stats
                foreach (AnimeGroup grp in repGroups.GetAll())
                    grp.UpdateStatsFromTopLevel(true, true);

                // un-pause queues
                JMMService.CmdProcessorGeneral.Paused = false;
                JMMService.CmdProcessorHasher.Paused = false;
                JMMService.CmdProcessorImages.Paused = false;
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
            }
        }
开发者ID:,项目名称:,代码行数:88,代码来源:

示例5: SaveUser

        public string SaveUser(Contract_JMMUser user)
        {
            JMMUserRepository repUsers = new JMMUserRepository();

            try
            {
                bool existingUser = false;
                bool updateStats = false;
                JMMUser jmmUser = null;
                if (user.JMMUserID.HasValue)
                {
                    jmmUser = repUsers.GetByID(user.JMMUserID.Value);
                    if (jmmUser == null) return "User not found";
                    existingUser = true;
                }
                else
                {
                    jmmUser = new JMMUser();
                    updateStats = true;
                }

                if (existingUser && jmmUser.IsAniDBUser != user.IsAniDBUser)
                    updateStats = true;

                jmmUser.HideCategories = user.HideCategories;
                jmmUser.IsAniDBUser = user.IsAniDBUser;
                jmmUser.IsTraktUser = user.IsTraktUser;
                jmmUser.IsAdmin = user.IsAdmin;
                jmmUser.Username = user.Username;
                jmmUser.CanEditServerSettings = user.CanEditServerSettings;
                jmmUser.PlexUsers = user.PlexUsers;
                if (string.IsNullOrEmpty(user.Password))
                    jmmUser.Password = "";

                // make sure that at least one user is an admin
                if (jmmUser.IsAdmin == 0)
                {
                    bool adminExists = false;
                    List<JMMUser> users = repUsers.GetAll();
                    foreach (JMMUser userOld in users)
                    {
                        if (userOld.IsAdmin == 1)
                        {
                            if (existingUser)
                            {
                                if (userOld.JMMUserID != jmmUser.JMMUserID) adminExists = true;
                            }
                            else
                                adminExists = true;

                        }
                    }

                    if (!adminExists) return "At least one user must be an administrator";
                }

                repUsers.Save(jmmUser);

                // update stats
                if (updateStats)
                {
                    AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                    foreach (AnimeSeries ser in repSeries.GetAll())
                        ser.QueueUpdateStats();
                }

            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
                return ex.Message;
            }

            return "";
        }
开发者ID:,项目名称:,代码行数:75,代码来源:

示例6: ScanForMatches

		public static void ScanForMatches()
		{
			if (string.IsNullOrEmpty(ServerSettings.MAL_Username) || string.IsNullOrEmpty(ServerSettings.MAL_Password))
			{
				logger.Warn("Won't SCAN MAL, MAL credentials not provided");
				return;
			}

			AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
			List<AnimeSeries> allSeries = repSeries.GetAll();

			CrossRef_AniDB_MALRepository repCrossRef = new CrossRef_AniDB_MALRepository();
			foreach (AnimeSeries ser in allSeries)
			{
				AniDB_Anime anime = ser.GetAnime();
				if (anime == null) continue;

				if (anime.IsMALLinkDisabled) continue;

				// don't scan if it is associated on the TvDB
				List<CrossRef_AniDB_MAL> xrefs = anime.GetCrossRefMAL();
				if (xrefs == null || xrefs.Count == 0)
				{
					logger.Trace(string.Format("Found anime without MAL association: {0} ({1})", anime.AnimeID, anime.MainTitle));

					CommandRequest_MALSearchAnime cmd = new CommandRequest_MALSearchAnime(ser.AniDB_ID, false);
					cmd.Save();
				}
			}

		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:31,代码来源:MALHelper.cs

示例7: GetSeriesWithoutAnyFiles

        public List<Contract_AnimeSeries> GetSeriesWithoutAnyFiles(int userID)
        {
            List<Contract_AnimeSeries> contracts = new List<Contract_AnimeSeries>();

            VideoLocalRepository repVids = new VideoLocalRepository();
            AnimeSeriesRepository repSeries = new AnimeSeriesRepository();

            try
            {
                foreach (AnimeSeries ser in repSeries.GetAll())
                {
                    if (repVids.GetByAniDBAnimeID(ser.AniDB_ID).Count == 0)
                    {
                        contracts.Add(ser.ToContract(ser.GetUserRecord(userID)));
                    }
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
            }
            return contracts;
        }
开发者ID:,项目名称:,代码行数:23,代码来源:

示例8: GetAnimeGroupsForFilter

        public List<Contract_AnimeGroup> GetAnimeGroupsForFilter(int groupFilterID, int userID, bool getSingleSeriesGroups)
        {
            List<Contract_AnimeGroup> retGroups = new List<Contract_AnimeGroup>();
            try
            {
                using (var session = JMMService.SessionFactory.OpenSession())
                {
                    DateTime start = DateTime.Now;
                    GroupFilterRepository repGF = new GroupFilterRepository();

                    JMMUserRepository repUsers = new JMMUserRepository();
                    JMMUser user = repUsers.GetByID(session, userID);
                    if (user == null) return retGroups;

                    GroupFilter gf = null;

                    if (groupFilterID == -999)
                    {
                        // all groups
                        gf = new GroupFilter();
                        gf.GroupFilterName = "All";
                    }
                    else
                    {
                        gf = repGF.GetByID(session, groupFilterID);
                        if (gf == null) return retGroups;
                    }

                    //Contract_GroupFilterExtended contract = gf.ToContractExtended(user);

                    AnimeGroupRepository repGroups = new AnimeGroupRepository();
                    List<AnimeGroup> allGrps = repGroups.GetAll(session);

                    AnimeGroup_UserRepository repUserRecords = new AnimeGroup_UserRepository();
                    List<AnimeGroup_User> userRecords = repUserRecords.GetByUserID(session, userID);
                    Dictionary<int, AnimeGroup_User> dictUserRecords = new Dictionary<int, AnimeGroup_User>();
                    foreach (AnimeGroup_User userRec in userRecords)
                        dictUserRecords[userRec.AnimeGroupID] = userRec;

                    TimeSpan ts = DateTime.Now - start;
                    string msg = string.Format("Got groups for filter DB: {0} - {1} in {2} ms", gf.GroupFilterName, allGrps.Count, ts.TotalMilliseconds);
                    logger.Info(msg);
                    start = DateTime.Now;

                    AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                    List<AnimeSeries> allSeries = new List<AnimeSeries>();
                    if (getSingleSeriesGroups)
                        allSeries = repSeries.GetAll(session);
                    if ((StatsCache.Instance.StatUserGroupFilter.ContainsKey(user.JMMUserID)) && (StatsCache.Instance.StatUserGroupFilter[user.JMMUserID].ContainsKey(gf.GroupFilterID)))
                    {
                        HashSet<int> groups = StatsCache.Instance.StatUserGroupFilter[user.JMMUserID][gf.GroupFilterID];

                        foreach (AnimeGroup grp in allGrps)
                        {
                            AnimeGroup_User userRec = null;
                            if (dictUserRecords.ContainsKey(grp.AnimeGroupID))
                                userRec = dictUserRecords[grp.AnimeGroupID];
                            if (groups.Contains(grp.AnimeGroupID))
                            {
                                Contract_AnimeGroup contractGrp = grp.ToContract(userRec);
                                if (getSingleSeriesGroups)
                                {
                                    if (contractGrp.Stat_SeriesCount == 1)
                                    {
                                        AnimeSeries ser = GetSeriesForGroup(grp.AnimeGroupID, allSeries);
                                        if (ser != null)
                                            contractGrp.SeriesForNameOverride = ser.ToContract(ser.GetUserRecord(session, userID));

                                    }
                                }
                                retGroups.Add(contractGrp);
                            }
                        }
                    }
                    ts = DateTime.Now - start;
                    msg = string.Format("Got groups for filter EVAL: {0} - {1} in {2} ms", gf.GroupFilterName, retGroups.Count, ts.TotalMilliseconds);
                    logger.Info(msg);

                    return retGroups;
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
            }
            return retGroups;
        }
开发者ID:,项目名称:,代码行数:87,代码来源:

示例9: GetAnimeRatings

        public List<Contract_AnimeRating> GetAnimeRatings(int collectionState, int watchedState, int ratingVotedState, int userID)
        {
            List<Contract_AnimeRating> contracts = new List<Contract_AnimeRating>();

            try
            {
                AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                List<AnimeSeries> series = repSeries.GetAll();
                Dictionary<int, AnimeSeries> dictSeries = new Dictionary<int, AnimeSeries>();
                foreach (AnimeSeries ser in series)
                    dictSeries[ser.AniDB_ID] = ser;

                RatingCollectionState _collectionState = (RatingCollectionState)collectionState;
                RatingWatchedState _watchedState = (RatingWatchedState)watchedState;
                RatingVotedState _ratingVotedState = (RatingVotedState)ratingVotedState;

                DateTime start = DateTime.Now;

                AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();

                /*
                // build a dictionary of categories
                AniDB_CategoryRepository repCats = new AniDB_CategoryRepository();
                AniDB_Anime_CategoryRepository repAnimeCat = new AniDB_Anime_CategoryRepository();

                List<AniDB_Category> allCatgeories = repCats.GetAll();
                Dictionary<int, AniDB_Category> allCatgeoriesDict = new Dictionary<int, AniDB_Category>();
                foreach (AniDB_Category cat in allCatgeories)
                    allCatgeoriesDict[cat.CategoryID] = cat;

                List<AniDB_Anime_Category> allAnimeCatgeories = repAnimeCat.GetAll();
                Dictionary<int, List<AniDB_Anime_Category>> allAnimeCatgeoriesDict = new Dictionary<int, List<AniDB_Anime_Category>>(); //
                foreach (AniDB_Anime_Category aniCat in allAnimeCatgeories)
                {
                    if (!allAnimeCatgeoriesDict.ContainsKey(aniCat.AnimeID))
                        allAnimeCatgeoriesDict[aniCat.AnimeID] = new List<AniDB_Anime_Category>();

                    allAnimeCatgeoriesDict[aniCat.AnimeID].Add(aniCat);
                }

                // build a dictionary of titles
                AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();

                List<AniDB_Anime_Title> allTitles = repTitles.GetAll();
                Dictionary<int, List<AniDB_Anime_Title>> allTitlesDict = new Dictionary<int, List<AniDB_Anime_Title>>();
                foreach (AniDB_Anime_Title title in allTitles)
                {
                    if (!allTitlesDict.ContainsKey(title.AnimeID))
                        allTitlesDict[title.AnimeID] = new List<AniDB_Anime_Title>();

                    allTitlesDict[title.AnimeID].Add(title);
                }

                // build a dictionary of tags
                AniDB_TagRepository repTags = new AniDB_TagRepository();
                AniDB_Anime_TagRepository repAnimeTag = new AniDB_Anime_TagRepository();

                List<AniDB_Tag> allTags = repTags.GetAll();
                Dictionary<int, AniDB_Tag> allTagsDict = new Dictionary<int, AniDB_Tag>();
                foreach (AniDB_Tag tag in allTags)
                    allTagsDict[tag.TagID] = tag;

                List<AniDB_Anime_Tag> allAnimeTags = repAnimeTag.GetAll();
                Dictionary<int, List<AniDB_Anime_Tag>> allAnimeTagsDict = new Dictionary<int, List<AniDB_Anime_Tag>>(); //
                foreach (AniDB_Anime_Tag aniTag in allAnimeTags)
                {
                    if (!allAnimeTagsDict.ContainsKey(aniTag.AnimeID))
                        allAnimeTagsDict[aniTag.AnimeID] = new List<AniDB_Anime_Tag>();

                    allAnimeTagsDict[aniTag.AnimeID].Add(aniTag);
                }

                // build a dictionary of languages
                AdhocRepository rep = new AdhocRepository();
                Dictionary<int, LanguageStat> dictAudioStats = rep.GetAudioLanguageStatsForAnime();
                Dictionary<int, LanguageStat> dictSubtitleStats = rep.GetSubtitleLanguageStatsForAnime();

                Dictionary<int, string> dictAnimeVideoQualStats = rep.GetAllVideoQualityByAnime();
                Dictionary<int, AnimeVideoQualityStat> dictAnimeEpisodeVideoQualStats = rep.GetEpisodeVideoQualityStatsByAnime();
                 * */

                List<AniDB_Anime> animes = repAnime.GetAll();

                // user votes
                AniDB_VoteRepository repVotes = new AniDB_VoteRepository();
                List<AniDB_Vote> allVotes = repVotes.GetAll();

                JMMUserRepository repUsers = new JMMUserRepository();
                JMMUser user = repUsers.GetByID(userID);
                if (user == null) return contracts;

                int i = 0;

                foreach (AniDB_Anime anime in animes)
                {
                    i++;

                    // evaluate collection states
                    if (_collectionState == RatingCollectionState.AllEpisodesInMyCollection)
                    {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例10: GetAllEpisodesWithMultipleFiles

        public List<Contract_AnimeEpisode> GetAllEpisodesWithMultipleFiles(int userID, bool onlyFinishedSeries, bool ignoreVariations)
        {
            List<Contract_AnimeEpisode> eps = new List<Contract_AnimeEpisode>();
            try
            {
                AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
                AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();

                Dictionary<int, int> dictSeriesAnime = new Dictionary<int, int>();
                Dictionary<int, bool> dictAnimeFinishedAiring = new Dictionary<int, bool>();
                Dictionary<int, bool> dictSeriesFinishedAiring = new Dictionary<int, bool>();

                if (onlyFinishedSeries)
                {
                    List<AnimeSeries> allSeries = repSeries.GetAll();
                    foreach (AnimeSeries ser in allSeries)
                        dictSeriesAnime[ser.AnimeSeriesID] = ser.AniDB_ID;

                    List<AniDB_Anime> allAnime = repAnime.GetAll();
                    foreach (AniDB_Anime anime in allAnime)
                        dictAnimeFinishedAiring[anime.AnimeID] = anime.FinishedAiring;

                    foreach (KeyValuePair<int, int> kvp in dictSeriesAnime)
                    {
                        if (dictAnimeFinishedAiring.ContainsKey(kvp.Value))
                            dictSeriesFinishedAiring[kvp.Key] = dictAnimeFinishedAiring[kvp.Value];
                    }
                }

                foreach (AnimeEpisode ep in repEps.GetEpisodesWithMultipleFiles(ignoreVariations))
                {
                    if (onlyFinishedSeries)
                    {
                        bool finishedAiring = false;
                        if (dictSeriesFinishedAiring.ContainsKey(ep.AnimeSeriesID))
                            finishedAiring = dictSeriesFinishedAiring[ep.AnimeSeriesID];

                        if (!finishedAiring) continue;

                    }

                    eps.Add(ep.ToContract(true, userID, null));
                }

                return eps;
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
                return eps;
            }
        }
开发者ID:,项目名称:,代码行数:53,代码来源:

示例11: GetAllSeries

        public List<Contract_AnimeSeries> GetAllSeries(int userID)
        {
            AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
            AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
            AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();

            //TODO: Custom Tags: Do I need to add custom tags for searches

            // get all the series
            List<Contract_AnimeSeries> seriesContractList = new List<Contract_AnimeSeries>();

            try
            {

                DateTime start = DateTime.Now;
                DateTime start2 = DateTime.Now;

                List<AnimeSeries> series = repSeries.GetAll();

                List<AniDB_Anime> animes = repAnime.GetAll();
                Dictionary<int, AniDB_Anime> dictAnimes = new Dictionary<int, AniDB_Anime>();
                foreach (AniDB_Anime anime in animes)
                    dictAnimes[anime.AnimeID] = anime;

                TimeSpan ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:Anime:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;

                // tvdb - cross refs
                CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository();
                List<CrossRef_AniDB_TvDBV2> allCrossRefs = repCrossRef.GetAll();
                Dictionary<int, List<CrossRef_AniDB_TvDBV2>> dictCrossRefsV2 = new Dictionary<int, List<CrossRef_AniDB_TvDBV2>>();
                foreach (CrossRef_AniDB_TvDBV2 xref in allCrossRefs)
                {
                    if (!dictCrossRefsV2.ContainsKey(xref.AnimeID))
                        dictCrossRefsV2[xref.AnimeID] = new List<CrossRef_AniDB_TvDBV2>();
                    dictCrossRefsV2[xref.AnimeID].Add(xref);
                }

                ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:TvDB CrossRefs:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;

                // tvdb - series info
                TvDB_SeriesRepository repTvSeries = new TvDB_SeriesRepository();
                List<TvDB_Series> allTvSeries = repTvSeries.GetAll();
                Dictionary<int, TvDB_Series> dictTvSeries = new Dictionary<int, TvDB_Series>();
                foreach (TvDB_Series tvs in allTvSeries)
                    dictTvSeries[tvs.SeriesID] = tvs;

                ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:TvDB:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;

                // moviedb
                CrossRef_AniDB_OtherRepository repOtherCrossRef = new CrossRef_AniDB_OtherRepository();
                List<CrossRef_AniDB_Other> allOtherCrossRefs = repOtherCrossRef.GetAll();
                Dictionary<int, CrossRef_AniDB_Other> dictMovieCrossRefs = new Dictionary<int, CrossRef_AniDB_Other>();
                foreach (CrossRef_AniDB_Other xref in allOtherCrossRefs)
                {
                    if (xref.CrossRefType == (int)CrossRefType.MovieDB)
                        dictMovieCrossRefs[xref.AnimeID] = xref;
                }
                ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:MovieDB:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;

                // MAL
                CrossRef_AniDB_MALRepository repMALCrossRef = new CrossRef_AniDB_MALRepository();
                List<CrossRef_AniDB_MAL> allMALCrossRefs = repMALCrossRef.GetAll();
                Dictionary<int, List<CrossRef_AniDB_MAL>> dictMALCrossRefs = new Dictionary<int, List<CrossRef_AniDB_MAL>>();
                foreach (CrossRef_AniDB_MAL xref in allMALCrossRefs)
                {
                    if (!dictMALCrossRefs.ContainsKey(xref.AnimeID))
                        dictMALCrossRefs[xref.AnimeID] = new List<CrossRef_AniDB_MAL>();
                    dictMALCrossRefs[xref.AnimeID].Add(xref);
                }
                ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:MAL:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;

                // user records
                AnimeSeries_UserRepository repSeriesUser = new AnimeSeries_UserRepository();
                List<AnimeSeries_User> userRecordList = repSeriesUser.GetByUserID(userID);
                Dictionary<int, AnimeSeries_User> dictUserRecords = new Dictionary<int, AnimeSeries_User>();
                foreach (AnimeSeries_User serUser in userRecordList)
                    dictUserRecords[serUser.AnimeSeriesID] = serUser;

                ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:UserRecs:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;

                // default images
                AniDB_Anime_DefaultImageRepository repDefImages = new AniDB_Anime_DefaultImageRepository();
                List<AniDB_Anime_DefaultImage> allDefaultImages = repDefImages.GetAll();

                ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:DefaultImages:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;

                // titles
                List<AniDB_Anime_Title> allTitles = repTitles.GetAllForLocalSeries();
                Dictionary<int, List<AniDB_Anime_Title>> dictTitles = new Dictionary<int, List<AniDB_Anime_Title>>();
                foreach (AniDB_Anime_Title atit in allTitles)
                {
                    if (!dictTitles.ContainsKey(atit.AnimeID))
                        dictTitles[atit.AnimeID] = new List<AniDB_Anime_Title>();

                    dictTitles[atit.AnimeID].Add(atit);
                }

                ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:Titles:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;

                TimeSpan ts = DateTime.Now - start;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例12: InitStats

		public void InitStats()
		{
			try
			{

				DateTime start = DateTime.Now;

				ClearAllData();

				#region Get the data
				AnimeGroupRepository repGroups = new AnimeGroupRepository();
				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
				AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
				AniDB_CategoryRepository repCats = new AniDB_CategoryRepository();
				AniDB_Anime_CategoryRepository repAnimeCat = new AniDB_Anime_CategoryRepository();
				AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();

				List<AnimeGroup> allGrps = repGroups.GetAll();

				Dictionary<int, AnimeGroup> allGroupsDict = new Dictionary<int, AnimeGroup>();
				foreach (AnimeGroup agrp in allGrps)
					allGroupsDict[agrp.AnimeGroupID] = agrp;
				TimeSpan ts = DateTime.Now - start;
				logger.Info("Get All GROUPS (Database) in {0} ms", ts.TotalMilliseconds);
				

				// anime
				start = DateTime.Now;
				List<AniDB_Anime> allAnime = repAnime.GetAll();
				Dictionary<int, AniDB_Anime> allAnimeDict = new Dictionary<int, AniDB_Anime>();
				foreach (AniDB_Anime anime in allAnime)
					allAnimeDict[anime.AnimeID] = anime;

				ts = DateTime.Now - start;
				logger.Info("Get All ANIME (Database) in {0} ms", ts.TotalMilliseconds);

				// categories
				start = DateTime.Now;
				List<AniDB_Category> allCatgeories = repCats.GetAll();
				Dictionary<int, AniDB_Category> allCatgeoriesDict = new Dictionary<int, AniDB_Category>();
				foreach (AniDB_Category cat in allCatgeories)
					allCatgeoriesDict[cat.CategoryID] = cat;


				List<AniDB_Anime_Category> allAnimeCatgeories = repAnimeCat.GetAll();
				Dictionary<int, List<int>> allAnimeCatgeoriesDict = new Dictionary<int, List<int>>(); // animeid / list of category id's
				foreach (AniDB_Anime_Category aniCat in allAnimeCatgeories)
				{
					if (!allAnimeCatgeoriesDict.ContainsKey(aniCat.AnimeID))
						allAnimeCatgeoriesDict[aniCat.AnimeID] = new List<int>();

					allAnimeCatgeoriesDict[aniCat.AnimeID].Add(aniCat.CategoryID);
				}
				ts = DateTime.Now - start;
				logger.Info("Get All CATEGORIES (Database) in {0} ms", ts.TotalMilliseconds);

				// titles
				start = DateTime.Now;
				List<AniDB_Anime_Title> allTitles = repTitles.GetAll();
				Dictionary<int, List<AniDB_Anime_Title>> allTitlesDict = new Dictionary<int, List<AniDB_Anime_Title>>(); // animeid / list of titles
				foreach (AniDB_Anime_Title aniTitle in allTitles)
				{
					if (!allTitlesDict.ContainsKey(aniTitle.AnimeID))
						allTitlesDict[aniTitle.AnimeID] = new List<AniDB_Anime_Title>();

					allTitlesDict[aniTitle.AnimeID].Add(aniTitle);
				}
				ts = DateTime.Now - start;
				logger.Info("Get All TITLES (Database) in {0} ms", ts.TotalMilliseconds);

				// user votes
				start = DateTime.Now;
				AniDB_VoteRepository repVotes = new AniDB_VoteRepository();
				List<AniDB_Vote> allVotes = repVotes.GetAll();
				ts = DateTime.Now - start;
				logger.Info("Get All VOTES (Database) in {0} ms", ts.TotalMilliseconds);

				// video quality
				start = DateTime.Now;
				AdhocRepository rep = new AdhocRepository();
				Dictionary<int, string> allVidQuality = rep.GetAllVideoQualityByGroup();

				ts = DateTime.Now - start;
				logger.Info("Get VIDEO QUALITY STATS (Database) in {0} ms", ts.TotalMilliseconds);

				// video quality episode stats
				start = DateTime.Now;
				Dictionary<int, AnimeVideoQualityStat> dictStats = rep.GetEpisodeVideoQualityStatsByAnime();
				ts = DateTime.Now - start;
				logger.Info("Get VIDEO QUALITY EPISODE STATS (Database) in {0} ms", ts.TotalMilliseconds);

				// audio and subtitle language stats
				start = DateTime.Now;
				Dictionary<int, LanguageStat> dictAudioStats = rep.GetAudioLanguageStatsForAnime();
				Dictionary<int, LanguageStat> dictSubtitleStats = rep.GetSubtitleLanguageStatsForAnime();
				ts = DateTime.Now - start;
				logger.Info("Get LANGUAGE STATS (Database) in {0} ms", ts.TotalMilliseconds);

				start = DateTime.Now;
				List<AnimeSeries> allSeries = repSeries.GetAll();
//.........这里部分代码省略.........
开发者ID:dizzydezz,项目名称:jmm,代码行数:101,代码来源:StatsCache.cs

示例13: GetAnimeRatings

		public List<Contract_AnimeRating> GetAnimeRatings(int collectionState, int watchedState, int ratingVotedState, int userID)
		{
			List<Contract_AnimeRating> contracts = new List<Contract_AnimeRating>();

			try
			{
				AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
				List<AnimeSeries> series = repSeries.GetAll();
				Dictionary<int, AnimeSeries> dictSeries = new Dictionary<int, AnimeSeries>();
				foreach (AnimeSeries ser in series)
					dictSeries[ser.AniDB_ID] = ser;

				RatingCollectionState _collectionState = (RatingCollectionState)collectionState;
				RatingWatchedState _watchedState = (RatingWatchedState)watchedState;
				RatingVotedState _ratingVotedState = (RatingVotedState)ratingVotedState;

				DateTime start = DateTime.Now;

				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();

				/*
				// build a dictionary of categories
				AniDB_CategoryRepository repCats = new AniDB_CategoryRepository();
				AniDB_Anime_CategoryRepository repAnimeCat = new AniDB_Anime_CategoryRepository();

				List<AniDB_Category> allCatgeories = repCats.GetAll();
				Dictionary<int, AniDB_Category> allCatgeoriesDict = new Dictionary<int, AniDB_Category>();
				foreach (AniDB_Category cat in allCatgeories)
					allCatgeoriesDict[cat.CategoryID] = cat;


				List<AniDB_Anime_Category> allAnimeCatgeories = repAnimeCat.GetAll();
				Dictionary<int, List<AniDB_Anime_Category>> allAnimeCatgeoriesDict = new Dictionary<int, List<AniDB_Anime_Category>>(); // 
				foreach (AniDB_Anime_Category aniCat in allAnimeCatgeories)
				{
					if (!allAnimeCatgeoriesDict.ContainsKey(aniCat.AnimeID))
						allAnimeCatgeoriesDict[aniCat.AnimeID] = new List<AniDB_Anime_Category>();

					allAnimeCatgeoriesDict[aniCat.AnimeID].Add(aniCat);
				}

				// build a dictionary of titles
				AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();


				List<AniDB_Anime_Title> allTitles = repTitles.GetAll();
				Dictionary<int, List<AniDB_Anime_Title>> allTitlesDict = new Dictionary<int, List<AniDB_Anime_Title>>();
				foreach (AniDB_Anime_Title title in allTitles)
				{
					if (!allTitlesDict.ContainsKey(title.AnimeID))
						allTitlesDict[title.AnimeID] = new List<AniDB_Anime_Title>();

					allTitlesDict[title.AnimeID].Add(title);
				}


				// build a dictionary of tags
				AniDB_TagRepository repTags = new AniDB_TagRepository();
				AniDB_Anime_TagRepository repAnimeTag = new AniDB_Anime_TagRepository();

				List<AniDB_Tag> allTags = repTags.GetAll();
				Dictionary<int, AniDB_Tag> allTagsDict = new Dictionary<int, AniDB_Tag>();
				foreach (AniDB_Tag tag in allTags)
					allTagsDict[tag.TagID] = tag;


				List<AniDB_Anime_Tag> allAnimeTags = repAnimeTag.GetAll();
				Dictionary<int, List<AniDB_Anime_Tag>> allAnimeTagsDict = new Dictionary<int, List<AniDB_Anime_Tag>>(); // 
				foreach (AniDB_Anime_Tag aniTag in allAnimeTags)
				{
					if (!allAnimeTagsDict.ContainsKey(aniTag.AnimeID))
						allAnimeTagsDict[aniTag.AnimeID] = new List<AniDB_Anime_Tag>();

					allAnimeTagsDict[aniTag.AnimeID].Add(aniTag);
				}

				// build a dictionary of languages
				AdhocRepository rep = new AdhocRepository();
				Dictionary<int, LanguageStat> dictAudioStats = rep.GetAudioLanguageStatsForAnime();
				Dictionary<int, LanguageStat> dictSubtitleStats = rep.GetSubtitleLanguageStatsForAnime();

				Dictionary<int, string> dictAnimeVideoQualStats = rep.GetAllVideoQualityByAnime();
				Dictionary<int, AnimeVideoQualityStat> dictAnimeEpisodeVideoQualStats = rep.GetEpisodeVideoQualityStatsByAnime();
				 * */

				List<AniDB_Anime> animes = repAnime.GetAll();

				// user votes
				AniDB_VoteRepository repVotes = new AniDB_VoteRepository();
				List<AniDB_Vote> allVotes = repVotes.GetAll();

				JMMUserRepository repUsers = new JMMUserRepository();
				JMMUser user = repUsers.GetByID(userID);
				if (user == null) return contracts;

				int i = 0;



				foreach (AniDB_Anime anime in animes)
//.........这里部分代码省略.........
开发者ID:dizzydezz,项目名称:jmm,代码行数:101,代码来源:JMMServiceImplementation.cs

示例14: UpdateAllStats

		public static void UpdateAllStats()
		{
            AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
            foreach (AnimeSeries ser in repSeries.GetAll())
            {
                ser.QueueUpdateStats();
            }
		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:8,代码来源:Importer.cs

示例15: SyncCollectionToTrakt

        public static void SyncCollectionToTrakt()
        {
            try
            {
                if (!ServerSettings.Trakt_IsEnabled || string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken)) return;

                // check that we have at least one user nominated for Trakt
                JMMUserRepository repUsers = new JMMUserRepository();
                List<JMMUser> traktUsers = repUsers.GetTraktUsers();
                if (traktUsers.Count == 0) return;

                AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                List<AnimeSeries> allSeries = repSeries.GetAll();

                // now get the full users collection from Trakt
                List<TraktV2ShowCollectedResult> collected = new List<TraktV2ShowCollectedResult>();
                List<TraktV2ShowWatchedResult> watched = new List<TraktV2ShowWatchedResult>();

                if (!GetTraktCollectionInfo(ref collected, ref watched)) return;

                TraktV2SyncCollectionEpisodesByNumber syncCollectionAdd = new TraktV2SyncCollectionEpisodesByNumber();
                TraktV2SyncCollectionEpisodesByNumber syncCollectionRemove = new TraktV2SyncCollectionEpisodesByNumber();
                TraktV2SyncWatchedEpisodesByNumber syncHistoryAdd = new TraktV2SyncWatchedEpisodesByNumber();
                TraktV2SyncWatchedEpisodesByNumber syncHistoryRemove = new TraktV2SyncWatchedEpisodesByNumber();

                #region Local Collection Sync

                ///////////////////////////////////////////////////////////////////////////////////////
                // First take a look at our local collection and update on Trakt
                ///////////////////////////////////////////////////////////////////////////////////////

                AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
                int counter = 0;
                foreach (AnimeSeries series in allSeries)
                {
                    counter++;
                    logger.Trace("Syncing check -  local collection: {0} / {1} - {2}", counter, allSeries.Count, series.GetSeriesName());

                    AniDB_Anime anime = repAnime.GetByAnimeID(series.AniDB_ID);
                    if (anime == null) continue;

                    //if (anime.AnimeID != 3427) continue;

                    TraktSummaryContainer traktSummary = new TraktSummaryContainer();
                    traktSummary.Populate(series.AniDB_ID);
                    if (traktSummary.CrossRefTraktV2 == null || traktSummary.CrossRefTraktV2.Count == 0) continue;

                    // get the current watched records for this series on Trakt

                    foreach (AnimeEpisode ep in series.GetAnimeEpisodes())
                    {
                        if (ep.EpisodeTypeEnum == enEpisodeType.Episode || ep.EpisodeTypeEnum == enEpisodeType.Special)
                        {
                            EpisodeSyncDetails epsync = ReconSyncTraktEpisode(series, ep, traktSummary, traktUsers, collected, watched, false);
                            if (epsync != null)
                            {
                                switch (epsync.SyncType)
                                {
                                    case TraktSyncType.CollectionAdd:
                                        syncCollectionAdd.AddEpisode(epsync.Slug, epsync.Season, epsync.EpNumber, epsync.EpDate); break;
                                    case TraktSyncType.CollectionRemove:
                                        syncCollectionRemove.AddEpisode(epsync.Slug, epsync.Season, epsync.EpNumber, epsync.EpDate); break;
                                    case TraktSyncType.HistoryAdd:
                                        syncHistoryAdd.AddEpisode(epsync.Slug, epsync.Season, epsync.EpNumber, epsync.EpDate); break;
                                    case TraktSyncType.HistoryRemove:
                                        syncHistoryRemove.AddEpisode(epsync.Slug, epsync.Season, epsync.EpNumber, epsync.EpDate); break;
                                }
                            }
                        }
                    }
                }
                #endregion

                // refresh online info, just in case it was chnaged by the last operations
                if (!GetTraktCollectionInfo(ref collected, ref watched)) return;

                #region Online Collection Sync
                ///////////////////////////////////////////////////////////////////////////////////////
                // Now look at the collection according to Trakt, and remove it if we don't have it locally
                ///////////////////////////////////////////////////////////////////////////////////////

                CrossRef_AniDB_TraktV2Repository repCrossRef = new CrossRef_AniDB_TraktV2Repository();

                counter = 0;
                foreach (TraktV2ShowCollectedResult col in collected)
                {
                    counter++;
                    logger.Trace("Syncing check - Online collection: {0} / {1} - {2}", counter, collected.Count, col.show.Title);
                    //continue;

                    // check if we have this series locally
                    List<CrossRef_AniDB_TraktV2> xrefs = repCrossRef.GetByTraktID(col.show.ids.slug);

                    if (xrefs.Count > 0)
                    {
                        foreach (CrossRef_AniDB_TraktV2 xref in xrefs)
                        {
                            AnimeSeries locSeries = repSeries.GetByAnimeID(xref.AnimeID);
                            if (locSeries == null) continue;

//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的JMMServer.Repositories.AnimeSeriesRepository.GetAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。