本文整理汇总了C#中JMMServer.Repositories.VideoLocalRepository.GetByImportFolder方法的典型用法代码示例。如果您正苦于以下问题:C# VideoLocalRepository.GetByImportFolder方法的具体用法?C# VideoLocalRepository.GetByImportFolder怎么用?C# VideoLocalRepository.GetByImportFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.VideoLocalRepository
的用法示例。
在下文中一共展示了VideoLocalRepository.GetByImportFolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteImportFolder
public static string DeleteImportFolder(int importFolderID)
{
try
{
ImportFolderRepository repNS = new ImportFolderRepository();
ImportFolder ns = repNS.GetByID(importFolderID);
if (ns == null) return "Could not find Import Folder ID: " + importFolderID;
// first delete all the files attached to this import folder
Dictionary<int, AnimeSeries> affectedSeries = new Dictionary<int, AnimeSeries>();
VideoLocalRepository repVids = new VideoLocalRepository();
foreach (VideoLocal vid in repVids.GetByImportFolder(importFolderID))
{
//Thread.Sleep(5000);
logger.Info("Deleting video local record: {0}", vid.FullServerPath);
AnimeSeries ser = null;
List<AnimeEpisode> animeEpisodes = vid.GetAnimeEpisodes();
if (animeEpisodes.Count > 0)
{
ser = animeEpisodes[0].GetAnimeSeries();
if (ser != null && !affectedSeries.ContainsKey(ser.AnimeSeriesID))
affectedSeries.Add(ser.AnimeSeriesID, ser);
}
repVids.Delete(vid.VideoLocalID);
}
// delete any duplicate file records which reference this folder
DuplicateFileRepository repDupFiles = new DuplicateFileRepository();
foreach (DuplicateFile df in repDupFiles.GetByImportFolder1(importFolderID))
repDupFiles.Delete(df.DuplicateFileID);
foreach (DuplicateFile df in repDupFiles.GetByImportFolder2(importFolderID))
repDupFiles.Delete(df.DuplicateFileID);
// delete the import folder
repNS.Delete(importFolderID);
ServerInfo.Instance.RefreshImportFolders();
foreach (AnimeSeries ser in affectedSeries.Values)
{
ser.UpdateStats(true, true, true);
StatsCache.Instance.UpdateUsingSeries(ser.AnimeSeriesID);
}
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}