diff options
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 974b3f864..3a2879313 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -279,7 +279,7 @@ namespace MediaBrowser.Controller.Entities // Record the name of each file // Need to sort these because accoring to msdn docs, our i/o methods are not guaranteed in any order foreach (var file in ResolveArgs.FileSystemChildren - .Where(i => !i.Attributes.HasFlag(FileAttributes.System)) + .Where(i => (i.Attributes & FileAttributes.System) != FileAttributes.System) .OrderBy(f => f.Name)) { sb.Append(file.Name); @@ -363,12 +363,15 @@ namespace MediaBrowser.Controller.Entities return new ItemResolveArgs(ConfigurationManager.ApplicationPaths); } + var isDirectory = false; + if (UseParentPathToCreateResolveArgs) { path = System.IO.Path.GetDirectoryName(path); + isDirectory = true; } - pathInfo = pathInfo ?? FileSystem.GetFileSystemInfo(path); + pathInfo = pathInfo ?? (isDirectory ? new DirectoryInfo(path) : FileSystem.GetFileSystemInfo(path)); if (pathInfo == null || !pathInfo.Exists) { @@ -1001,31 +1004,6 @@ namespace MediaBrowser.Controller.Entities } /// <summary> - /// Clear out all metadata properties. Extend for sub-classes. - /// </summary> - public virtual void ClearMetaValues() - { - Images.Clear(); - ForcedSortName = null; - PremiereDate = null; - BackdropImagePaths.Clear(); - OfficialRating = null; - CustomRating = null; - Overview = null; - Taglines.Clear(); - Language = null; - Studios.Clear(); - Genres.Clear(); - CommunityRating = null; - RunTimeTicks = null; - AspectRatio = null; - ProductionYear = null; - ProviderIds.Clear(); - DisplayMediaType = GetType().Name; - ResolveArgs = null; - } - - /// <summary> /// Gets or sets the trailer URL. /// </summary> /// <value>The trailer URL.</value> @@ -1099,9 +1077,9 @@ namespace MediaBrowser.Controller.Entities var rating = CustomRating ?? OfficialRating; - if (user.Configuration.BlockNotRated && string.IsNullOrEmpty(rating)) + if (string.IsNullOrEmpty(rating)) { - return false; + return !user.Configuration.BlockNotRated; } var value = localizationManager.GetRatingLevel(rating); @@ -1447,11 +1425,6 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentException("Screenshots should be accessed using Item.Screenshots"); } - if (Images == null) - { - return null; - } - string val; Images.TryGetValue(type, out val); return val; @@ -1499,12 +1472,9 @@ namespace MediaBrowser.Controller.Entities // If it's null remove the key from the dictionary if (string.IsNullOrEmpty(path)) { - if (Images != null) + if (Images.ContainsKey(typeKey)) { - if (Images.ContainsKey(typeKey)) - { - Images.Remove(typeKey); - } + Images.Remove(typeKey); } } else |
