aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/BaseItem.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs59
1 files changed, 13 insertions, 46 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 974b3f864..9e28e4242 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)
{
@@ -750,7 +753,7 @@ namespace MediaBrowser.Controller.Entities
// Support xbmc trailers (-trailer suffix on video file names)
files.AddRange(resolveArgs.FileSystemChildren.Where(i =>
{
- if (!i.Attributes.HasFlag(FileAttributes.Directory))
+ if ((i.Attributes & FileAttributes.Directory) != FileAttributes.Directory)
{
if (System.IO.Path.GetFileNameWithoutExtension(i.Name).EndsWith(XbmcTrailerFileSuffix, StringComparison.OrdinalIgnoreCase) && !string.Equals(Path, i.FullName, StringComparison.OrdinalIgnoreCase))
{
@@ -913,14 +916,11 @@ namespace MediaBrowser.Controller.Entities
/// <param name="forceSave">if set to <c>true</c> [is new item].</param>
/// <param name="forceRefresh">if set to <c>true</c> [force].</param>
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
- /// <param name="resetResolveArgs">if set to <c>true</c> [reset resolve args].</param>
/// <returns>true if a provider reports we changed</returns>
- public virtual async Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true, bool resetResolveArgs = true)
+ public virtual async Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true)
{
- if (resetResolveArgs)
- {
- ResolveArgs = null;
- }
+ // Reload this
+ ResolveArgs = null;
// Refresh for the item
var itemRefreshTask = ProviderManager.ExecuteMetadataProviders(this, cancellationToken, forceRefresh, allowSlowProviders);
@@ -1001,31 +1001,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 +1074,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 +1422,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 +1469,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