diff options
| author | Techywarrior <techywarrior@gmail.com> | 2013-04-13 17:04:49 -0700 |
|---|---|---|
| committer | Techywarrior <techywarrior@gmail.com> | 2013-04-13 17:04:49 -0700 |
| commit | 419d85116798bd5e5327c41d711d6cb46d70caeb (patch) | |
| tree | b7b94ae285e70f97c09c3343be4763ac59229957 /MediaBrowser.Server.Implementations/IO | |
| parent | 89ed33bbbcc3f47299a6104cbb1dd20ad3589510 (diff) | |
| parent | 7f1fdbf223f95dfc1435a8ff1b82fd635cc9b1d9 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Server.Implementations/IO')
| -rw-r--r-- | MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs b/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs index c33975a64..684b72cc9 100644 --- a/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs +++ b/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs @@ -39,6 +39,11 @@ namespace MediaBrowser.Server.Implementations.IO private readonly ConcurrentDictionary<string,string> _tempIgnoredPaths = new ConcurrentDictionary<string, string>(StringComparer.OrdinalIgnoreCase); /// <summary> + /// Any file name ending in any of these will be ignored by the watchers + /// </summary> + private readonly List<string> _alwaysIgnoreFiles = new List<string> {"thumbs.db","small.jpg","albumart.jpg"}; + + /// <summary> /// The timer lock /// </summary> private readonly object _timerLock = new object(); @@ -313,10 +318,18 @@ namespace MediaBrowser.Server.Implementations.IO /// <param name="e">The <see cref="FileSystemEventArgs" /> instance containing the event data.</param> void watcher_Changed(object sender, FileSystemEventArgs e) { + // Ignore when someone manually creates a new folder if (e.ChangeType == WatcherChangeTypes.Created && e.Name == "New folder") { return; } + + // Ignore certain files + if (_alwaysIgnoreFiles.Any(f => e.Name.EndsWith(f, StringComparison.OrdinalIgnoreCase))) + { + return; + } + if (_tempIgnoredPaths.ContainsKey(e.FullPath)) { Logger.Info("Watcher requested to ignore change to " + e.FullPath); |
