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


C# VideoLocalRepository.GetByName方法代码示例

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


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

示例1: 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,代码来源:

示例2: RunImport_ScanFolder

		public static void RunImport_ScanFolder(int importFolderID)
		{
			// get a complete list of files
			List<string> fileList = new List<string>();
			ImportFolderRepository repFolders = new ImportFolderRepository();
			int filesFound = 0, videosFound = 0;
			int i = 0;

			try
			{
				ImportFolder fldr = repFolders.GetByID(importFolderID);
				if (fldr == null) return;

				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)
				{
					try
					{
						dictFilesExisting[vl.FullServerPath] = vl;
					}
					catch (Exception ex)
					{
						string msg = string.Format("Error RunImport_ScanFolder XREF: {0} - {1}", vl.ToStringDetailed(), ex.ToString());
						logger.Info(msg);
					}
				}





				logger.Debug("ImportFolder: {0} || {1}", fldr.ImportFolderName, fldr.ImportFolderLocation);

				Utils.GetFilesForImportFolder(fldr.ImportFolderLocation, ref fileList);

				// get a list of all files in the share
				foreach (string fileName in fileList)
				{
					i++;

                    if (dictFilesExisting.ContainsKey(fileName))
                    {
                        if (fldr.IsDropSource != 1)
                            continue;
                        else
                        {
                            // if this is a file in a drop source, try moving it
                            string filePath = string.Empty;
                            int nshareID = 0;
                            DataAccessHelper.GetShareAndPath(fileName, repFolders.GetAll(), ref nshareID, ref filePath);
                            List<VideoLocal> filesSearch = repVidLocals.GetByName(filePath);
                            foreach (VideoLocal vid in filesSearch)
                                vid.MoveFileIfRequired();
                        }
                    }
					
					filesFound++;
					logger.Info("Processing File {0}/{1} --- {2}", i, fileList.Count, fileName);

					if (!FileHashHelper.IsVideo(fileName)) continue;

					videosFound++;

					CommandRequest_HashFile cr_hashfile = new CommandRequest_HashFile(fileName, false);
					cr_hashfile.Save();

				}
				logger.Debug("Found {0} new files", filesFound);
				logger.Debug("Found {0} videos", videosFound);
			}
			catch (Exception ex)
			{
				logger.ErrorException(ex.ToString(), ex);
			}
		}
开发者ID:maz0r,项目名称:jmmserver,代码行数:78,代码来源:Importer.cs


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