diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-12-15 00:16:23 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-12-15 00:16:23 -0500 |
| commit | e92e0365747c04f081be0efbb9afb78dc96aef9b (patch) | |
| tree | 51a7d2c0647d491737ca0bf9b9b8b3a11e9ee313 /MediaBrowser.Controller/Library | |
| parent | ed31b883f4bf1884ee974171501e61f83c768379 (diff) | |
add new sync methods
Diffstat (limited to 'MediaBrowser.Controller/Library')
| -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; |
