aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
diff options
context:
space:
mode:
authorebr11 Eric Reed spam <ebr11 Eric Reed spam@reedsplace.com>2012-09-17 16:24:01 -0400
committerebr11 Eric Reed spam <ebr11 Eric Reed spam@reedsplace.com>2012-09-17 16:24:01 -0400
commitf385fe2f201c6727b04acb4b8b57f2b9fc086dd4 (patch)
tree39e0870bd19769d31d5330944145fecc48118c22 /MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
parentfe427bc7f4f1a709c43c8ecb035b07325ed710b9 (diff)
parent946c0e8256d61d5084efdd2196eef455fa13b89b (diff)
Merge with default
Diffstat (limited to 'MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs')
-rw-r--r--MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs68
1 files changed, 68 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
new file mode 100644
index 000000000..76541e0ef
--- /dev/null
+++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.IO;
+using MediaBrowser.Controller.IO;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Entities.TV;
+
+namespace MediaBrowser.Controller.Resolvers
+{
+ public static class EntityResolutionHelper
+ {
+ /// <summary>
+ /// Any folder named in this list will be ignored - can be added to at runtime for extensibility
+ /// </summary>
+ public static List<string> IgnoreFolders = new List<string>()
+ {
+ "trailers",
+ "metadata",
+ "bdmv",
+ "certificate",
+ "backup",
+ "video_ts",
+ "audio_ts",
+ "ps3_update",
+ "ps3_vprm"
+ };
+ /// <summary>
+ /// Determines whether a path should be resolved or ignored entirely - called before we even look at the contents
+ /// </summary>
+ /// <param name="path"></param>
+ /// <returns>false if the path should be ignored</returns>
+ public static bool ShouldResolvePath(WIN32_FIND_DATA path)
+ {
+ bool resolve = true;
+ // Ignore hidden files and folders
+ if (path.IsHidden || path.IsSystemFile)
+ {
+ resolve = false;
+ }
+
+ // Ignore any folders in our list
+ else if (path.IsDirectory && IgnoreFolders.Contains(Path.GetFileName(path.Path), StringComparer.OrdinalIgnoreCase))
+ {
+ resolve = false;
+ }
+
+ return resolve;
+ }
+
+ /// <summary>
+ /// Determines whether a path should be ignored based on its contents - called after the contents have been read
+ /// </summary>
+ public static bool ShouldResolvePathContents(ItemResolveEventArgs args)
+ {
+ bool resolve = true;
+ if (args.ContainsFile(".ignore"))
+ {
+ // Ignore any folders containing a file called .ignore
+ resolve = false;
+ }
+
+ return resolve;
+ }
+ }
+}