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


C# Repositories.VideoLocalRepository类代码示例

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


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

示例1: ProcessCommand

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

			
			try
			{
				VideoLocalRepository repVids = new VideoLocalRepository();
				AnimeEpisodeRepository repEpisodes = new AnimeEpisodeRepository();

				// NOTE - we might return more than one VideoLocal record here, if there are duplicates by hash
				VideoLocal vid = repVids.GetByHash(this.Hash);
				if (vid != null)
				{
					bool isManualLink = false;
					List<CrossRef_File_Episode> xrefs = vid.EpisodeCrossRefs;
					if (xrefs.Count > 0)
						isManualLink = xrefs[0].CrossRefSource != (int)CrossRefSource.AniDB;

					if (isManualLink)
					{
						JMMService.AnidbProcessor.UpdateMyListFileStatus(xrefs[0].AnimeID, xrefs[0].Episode.EpisodeNumber, this.Watched);
						logger.Info("Updating file list status (GENERIC): {0} - {1}", vid.ToString(), this.Watched);
					}
					else
					{
						if (WatchedDateAsSecs > 0)
						{
							DateTime? watchedDate = Utils.GetAniDBDateAsDate(WatchedDateAsSecs);
							JMMService.AnidbProcessor.UpdateMyListFileStatus(vid, this.Watched, watchedDate);
						}
						else
							JMMService.AnidbProcessor.UpdateMyListFileStatus(vid, this.Watched, null);
						logger.Info("Updating file list status: {0} - {1}", vid.ToString(), this.Watched);
					}

					if (UpdateSeriesStats)
					{
						// update watched stats
						List<AnimeEpisode> eps = repEpisodes.GetByHash(vid.ED2KHash);
						if (eps.Count > 0)
						{
							// all the eps should belong to the same anime
							eps[0].GetAnimeSeries().UpdateStats(true, false, true);
							//eps[0].AnimeSeries.TopLevelAnimeGroup.UpdateStatsFromTopLevel(true, true, false);
						}
					}
				}

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

示例2: GetVideoLocalUserRecord

		public VideoLocal_User GetVideoLocalUserRecord(int userID)
		{
			VideoLocalRepository repVids = new VideoLocalRepository();

			VideoLocal vid = repVids.GetByHash(Hash);
			if (vid != null)
			{
				VideoLocal_User vidUser = vid.GetUserRecord(userID);
				if (vidUser != null) return vidUser;
			}

			return null;
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:13,代码来源:CrossRef_File_Episode.cs

示例3: ProcessCommand

		public override void ProcessCommand()
		{
			
			try
			{
				VideoLocalRepository repVids = new VideoLocalRepository();
				VideoLocal vlocal = repVids.GetByID(VideoLocalID);
				if (vlocal == null) return;

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

示例4: ProcessCommand

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

			
			try
			{
				VideoLocalRepository repVids = new VideoLocalRepository();
				vlocal = repVids.GetByID(VideoLocalID);
				if (vlocal == null) return;

				//now that we have all the has info, we can get the AniDB Info
				ProcessFile_AniDB(vlocal);
			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_ProcessFile: {0} - {1}", VideoLocalID, ex.ToString());
				return;
			}

			// TODO update stats for group and series

			// TODO check for TvDB
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:24,代码来源:CommandRequest_ProcessFile.cs

示例5: ToggleWatchedStatusOnVideo

        public string ToggleWatchedStatusOnVideo(int videoLocalID, bool watchedStatus, int userID)
        {
            try
            {
                VideoLocalRepository repVids = new VideoLocalRepository();
                VideoLocal vid = repVids.GetByID(videoLocalID);
                if (vid == null)
                    return "Could not find video local record";

                vid.ToggleWatchedStatus(watchedStatus, true, DateTime.Now, true, true, userID, true, true);

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

示例6: SearchForFiles

        public List<Contract_VideoLocal> SearchForFiles(int searchType, string searchCriteria, int userID)
        {
            try
            {
                List<Contract_VideoLocal> vids = new List<Contract_VideoLocal>();

                FileSearchCriteria sType = (FileSearchCriteria)searchType;

                VideoLocalRepository repVids = new VideoLocalRepository();
                switch (sType)
                {
                    case FileSearchCriteria.Name:

                        List<VideoLocal> results1 = repVids.GetByName(searchCriteria.Trim());
                        foreach (VideoLocal vid in results1)
                            vids.Add(vid.ToContract(userID));

                        break;

                    case FileSearchCriteria.ED2KHash:

                        VideoLocal vidByHash = repVids.GetByHash(searchCriteria.Trim());
                        if (vidByHash != null)
                            vids.Add(vidByHash.ToContract(userID));

                        break;

                    case FileSearchCriteria.Size:

                        break;

                    case FileSearchCriteria.LastOneHundred:

                        List<VideoLocal> results2 = repVids.GetMostRecentlyAdded(100);
                        foreach (VideoLocal vid in results2)
                            vids.Add(vid.ToContract(userID));

                        break;
                }

                return vids;
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
            }
            return new List<Contract_VideoLocal>();
        }
开发者ID:,项目名称:,代码行数:48,代码来源:

示例7: SetVariationStatusOnFile

        public string SetVariationStatusOnFile(int videoLocalID, bool isVariation)
        {
            try
            {
                VideoLocalRepository repVids = new VideoLocalRepository();
                VideoLocal vid = repVids.GetByID(videoLocalID);
                if (vid == null)
                    return "Could not find video record";

                vid.IsVariation = isVariation ? 1 : 0;
                repVids.Save(vid);

                return "";

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

示例8: GetUserInfoData

        public static UserInfo GetUserInfoData(string dashType = "", string vidPlayer = "")
        {
            try
            {
                if (string.IsNullOrEmpty(ServerSettings.AniDB_Username)) return null;

                UserInfo uinfo = new UserInfo();

                uinfo.DateTimeUpdated = DateTime.Now;
                uinfo.DateTimeUpdatedUTC = 0;

                // Optional JMM Desktop data
                uinfo.DashboardType = null;
                uinfo.VideoPlayer = vidPlayer;

                System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
                try
                {
                    if (a != null) uinfo.JMMServerVersion = Utils.GetApplicationVersion(a);
                }
                catch {}

                uinfo.UsernameHash = Utils.GetMd5Hash(ServerSettings.AniDB_Username);
                uinfo.DatabaseType = ServerSettings.DatabaseType;
                uinfo.WindowsVersion = Utils.GetOSInfo();
                uinfo.TraktEnabled = ServerSettings.Trakt_IsEnabled ? 1 : 0;
                uinfo.MALEnabled = string.IsNullOrEmpty(ServerSettings.MAL_Username) ? 0 : 1;

                uinfo.CountryLocation = "";
                
                // this field is not actually used
                uinfo.LastEpisodeWatchedAsDate = DateTime.Now.AddDays(-5);

                JMMUserRepository repUsers = new JMMUserRepository();
                uinfo.LocalUserCount = (int)(repUsers.GetTotalRecordCount());

                VideoLocalRepository repVids = new VideoLocalRepository();
                uinfo.FileCount = repVids.GetTotalRecordCount();

                AnimeEpisode_UserRepository repEps = new AnimeEpisode_UserRepository();
                List<AnimeEpisode_User> recs = repEps.GetLastWatchedEpisode();
                uinfo.LastEpisodeWatched = 0;
                if (recs.Count > 0)
                    uinfo.LastEpisodeWatched = Utils.GetAniDBDateAsSeconds(recs[0].WatchedDate);

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

示例9: GetVideoDetailed

        public Contract_VideoDetailed GetVideoDetailed(int videoLocalID, int userID)
        {
            try
            {
                VideoLocalRepository repVids = new VideoLocalRepository();
                VideoLocal vid = repVids.GetByID(videoLocalID);
                if (vid == null)
                    return null;

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

示例10: DeleteVideoLocalAndFile

        /// <summary>
        /// Delets the VideoLocal record and the associated physical file
        /// </summary>
        /// <param name="videoLocalID"></param>
        /// <returns></returns>
        public string DeleteVideoLocalAndFile(int videoLocalID)
        {
            try
            {
                VideoLocalRepository repVids = new VideoLocalRepository();
                VideoLocal vid = repVids.GetByID(videoLocalID);
                if (vid == null) return "Database entry does not exist";

                logger.Info("Deleting video local record and file: {0}", vid.FullServerPath);
                if (File.Exists(vid.FullServerPath))
                {
                    try
                    {
                        File.Delete(vid.FullServerPath);
                    }
                    catch { }
                }

                AnimeSeries ser = null;
                List<AnimeEpisode> animeEpisodes = vid.GetAnimeEpisodes();
                if (animeEpisodes.Count > 0)
                    ser = animeEpisodes[0].GetAnimeSeries();

                CommandRequest_DeleteFileFromMyList cmdDel = new CommandRequest_DeleteFileFromMyList(vid.Hash, vid.FileSize);
                cmdDel.Save();

                repVids.Delete(videoLocalID);

                if (ser != null)
                {
                    ser.QueueUpdateStats();
                    //StatsCache.Instance.UpdateUsingSeries(ser.AnimeSeriesID);
                }

                // For deletion of files from Trakt, we will rely on the Daily sync

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

示例11: workerMediaInfo_DoWork

		void workerMediaInfo_DoWork(object sender, DoWorkEventArgs e)
		{
			VideoLocalRepository repVidLocals = new VideoLocalRepository();

			// first build a list of files that we already know about, as we don't want to process them again
			List<VideoLocal> filesAll = repVidLocals.GetAll();
			Dictionary<string, VideoLocal> dictFilesExisting = new Dictionary<string, VideoLocal>();
			foreach (VideoLocal vl in filesAll)
			{
				CommandRequest_ReadMediaInfo cr = new CommandRequest_ReadMediaInfo(vl.VideoLocalID);
				cr.Save();
			}
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:13,代码来源:MainWindow.xaml.cs

示例12: RenameFile

        public Contract_VideoLocalRenamed RenameFile(int videoLocalID, string renameRules)
        {
            Contract_VideoLocalRenamed ret = new Contract_VideoLocalRenamed();
            ret.VideoLocalID = videoLocalID;
            ret.Success = true;
            try
            {
                VideoLocalRepository repVids = new VideoLocalRepository();
                VideoLocal vid = repVids.GetByID(videoLocalID);
                if (vid == null)
                {
                    ret.VideoLocal = null;
                    ret.NewFileName = string.Format("ERROR: Could not find file record");
                    ret.Success = false;
                }
                else
                {
                    ret.VideoLocal = null;
                    ret.NewFileName = RenameFileHelper.GetNewFileName(vid, renameRules);

                    if (!string.IsNullOrEmpty(ret.NewFileName))
                    {
                        // check if the file exists
                        string fullFileName = vid.FullServerPath;
                        if (!File.Exists(fullFileName))
                        {
                            ret.NewFileName = "Error could not find the original file";
                            ret.Success = false;
                            return ret;
                        }

                        // actually rename the file
                        string path = Path.GetDirectoryName(fullFileName);
                        string newFullName = Path.Combine(path, ret.NewFileName);

                        try
                        {
                            logger.Info(string.Format("Renaming file From ({0}) to ({1})....", fullFileName, newFullName));

                            if (fullFileName.Equals(newFullName, StringComparison.InvariantCultureIgnoreCase))
                            {
                                logger.Info(string.Format("Renaming file SKIPPED, no change From ({0}) to ({1})", fullFileName, newFullName));
                                ret.NewFileName = newFullName;
                            }
                            else
                            {
                                File.Move(fullFileName, newFullName);
                                logger.Info(string.Format("Renaming file SUCCESS From ({0}) to ({1})", fullFileName, newFullName));
                                ret.NewFileName = newFullName;

                                string newPartialPath = "";
                                int folderID = vid.ImportFolderID;
                                ImportFolderRepository repFolders = new ImportFolderRepository();

                                DataAccessHelper.GetShareAndPath(newFullName, repFolders.GetAll(), ref folderID, ref newPartialPath);

                                vid.FilePath = newPartialPath;
                                repVids.Save(vid);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Info(string.Format("Renaming file FAIL From ({0}) to ({1}) - {2}", fullFileName, newFullName, ex.Message));
                            logger.ErrorException(ex.ToString(), ex);
                            ret.Success = false;
                            ret.NewFileName = ex.Message;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
                ret.VideoLocal = null;
                ret.NewFileName = string.Format("ERROR: {0}", ex.Message);
                ret.Success = false;
            }
            return ret;
        }
开发者ID:,项目名称:,代码行数:79,代码来源:

示例13: RenameFilePreview

        public Contract_VideoLocalRenamed RenameFilePreview(int videoLocalID, string renameRules)
        {
            Contract_VideoLocalRenamed ret = new Contract_VideoLocalRenamed();
            ret.VideoLocalID = videoLocalID;
            ret.Success = true;

            try
            {
                VideoLocalRepository repVids = new VideoLocalRepository();
                VideoLocal vid = repVids.GetByID(videoLocalID);
                if (vid == null)
                {
                    ret.VideoLocal = null;
                    ret.NewFileName = string.Format("ERROR: Could not find file record");
                    ret.Success = false;
                }
                else
                {
                    if (videoLocalID == 726)
                        Debug.Write("test");

                    ret.VideoLocal = null;
                    ret.NewFileName = RenameFileHelper.GetNewFileName(vid, renameRules);
                    if (string.IsNullOrEmpty(ret.NewFileName)) ret.Success = false;
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
                ret.VideoLocal = null;
                ret.NewFileName = string.Format("ERROR: {0}", ex.Message);
                ret.Success = false;
            }
            return ret;
        }
开发者ID:,项目名称:,代码行数:35,代码来源:

示例14: RehashFile

        public void RehashFile(int videoLocalID)
        {
            VideoLocalRepository repVidLocals = new VideoLocalRepository();
            VideoLocal vl = repVidLocals.GetByID(videoLocalID);

            if (vl != null)
            {
                CommandRequest_HashFile cr_hashfile = new CommandRequest_HashFile(vl.FullServerPath, true);
                cr_hashfile.Save();
            }
        }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例15: RemoveAssociationOnFile

        public string RemoveAssociationOnFile(int videoLocalID, int aniDBEpisodeID)
        {
            try
            {
                VideoLocalRepository repVids = new VideoLocalRepository();
                CrossRef_File_EpisodeRepository repXRefs = new CrossRef_File_EpisodeRepository();

                VideoLocal vid = repVids.GetByID(videoLocalID);
                if (vid == null)
                    return "Could not find video record";

                int? animeSeriesID = null;
                foreach (AnimeEpisode ep in vid.GetAnimeEpisodes())
                {
                    if (ep.AniDB_EpisodeID != aniDBEpisodeID) continue;

                    animeSeriesID = ep.AnimeSeriesID;
                    CrossRef_File_Episode xref = repXRefs.GetByHashAndEpisodeID(vid.Hash, ep.AniDB_EpisodeID);
                    if (xref != null)
                    {
                        if (xref.CrossRefSource == (int)CrossRefSource.AniDB)
                            return "Cannot remove associations created from AniDB data";

                        // delete cross ref from web cache
                        CommandRequest_WebCacheDeleteXRefFileEpisode cr = new CommandRequest_WebCacheDeleteXRefFileEpisode(vid.Hash, ep.AniDB_EpisodeID);
                        cr.Save();

                        repXRefs.Delete(xref.CrossRef_File_EpisodeID);
                    }
                }

                if (animeSeriesID.HasValue)
                {
                    AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                    AnimeSeries ser = repSeries.GetByID(animeSeriesID.Value);
                    if (ser != null)
                        ser.QueueUpdateStats();
                }

                return "";

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


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