• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Repositories.AniDB_AnimeRepository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



AniDB_AnimeRepository类属于JMMServer.Repositories命名空间,在下文中一共展示了AniDB_AnimeRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ProcessCommand

		public override void ProcessCommand()
		{
			logger.Info("Processing CommandRequest_MALUpdatedWatchedStatus: {0}", AnimeID);

			try
			{
				// find the latest eps to update
				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
				AniDB_Anime anime = repAnime.GetByAnimeID(AnimeID);
				if (anime == null) return;

				List<CrossRef_AniDB_MAL> crossRefs = anime.GetCrossRefMAL();
				if (crossRefs == null || crossRefs.Count == 0)
					return;

				AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
				AnimeSeries ser = repSeries.GetByAnimeID(AnimeID);
				if (ser == null) return;

				MALHelper.UpdateMALSeries(ser);

			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_MALUpdatedWatchedStatus: {0} - {1}", AnimeID, ex.ToString());
				return;
			}
		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:28,代码来源:CommandRequest_MALUpdatedWatchedStatus.cs


示例2: ProcessCommand

		public override void ProcessCommand()
		{
			
			try
			{
				bool process = (ServerSettings.AniDB_Username.Equals("jonbaby", StringComparison.InvariantCultureIgnoreCase) ||
					ServerSettings.AniDB_Username.Equals("jmediamanager", StringComparison.InvariantCultureIgnoreCase) ||
                    ServerSettings.AniDB_Username.Equals("jmmtesting", StringComparison.InvariantCultureIgnoreCase));

				if (!process) return;

				AniDB_AnimeRepository rep = new AniDB_AnimeRepository();
				AniDB_Anime anime = rep.GetByAnimeID(AnimeID);
				if (anime == null) return;

				if (anime.AllTags.ToUpper().Contains("18 RESTRICTED")) return;

				AzureWebAPI.Send_AnimeFull(anime);
			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_Azure_SendAnimeFull: {0} - {1}", AnimeID, ex.ToString());
				return;
			}
		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:25,代码来源:CommandRequest_Azure_SendAnimeFull.cs


示例3: ProcessCommand

		public override void ProcessCommand()
		{
			logger.Info("Processing CommandRequest_MALUploadStatusToMAL");

			try
			{
				if (string.IsNullOrEmpty(ServerSettings.MAL_Username) || string.IsNullOrEmpty(ServerSettings.MAL_Password))
					return;

				// find the latest eps to update
				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
				List<AniDB_Anime> animes = repAnime.GetAll();

				foreach (AniDB_Anime anime in animes)
				{
					CommandRequest_MALUpdatedWatchedStatus cmd = new CommandRequest_MALUpdatedWatchedStatus(anime.AnimeID);
					cmd.Save();
				}
			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_MALUploadStatusToMAL: {0}", ex.ToString());
				return;
			}
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:25,代码来源:CommandRequest_MALUploadStatusToMAL.cs


示例4: ProcessCommand

		public override void ProcessCommand()
		{
			logger.Info("Processing CommandRequest_GetReviews: {0}", AnimeID);

			try
			{
				return;

				// we will always assume that an anime was downloaded via http first
				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
				AniDB_Anime anime = repAnime.GetByAnimeID(AnimeID);

				if (anime != null)
				{
					// reviews count will be 0 when the anime is only downloaded via HTTP
					if (ForceRefresh || anime.AnimeReviews.Count == 0)
						anime = JMMService.AnidbProcessor.GetAnimeInfoUDP(AnimeID, true);

					foreach (AniDB_Anime_Review animeRev in anime.AnimeReviews)
					{
						JMMService.AnidbProcessor.GetReviewUDP(animeRev.ReviewID);
					}
					
				}

			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_GetReviews: {0} - {1}", AnimeID, ex.ToString());
				return;
			}
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:32,代码来源:CommandRequest_GetReviews.cs


示例5: ProcessCommand

		public override void ProcessCommand()
		{
			
			try
			{
                CrossRef_AniDB_TraktV2Repository repCrossRef = new CrossRef_AniDB_TraktV2Repository();
				CrossRef_AniDB_TraktV2 xref = repCrossRef.GetByID(CrossRef_AniDB_TraktID);
				if (xref == null) return;

				Trakt_ShowRepository repShow = new Trakt_ShowRepository();
				Trakt_Show tvShow = repShow.GetByTraktSlug(xref.TraktID);
				if (tvShow == null) return;

                AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
                AniDB_Anime anime = repAnime.GetByAnimeID(xref.AnimeID);
                if (anime == null) return;

				string showName = "";
				if (tvShow != null) showName = tvShow.Title;

                AzureWebAPI.Send_CrossRefAniDBTrakt(xref, anime.MainTitle);
			}
			catch (Exception ex)
			{
				logger.ErrorException("Error processing CommandRequest_WebCacheSendXRefAniDBTrakt: {0}" + ex.ToString(), ex);
				return;
			}
		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:28,代码来源:CommandRequest_WebCacheSendXRefAniDBTrakt.cs


示例6: ProcessCommand

		public override void ProcessCommand()
		{
			logger.Info("Processing CommandRequest_GetAnimeHTTP: {0}", AnimeID);

			try
			{
				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
				AniDB_Anime anime = JMMService.AnidbProcessor.GetAnimeInfoHTTP(AnimeID, ForceRefresh, DownloadRelations);
				
				// NOTE - related anime are downloaded when the relations are created
				
				// download group status info for this anime
				// the group status will also help us determine missing episodes for a series


				// download reviews
				if (ServerSettings.AniDB_DownloadReviews)
				{
					CommandRequest_GetReviews cmd = new CommandRequest_GetReviews(AnimeID, ForceRefresh);
					cmd.Save();
				}

				// Request an image download

			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_GetAnimeHTTP: {0} - {1}", AnimeID, ex.ToString());
				return;
			}
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:31,代码来源:CommandRequest_GetAnimeHTTP.cs


示例7: GetCommunityLinks

		public MetroContract_CommunityLinks GetCommunityLinks(int animeID)
		{
			MetroContract_CommunityLinks contract = new MetroContract_CommunityLinks();
			try
			{
				using (var session = JMMService.SessionFactory.OpenSession())
				{
					AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();

					AniDB_Anime anime = repAnime.GetByAnimeID(session, animeID);
					if (anime == null) return null;

					//AniDB
					contract.AniDB_ID = animeID;
					contract.AniDB_URL = string.Format(Constants.URLS.AniDB_Series, animeID);
					contract.AniDB_DiscussURL = string.Format(Constants.URLS.AniDB_SeriesDiscussion, animeID);

					// MAL
					List<CrossRef_AniDB_MAL> malRef = anime.GetCrossRefMAL(session);
					if (malRef != null && malRef.Count > 0)
					{
						contract.MAL_ID = malRef[0].MALID.ToString();
						contract.MAL_URL = string.Format(Constants.URLS.MAL_Series, malRef[0].MALID);
						//contract.MAL_DiscussURL = string.Format(Constants.URLS.MAL_SeriesDiscussion, malRef[0].MALID, malRef[0].MALTitle);
						contract.MAL_DiscussURL = string.Format(Constants.URLS.MAL_Series, malRef[0].MALID);
					}

					// TvDB
					List<CrossRef_AniDB_TvDBV2> tvdbRef = anime.GetCrossRefTvDBV2(session);
                    if (tvdbRef != null && tvdbRef.Count > 0)
					{
						contract.TvDB_ID = tvdbRef[0].TvDBID.ToString();
						contract.TvDB_URL = string.Format(Constants.URLS.TvDB_Series, tvdbRef[0].TvDBID);
					}

                    // Trakt
                    List<CrossRef_AniDB_TraktV2> traktRef = anime.GetCrossRefTraktV2(session);
                    if (traktRef != null && traktRef.Count > 0)
                    {
                        contract.Trakt_ID = traktRef[0].TraktID;
                        contract.Trakt_URL = string.Format(Constants.URLS.Trakt_Series, traktRef[0].TraktID);
                    }
				}
			}
			catch (Exception ex)
			{
				logger.ErrorException(ex.ToString(), ex);
			}

			return contract;
		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:51,代码来源:JMMServiceImplementationMetro.cs


示例8: ToContract

		public Contract_IgnoreAnime ToContract()
		{
			Contract_IgnoreAnime contract = new Contract_IgnoreAnime();

			contract.IgnoreAnimeID = this.IgnoreAnimeID;
			contract.JMMUserID = this.JMMUserID;
			contract.AnimeID = this.AnimeID;
			contract.IgnoreType = this.IgnoreType;

			AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
			AniDB_Anime anime = repAnime.GetByAnimeID(AnimeID);
			if (anime != null) contract.Anime = anime.ToContract();

			return contract;
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:15,代码来源:IgnoreAnime.cs


示例9: ProcessCommand

		public override void ProcessCommand()
		{
			
			try
			{
				bool process = (ServerSettings.AniDB_Username.Equals("jonbaby", StringComparison.InvariantCultureIgnoreCase) ||
					ServerSettings.AniDB_Username.Equals("jmediamanager", StringComparison.InvariantCultureIgnoreCase));

				if (!process) return;

				AniDB_AnimeRepository rep = new AniDB_AnimeRepository();
				AniDB_Anime anime = rep.GetByAnimeID(AnimeID);
				if (anime == null) return;

				string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
				string filePath = Path.Combine(appPath, "Anime_HTTP");

				if (!Directory.Exists(filePath))
					Directory.CreateDirectory(filePath);

				string fileName = string.Format("AnimeDoc_{0}.xml", AnimeID);
				string fileNameWithPath = Path.Combine(filePath, fileName);

				string rawXML = "";
				if (File.Exists(fileNameWithPath))
				{
					StreamReader re = File.OpenText(fileNameWithPath);
					rawXML = re.ReadToEnd();
					re.Close();
				}

				AnimeXML xml = new AnimeXML();
				xml.AnimeID = AnimeID;
				xml.AnimeName = anime.MainTitle;
				xml.DateDownloaded = 0;
				xml.Username = ServerSettings.AniDB_Username;
				xml.XMLContent = rawXML;

				AzureWebAPI.Send_AnimeXML(xml);
			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_Azure_SendAnimeXML: {0} - {1}", AnimeID, ex.ToString());
				return;
			}
		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:46,代码来源:CommandRequest_Azure_SendAnimeXML.cs


示例10: ToContract

		public Contract_BookmarkedAnime ToContract()
		{
			Contract_BookmarkedAnime contract = new Contract_BookmarkedAnime();

			contract.BookmarkedAnimeID = BookmarkedAnimeID;
			contract.AnimeID = AnimeID;
			contract.Priority = Priority;
			contract.Notes = Notes;
			contract.Downloading = Downloading;

			contract.Anime = null;
			AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
			AniDB_Anime an = repAnime.GetByAnimeID(AnimeID);
			if (an != null)
				contract.Anime = an.ToContract(true, null);

			return contract;
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:18,代码来源:BookmarkedAnime.cs


示例11: HasTraktLink

		public bool HasTraktLink(int animeID)
		{
			try
			{
				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();

				AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
				if (anime == null) return false;

				return anime.GetCrossRefTrakt() != null;
			}
			catch (Exception ex)
			{
				logger.ErrorException(ex.ToString(), ex);
			}

			return false;
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:18,代码来源:JMMServiceImplementationMetro.cs


示例12: ProcessCommand

		public override void ProcessCommand()
		{
			logger.Info("Processing CommandRequest_GetCharactersCreators: {0}", AnimeID);

			try
			{
				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
				AniDB_Character_CreatorRepository repCharCreators = new AniDB_Character_CreatorRepository();
				AniDB_Anime anime = null;

				if (ForceRefresh)
				{
					// redownload anime details from http ap so we can get an update character list
					anime = JMMService.AnidbProcessor.GetAnimeInfoHTTP(AnimeID, false, false);
				}
				else
					anime = repAnime.GetByAnimeID(AnimeID);

				if (anime == null) return;

				foreach (AniDB_Anime_Character animeChar in anime.AnimeCharacters)
				{
					//MainWindow.anidbProcessor.UpdateCharacterInfo(charref.CharID, false);
					//logger.Trace("Downloading char info: {0}", animeChar.CharID);
					CommandRequest_GetCharacter cmdChar = new CommandRequest_GetCharacter(animeChar.CharID, ForceRefresh);
					cmdChar.Save();

					// for each of the creators for this character
					foreach (AniDB_Character_Seiyuu aac in repCharCreators.GetByCharID(animeChar.CharID))
					{
						CommandRequest_GetCreator cmdCreators = new CommandRequest_GetCreator(aac.SeiyuuID, ForceRefresh);
						cmdCreators.Save();
					}
				}

			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_GetCharactersCreators: {0} - {1}", AnimeID, ex.ToString());
				return;
			}
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:42,代码来源:CommandRequest_GetCharactersCreators.cs


示例13: ProcessCommand

		public override void ProcessCommand()
		{
			
			try
			{
				//if (string.IsNullOrEmpty(ServerSettings.WebCacheAuthKey)) return;

				CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository();
				CrossRef_AniDB_TvDBV2 xref = repCrossRef.GetByID(CrossRef_AniDB_TvDBID);
				if (xref == null) return;

				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
				AniDB_Anime anime = repAnime.GetByAnimeID(xref.AnimeID);
				if (anime == null) return;

				AzureWebAPI.Send_CrossRefAniDBTvDB(xref, anime.MainTitle);
			}
			catch (Exception ex)
			{
				logger.ErrorException("Error processing CommandRequest_WebCacheSendXRefAniDBTvDB: {0}" + ex.ToString(), ex);
				return;
			}
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:23,代码来源:CommandRequest_WebCacheSendXRefAniDBTvDB.cs


示例14: ProcessCommand

		public override void ProcessCommand()
		{
			logger.Info("Processing CommandRequest_TraktSearchAnime: {0}", AnimeID);

			try
			{
				using (var session = JMMService.SessionFactory.OpenSession())
				{
					// first check if the user wants to use the web cache
					if (ServerSettings.WebCache_TvDB_Get)
					{
						try
						{
							CrossRef_AniDB_TraktResult crossRef = XMLService.Get_CrossRef_AniDB_Trakt(AnimeID);
							if (crossRef != null)
							{
								TraktTVShow showInfo = TraktTVHelper.GetShowInfo(crossRef.TraktID);
								if (showInfo != null)
								{
									logger.Trace("Found trakt match on web cache for {0} - id = {1}", AnimeID, showInfo.title);
									TraktTVHelper.LinkAniDBTrakt(AnimeID, crossRef.TraktID, crossRef.TraktSeasonNumber, true);
									return;
								}
							}
						}
						catch (Exception ex)
						{
							logger.ErrorException(ex.ToString(), ex);
						}
					}


					// lets try to see locally if we have a tvDB link for this anime
					// Trakt allows the use of TvDB ID's or their own Trakt ID's
					CrossRef_AniDB_TvDBV2Repository repCrossRefTvDB = new CrossRef_AniDB_TvDBV2Repository();
					List<CrossRef_AniDB_TvDBV2> xrefTvDBs = repCrossRefTvDB.GetByAnimeID(session, AnimeID);
					if (xrefTvDBs != null && xrefTvDBs.Count == 1)  //TODO this is temporary code, until trakt also allows multiple links
					{
						TraktTVShow showInfo = TraktTVHelper.GetShowInfo(xrefTvDBs[0].TvDBID);
						if (showInfo != null)
						{
							// make sure the season specified by TvDB also exists on Trakt
							Trakt_ShowRepository repShow = new Trakt_ShowRepository();
							Trakt_Show traktShow = repShow.GetByTraktID(session, showInfo.TraktID);
							if (traktShow != null)
							{
								Trakt_SeasonRepository repSeasons = new Trakt_SeasonRepository();
								Trakt_Season traktSeason = repSeasons.GetByShowIDAndSeason(session, traktShow.Trakt_ShowID, xrefTvDBs[0].TvDBSeasonNumber);
								if (traktSeason != null)
								{
									logger.Trace("Found trakt match using TvDBID locally {0} - id = {1}", AnimeID, showInfo.title);
									TraktTVHelper.LinkAniDBTrakt(AnimeID, showInfo.TraktID, traktSeason.Season, true);
									return;
								}
							}
						}
					}

					// if not lets try the tvdb web cache based on the same reasoning
					if (ServerSettings.WebCache_TvDB_Get)
					{
						List<JMMServer.Providers.Azure.CrossRef_AniDB_TvDB> cacheResults = JMMServer.Providers.Azure.AzureWebAPI.Get_CrossRefAniDBTvDB(AnimeID);
						if (cacheResults != null && cacheResults.Count > 0)
						{
							TraktTVShow showInfo = TraktTVHelper.GetShowInfo(cacheResults[0].TvDBID);
							if (showInfo != null)
							{
								// make sure the season specified by TvDB also exists on Trakt
								Trakt_ShowRepository repShow = new Trakt_ShowRepository();
								Trakt_Show traktShow = repShow.GetByTraktID(session, showInfo.TraktID);
								if (traktShow != null)
								{
									Trakt_SeasonRepository repSeasons = new Trakt_SeasonRepository();
									Trakt_Season traktSeason = repSeasons.GetByShowIDAndSeason(session, traktShow.Trakt_ShowID, cacheResults[0].TvDBSeasonNumber);
									if (traktSeason != null)
									{
										logger.Trace("Found trakt match on web cache by using TvDBID {0} - id = {1}", AnimeID, showInfo.title);
										TraktTVHelper.LinkAniDBTrakt(AnimeID, showInfo.TraktID, traktSeason.Season, true);
										return;
									}
								}
							}
						}
					}

					// finally lets try searching Trakt directly
					string searchCriteria = "";
					AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
					AniDB_Anime anime = repAnime.GetByAnimeID(session, AnimeID);
					if (anime == null) return;

					searchCriteria = anime.MainTitle;

					// if not wanting to use web cache, or no match found on the web cache go to TvDB directly
					List<TraktTVShow> results = TraktTVHelper.SearchShow(searchCriteria);
					logger.Trace("Found {0} trakt results for {1} ", results.Count, searchCriteria);
					if (ProcessSearchResults(session, results, searchCriteria)) return;


					if (results.Count == 0)
//.........这里部分代码省略.........
开发者ID:dizzydezz,项目名称:jmm,代码行数:101,代码来源:CommandRequest_TraktSearchAnime.cs


示例15: ProcessFile_AniDB

		private void ProcessFile_AniDB(VideoLocal vidLocal)
		{
			logger.Trace("Checking for AniDB_File record for: {0} --- {1}", vidLocal.Hash, vidLocal.FilePath);
			// check if we already have this AniDB_File info in the database
			
			AniDB_FileRepository repAniFile = new AniDB_FileRepository();
			AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
			AniDB_AnimeRepository repAniAnime = new AniDB_AnimeRepository();
			AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
			VideoLocalRepository repVidLocals = new VideoLocalRepository();
			AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
			CrossRef_File_EpisodeRepository repXrefFE = new CrossRef_File_EpisodeRepository();

			AniDB_File aniFile = null;

			if (!ForceAniDB)
			{
				aniFile = repAniFile.GetByHashAndFileSize(vidLocal.Hash, vlocal.FileSize);

				if (aniFile == null)
					logger.Trace("AniDB_File record not found");
			}

			int animeID = 0;

			if (aniFile == null)
			{
				// get info from AniDB
				logger.Debug("Getting AniDB_File record from AniDB....");
				Raw_AniDB_File fileInfo = JMMService.AnidbProcessor.GetFileInfo(vidLocal);
				if (fileInfo != null)
				{
					// check if we already have a record
					aniFile = repAniFile.GetByHashAndFileSize(vidLocal.Hash, vlocal.FileSize);

					if (aniFile == null)
						aniFile = new AniDB_File();

					aniFile.Populate(fileInfo);

					//overwrite with local file name
					string localFileName = Path.GetFileName(vidLocal.FilePath);
					aniFile.FileName = localFileName;

					repAniFile.Save(aniFile, false);
					aniFile.CreateLanguages();
					aniFile.CreateCrossEpisodes(localFileName);

                    if (!string.IsNullOrEmpty(fileInfo.OtherEpisodesRAW))
                    {
                        string[] epIDs = fileInfo.OtherEpisodesRAW.Split(',');
                        foreach (string epid in epIDs)
                        {
                            int id = 0;
                            if (int.TryParse(epid, out id))
                            {
                                CommandRequest_GetEpisode cmdEp = new CommandRequest_GetEpisode(id);
                                cmdEp.Save();
                            }
                        }
                    }

					animeID = aniFile.AnimeID;
				}
			}

			bool missingEpisodes = false;

			// if we still haven't got the AniDB_File Info we try the web cache or local records
			if (aniFile == null)
			{
				// check if we have any records from previous imports
				List<CrossRef_File_Episode> crossRefs = repXrefFE.GetByHash(vidLocal.Hash);
				if (crossRefs == null || crossRefs.Count == 0)
				{
					// lets see if we can find the episode/anime info from the web cache
					if (ServerSettings.WebCache_XRefFileEpisode_Get)
					{
						crossRefs = XMLService.Get_CrossRef_File_Episode(vidLocal);
						if (crossRefs == null || crossRefs.Count == 0)
						{
							logger.Debug("Cannot find AniDB_File record or get cross ref from web cache record so exiting: {0}", vidLocal.ED2KHash);
							return;
						}
						else
						{
							foreach (CrossRef_File_Episode xref in crossRefs)
							{
								// in this case we need to save the cross refs manually as AniDB did not provide them
								repXrefFE.Save(xref);
							}
						}
					}
					else
					{
						logger.Debug("Cannot get AniDB_File record so exiting: {0}", vidLocal.ED2KHash);
						return;
					}
				}

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


示例16: workerMyAnime2_DoWork

		void workerMyAnime2_DoWork(object sender, DoWorkEventArgs e)
		{
			MA2Progress ma2Progress = new MA2Progress();
			ma2Progress.CurrentFile = 0;
			ma2Progress.ErrorMessage = "";
			ma2Progress.MigratedFiles = 0;
			ma2Progress.TotalFiles = 0;

			try
			{
				string databasePath = e.Argument as string;

				string connString = string.Format(@"data source={0};useutf16encoding=True", databasePath);
				SQLiteConnection myConn = new SQLiteConnection(connString);
				myConn.Open();

				// get a list of unlinked files
				VideoLocalRepository repVids = new VideoLocalRepository();
				AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
				AniDB_AnimeRepository repAniAnime = new AniDB_AnimeRepository();
				AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
				AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();

				List<VideoLocal> vids = repVids.GetVideosWithoutEpisode();
				ma2Progress.TotalFiles = vids.Count;

				foreach (VideoLocal vid in vids)
				{
					ma2Progress.CurrentFile = ma2Progress.CurrentFile + 1;
					workerMyAnime2.ReportProgress(0, ma2Progress);

					// search for this file in the XrossRef table in MA2
					string sql = string.Format("SELECT AniDB_EpisodeID from CrossRef_Episode_FileHash WHERE Hash = '{0}' AND FileSize = {1}", vid.ED2KHash, vid.FileSize);
					SQLiteCommand sqCommand = new SQLiteCommand(sql);
					sqCommand.Connection = myConn;

					SQLiteDataReader myReader = sqCommand.ExecuteReader();
					while (myReader.Read())
					{
						int episodeID = 0;
						if (!int.TryParse(myReader.GetValue(0).ToString(), out episodeID)) continue;
						if (episodeID <= 0) continue;

						sql = string.Format("SELECT AnimeID from AniDB_Episode WHERE EpisodeID = {0}", episodeID);
						sqCommand = new SQLiteCommand(sql);
						sqCommand.Connection = myConn;

						SQLiteDataReader myReader2 = sqCommand.ExecuteReader();
						while (myReader2.Read())
						{
							int animeID = myReader2.GetInt32(0);

							// so now we have all the needed details we can link the file to the episode
							// as long as wehave the details in JMM
							AniDB_Anime anime = null;
							AniDB_Episode ep = repAniEps.GetByEpisodeID(episodeID);
							if (ep == null)
							{
								logger.Debug("Getting Anime record from AniDB....");
								anime = JMMService.AnidbProcessor.GetAnimeInfoHTTP(animeID, true, ServerSettings.AutoGroupSeries);
							}
							else
								anime = repAniAnime.GetByAnimeID(animeID);

							// create the group/series/episode records if needed
							AnimeSeries ser = null;
							if (anime == null) continue;

							logger.Debug("Creating groups, series and episodes....");
							// check if there is an AnimeSeries Record associated with this AnimeID
							ser = repSeries.GetByAnimeID(animeID);
							if (ser == null)
							{
								// create a new AnimeSeries record
								ser = anime.CreateAnimeSeriesAndGroup();
							}


							ser.CreateAnimeEpisodes();

							// check if we have any group status data for this associated anime
							// if not we will download it now
							AniDB_GroupStatusRepository repStatus = new AniDB_GroupStatusRepository();
							if (repStatus.GetByAnimeID(anime.AnimeID).Count == 0)
							{
								CommandRequest_GetReleaseGroupStatus cmdStatus = new CommandRequest_GetReleaseGroupStatus(anime.AnimeID, false);
								cmdStatus.Save();
							}

							// update stats
							ser.EpisodeAddedDate = DateTime.Now;
							repSeries.Save(ser);

							AnimeGroupRepository repGroups = new AnimeGroupRepository();
							foreach (AnimeGroup grp in ser.AllGroupsAbove)
							{
								grp.EpisodeAddedDate = DateTime.Now;
								repGroups.Save(grp);
							}

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


示例17: GetImage

		public System.IO.Stream GetImage(string ImageType, string ImageID)
		{
			AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
			TvDB_ImagePosterRepository repPosters = new TvDB_ImagePosterRepository();
			TvDB_EpisodeRepository repEpisodes = new TvDB_EpisodeRepository();
			TvDB_ImageFanartRepository repFanart = new TvDB_ImageFanartRepository();
			TvDB_ImageWideBannerRepository repWideBanners = new TvDB_ImageWideBannerRepository();

			MovieDB_PosterRepository repMoviePosters = new MovieDB_PosterRepository();
			MovieDB_FanartRepository repMovieFanart = new MovieDB_FanartRepository();

			Trakt_ImageFanartRepository repTraktFanart = new Trakt_ImageFanartRepository();
			Trakt_ImagePosterRepository repTraktPosters = new Trakt_ImagePosterRepository();
			Trakt_EpisodeRepository repTraktEpisodes = new Trakt_EpisodeRepository();
			Trakt_FriendRepository repTraktFriends = new Trakt_FriendRepository();

			JMMImageType imageType = (JMMImageType)int.Parse(ImageType);

			switch (imageType)
			{
				case JMMImageType.AniDB_Cover:

					AniDB_Anime anime = repAnime.GetByAnimeID(int.Parse(ImageID));
					if (anime == null) return null;

					if (File.Exists(anime.PosterPath))
					{
						FileStream fs = File.OpenRead(anime.PosterPath);
						WebOperationContext.Current.OutgoingResponse.ContentType = "image/jpeg";
						return fs;
					}
					else
					{
						logger.Trace("Could not find AniDB_Cover image: {0}", anime.PosterPath);
						return null;
					}

				case JMMImageType.AniDB_Character:

					AniDB_CharacterRepository repChar = new AniDB_CharacterRepository();
					AniDB_Character chr = repChar.GetByID(int.Parse(ImageID));
					if (chr == null) return null;

					if (File.Exists(chr.PosterPath))
					{
						FileStream fs = File.OpenRead(chr.PosterPath);
						WebOperationContext.Current.OutgoingResponse.ContentType = "image/jpeg";
						return fs;
					}
					else
					{
						logger.Trace("Could not find AniDB_Character image: {0}", chr.PosterPath);
						return null;
					}

				case JMMImageType.AniDB_Creator:

					AniDB_SeiyuuRepository repCreator = new AniDB_SeiyuuRepository();
					AniDB_Seiyuu creator = repCreator.GetByID(int.Parse(ImageID));
					if (creator == null) return null;

					if (File.Exists(creator.PosterPath))
					{
						FileStream fs = File.OpenRead(creator.PosterPath);
						WebOperationContext.Current.OutgoingResponse.ContentType = "image/jpeg";
						return fs;
					}
					else
					{
						logger.Trace("Could not find AniDB_Creator image: {0}", creator.PosterPath);
						return null;
					}

				case JMMImageType.TvDB_Cover:

					TvDB_ImagePoster poster = repPosters.GetByID(int.Parse(ImageID));
					if (poster == null) return null;

					if (File.Exists(poster.FullImagePath))
					{
						FileStream fs = File.OpenRead(poster.FullImagePath);
						WebOperationContext.Current.OutgoingResponse.ContentType = "image/jpeg";
						return fs;
					}
					else
					{
						logger.Trace("Could not find TvDB_Cover image: {0}", poster.FullImagePath);
						return null;
					}

				case JMMImageType.TvDB_Banner:

					TvDB_ImageWideBanner wideBanner = repWideBanners.GetByID(int.Parse(ImageID));
					if (wideBanner == null) return null;

					if (File.Exists(wideBanner.FullImagePath))
					{
						FileStream fs = File.OpenRead(wideBanner.FullImagePath);
						WebOperationContext.Current.OutgoingResponse.ContentType = "image/jpeg";
						return fs;
//.........这里部分代码省略.........
开发者ID:dizzydezz,项目名称:jmm,代码行数:101,代码来源:JMMServiceImplementationREST.cs


示例18: SendToAzureXML

		private void SendToAzureXML()
		{
			
			DateTime dt = DateTime.Now.AddYears(-2);
			AniDB_AnimeRepository rep = new AniDB_AnimeRepository();
			List<AniDB_Anime> allAnime = rep.GetAll();

			int sentAnime = 0;
			foreach (AniDB_Anime anime in rep.GetAll())
			{
				if (!anime.EndDate.HasValue) continue;

				if (anime.EndDate.Value > dt) continue;

				sentAnime++;
				CommandRequest_Azure_SendAnimeXML cmd = new CommandRequest_Azure_SendAnimeXML(anime.AnimeID);
				cmd.Save();
			}

			logger.Info(string.Format("Sent Anime XML to Cache: {0} out of {1}", sentAnime, allAnime.Count));
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:21,代码来源:MainWindow.xaml.cs


示例19: btnUploadAzureCache_Click

		void btnUploadAzureCache_Click(object sender, RoutedEventArgs e)
		{
			AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
			List<AniDB_Anime> allAnime = repAnime.GetAll();
			int cnt = 0;
			foreach (AniDB_Anime anime in allAnime)
			{
				cnt++;
				logger.Info(string.Format("Uploading anime {0} of {1} - {2}", cnt, allAnime.Count, anime.MainTitle));

				try
				{
					CommandRequest_Azure_SendAnimeFull cmdAzure = new CommandRequest_Azure_SendAnimeFull(anime.AnimeID);
					cmdAzure.Save();
				}
				catch { }
			}
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:18,代码来源:MainWindow.xaml.cs


示例20: GenerateAzureList

		private void GenerateAzureList()
		{

			// get a lst of anime's that we already have
			AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
			List<AniDB_Anime> allAnime = repAnime.GetAll();
			Dictionary<int, int> localAnimeIDs = new Dictionary<int, int>();
			foreach (AniDB_Anime anime in allAnime)
			{
				localAnimeIDs[anime.AnimeID] = anime.AnimeID;
			}

			// loop through the list of valid anime id's and add the ones we don't have yet
			Dictionary<int, int> validAnimeIDs = new Dictionary<int, int>();

			string line;
			System.IO.StreamReader file =
			   new System.IO.StreamReader(@"e:\animetitles.txt");
			while ((line = file.ReadLine()) != null)
			{
				string[] titlesArray = line.Split('|');

				try
				{
					int aid = int.Parse(titlesArray[0]);
					if (!localAnimeIDs.ContainsKey(aid))
						validAnimeIDs[aid] = aid;
				}
				catch { }
			}

			file.Close();

			string aids = "";
			var shuffledList = validAnimeIDs.Values.OrderBy(a => Guid.NewGuid());
			int i = 0;
			foreach (int animeID in shuffledList)
			{
				i++;
				if (!string.IsNullOrEmpty(aids)) aids += ",";
				aids += animeID;

				if (i == 250)
				{
					logger.Info(aids);
					aids = "";
					i = 0;
				}
			}

			logger.Info(aids);
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:52,代码来源:MainWindow.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Repositories.AnimeSeriesRepository类代码示例发布时间:2022-05-26
下一篇:
C# Entities.CommandRequest类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap