diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-10 15:11:46 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-10 15:11:46 -0500 |
| commit | cf9ef0e43d01decd743c5444785ee247bda3cb32 (patch) | |
| tree | 147bd7b0e2afdb8d88a56e1cf6b9b59bbb1eb14a /MediaBrowser.Controller/Entities | |
| parent | 326fa5a67090246c519cdb318c314bee4049a460 (diff) | |
fix refresh of tv recordings
Diffstat (limited to 'MediaBrowser.Controller/Entities')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 45 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/IHasImages.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Episode.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/UserRootFolder.cs | 18 |
5 files changed, 40 insertions, 43 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 38f40ea48..8dcf08642 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -157,6 +157,16 @@ namespace MediaBrowser.Controller.Entities } } + public virtual bool SupportsLocalMetadata + { + get + { + var locationType = LocationType; + + return locationType == LocationType.FileSystem || locationType == LocationType.Offline; + } + } + /// <summary> /// This is just a helper for convenience /// </summary> diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index f0b044d43..310ddf64c 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1052,50 +1052,17 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentNullException(); } - try + if (string.Equals(Path, path, StringComparison.OrdinalIgnoreCase)) { - var locationType = LocationType; - - if (locationType == LocationType.Remote && string.Equals(Path, path, StringComparison.OrdinalIgnoreCase)) - { - return this; - } - - if (locationType != LocationType.Virtual && PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase)) - { - return this; - } - } - catch (IOException ex) - { - Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); + return this; } - return RecursiveChildren.Where(i => i.LocationType != LocationType.Virtual).FirstOrDefault(i => + if (PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase)) { - try - { - if (string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - if (i.LocationType != LocationType.Remote) - { - if (i.PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase)) - { - return true; - } - } + return this; + } - return false; - } - catch (IOException ex) - { - Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); - return false; - } - }); + return RecursiveChildren.FirstOrDefault(i => string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase)); } public override bool IsPlayed(User user) diff --git a/MediaBrowser.Controller/Entities/IHasImages.cs b/MediaBrowser.Controller/Entities/IHasImages.cs index eee169363..d53eba11a 100644 --- a/MediaBrowser.Controller/Entities/IHasImages.cs +++ b/MediaBrowser.Controller/Entities/IHasImages.cs @@ -136,6 +136,12 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <returns><c>true</c> if [is save local metadata enabled]; otherwise, <c>false</c>.</returns> bool IsSaveLocalMetadataEnabled(); + + /// <summary> + /// Gets a value indicating whether [supports local metadata]. + /// </summary> + /// <value><c>true</c> if [supports local metadata]; otherwise, <c>false</c>.</value> + bool SupportsLocalMetadata { get; } } public static class HasImagesExtensions diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 39c11569a..daff3dd6c 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -185,7 +185,7 @@ namespace MediaBrowser.Controller.Entities.TV { get { - return LocationType == Model.Entities.LocationType.Virtual && PremiereDate.HasValue && PremiereDate.Value < DateTime.UtcNow; + return LocationType == LocationType.Virtual && PremiereDate.HasValue && PremiereDate.Value < DateTime.UtcNow; } } @@ -198,7 +198,7 @@ namespace MediaBrowser.Controller.Entities.TV [IgnoreDataMember] public bool IsVirtualUnaired { - get { return LocationType == Model.Entities.LocationType.Virtual && IsUnaired; } + get { return LocationType == LocationType.Virtual && IsUnaired; } } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs index 9afcdfe67..dc3d4c384 100644 --- a/MediaBrowser.Controller/Entities/UserRootFolder.cs +++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs @@ -1,6 +1,7 @@ -using System.Collections.Generic; -using System.Linq; +using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; +using System.Collections.Generic; +using System.Linq; namespace MediaBrowser.Controller.Entities { @@ -18,5 +19,18 @@ namespace MediaBrowser.Controller.Entities { return base.GetNonCachedChildren(directoryService).Concat(LibraryManager.RootFolder.VirtualChildren); } + + public override ItemUpdateType BeforeMetadataRefresh() + { + var updateType = base.BeforeMetadataRefresh(); + + if (string.Equals("default", Name, System.StringComparison.OrdinalIgnoreCase)) + { + Name = "Default Media Library"; + updateType = updateType | ItemUpdateType.MetadataEdit; + } + + return updateType; + } } } |
