From e92e0365747c04f081be0efbb9afb78dc96aef9b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 15 Dec 2014 00:16:23 -0500 Subject: add new sync methods --- MediaBrowser.Controller/Library/ItemResolveArgs.cs | 30 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Controller/Library') diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index d1692aabf..4fa07421c 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -154,6 +154,28 @@ namespace MediaBrowser.Controller.Library /// The additional locations. private List AdditionalLocations { get; set; } + public bool HasParent() + where T : Folder + { + var parent = Parent; + + if (parent != null) + { + var item = parent as T; + + // Just in case the user decided to nest episodes. + // Not officially supported but in some cases we can handle it. + if (item == null) + { + item = parent.Parents.OfType().FirstOrDefault(); + } + + return item != null; + + } + return false; + } + /// /// Adds the additional location. /// @@ -165,7 +187,7 @@ namespace MediaBrowser.Controller.Library { throw new ArgumentNullException(); } - + if (AdditionalLocations == null) { AdditionalLocations = new List(); @@ -182,7 +204,7 @@ namespace MediaBrowser.Controller.Library { get { - var paths = string.IsNullOrWhiteSpace(Path) ? new string[] {} : new[] {Path}; + var paths = string.IsNullOrWhiteSpace(Path) ? new string[] { } : new[] { Path }; return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations); } } @@ -199,7 +221,7 @@ namespace MediaBrowser.Controller.Library { throw new ArgumentNullException(); } - + return GetFileSystemEntryByPath(System.IO.Path.Combine(Path, name)); } @@ -215,7 +237,7 @@ namespace MediaBrowser.Controller.Library { throw new ArgumentNullException(); } - + if (FileSystemDictionary != null) { FileSystemInfo entry; -- cgit v1.2.3