diff options
Diffstat (limited to 'MediaBrowser.Controller/Library/ItemResolveArgs.cs')
| -rw-r--r-- | MediaBrowser.Controller/Library/ItemResolveArgs.cs | 30 |
1 files changed, 26 insertions, 4 deletions
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 /// <value>The additional locations.</value> private List<string> AdditionalLocations { get; set; } + public bool HasParent<T>() + 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<T>().FirstOrDefault(); + } + + return item != null; + + } + return false; + } + /// <summary> /// Adds the additional location. /// </summary> @@ -165,7 +187,7 @@ namespace MediaBrowser.Controller.Library { throw new ArgumentNullException(); } - + if (AdditionalLocations == null) { AdditionalLocations = new List<string>(); @@ -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; |
