/// <summary> /// Determines whether the item has a saved local image of the specified name (jpg or png). /// </summary> /// <param name="name">The name.</param> /// <returns><c>true</c> if [has local image] [the specified item]; otherwise, <c>false</c>.</returns> /// <exception cref="System.ArgumentNullException">name</exception> public bool HasLocalImage(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } return(ResolveArgs.ContainsMetaFileByName(name + ".jpg") || ResolveArgs.ContainsMetaFileByName(name + ".png")); }
/// <summary> /// Loads special features from the file system /// </summary> /// <param name="entity">The entity.</param> /// <returns>List{Video}.</returns> /// <exception cref="System.ArgumentNullException"></exception> private IEnumerable <Video> LoadSpecialFeatures() { WIN32_FIND_DATA?folder; try { folder = ResolveArgs.GetFileSystemEntryByName("specials"); } catch (IOException ex) { Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); return(new List <Video> { }); } // Path doesn't exist. No biggie if (folder == null) { return(new List <Video> { }); } IEnumerable <WIN32_FIND_DATA> files; try { files = FileSystem.GetFiles(folder.Value.Path); } catch (IOException ex) { Logger.ErrorException("Error loading trailers for {0}", ex, Name); return(new List <Video> { }); } return(LibraryManager.ResolvePaths <Video>(files, null).Select(video => { // Try to retrieve it from the db. If we don't find it, use the resolved version var dbItem = Kernel.Instance.ItemRepository.RetrieveItem(video.Id) as Video; if (dbItem != null) { dbItem.ResolveArgs = video.ResolveArgs; video = dbItem; } return video; })); }
/// <summary> /// Loads the special features. /// </summary> /// <returns>IEnumerable{Video}.</returns> private IEnumerable <Video> LoadSpecialFeatures() { FileSystemInfo folder; try { folder = ResolveArgs.GetFileSystemEntryByName("specials"); } catch (IOException ex) { Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); return(new List <Video>()); } // Path doesn't exist. No biggie if (folder == null) { return(new List <Video>()); } IEnumerable <FileSystemInfo> files; try { files = new DirectoryInfo(folder.FullName).EnumerateFiles(); } catch (IOException ex) { Logger.ErrorException("Error loading special features for {0}", ex, Name); return(new List <Video>()); } return(LibraryManager.ResolvePaths <Video>(files, null).Select(video => { // Try to retrieve it from the db. If we don't find it, use the resolved version var dbItem = LibraryManager.RetrieveItem(video.Id) as Video; if (dbItem != null) { dbItem.ResetResolveArgs(video.ResolveArgs); video = dbItem; } return video; })); }