diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-01-11 21:55:52 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-01-11 21:55:52 -0500 |
| commit | 8a2e023e28dd546641571dd24be721397c9ee9e1 (patch) | |
| tree | a8b086e4bf154636393b76481150fc84fc3c21fc /MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs | |
| parent | ba4ca10ae29a50ed452ed3d05f885b3fa81595e2 (diff) | |
| parent | 355edfa2020d19b0fba6b09da40de4e66395d4b7 (diff) | |
Merge branch 'dev'
Conflicts:
MediaBrowser.Controller/Entities/BaseItem.cs
MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-apiclient/.bower.json
MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/.bower.json
MediaBrowser.WebDashboard/dashboard-ui/bower_components/iron-icons/.bower.json
MediaBrowser.WebDashboard/dashboard-ui/bower_components/iron-icons/bower.json
MediaBrowser.WebDashboard/dashboard-ui/strings/html/kk.json
MediaBrowser.WebDashboard/dashboard-ui/strings/html/ru.json
MediaBrowser.WebDashboard/dashboard-ui/strings/javascript/kk.json
MediaBrowser.WebDashboard/dashboard-ui/strings/javascript/ru.json
SharedVersion.cs
Diffstat (limited to 'MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index 97f082295..49cf4c162 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -217,7 +217,7 @@ namespace MediaBrowser.Server.Implementations.IO /// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param> void LibraryManager_ItemRemoved(object sender, ItemChangeEventArgs e) { - if (e.Item.Parent is AggregateFolder) + if (e.Item.GetParent() is AggregateFolder) { StopWatchingPath(e.Item.Path); } @@ -230,7 +230,7 @@ namespace MediaBrowser.Server.Implementations.IO /// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param> void LibraryManager_ItemAdded(object sender, ItemChangeEventArgs e) { - if (e.Item.Parent is AggregateFolder) + if (e.Item.GetParent() is AggregateFolder) { StartWatchingPath(e.Item.Path); } @@ -536,9 +536,16 @@ namespace MediaBrowser.Server.Implementations.IO return false; } + // In order to determine if the file is being written to, we have to request write access + // But if the server only has readonly access, this is going to cause this entire algorithm to fail + // So we'll take a best guess about our access level + var requestedFileAccess = ConfigurationManager.Configuration.SaveLocalMeta + ? FileAccess.ReadWrite + : FileAccess.Read; + try { - using (_fileSystem.GetFileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) + using (_fileSystem.GetFileStream(path, FileMode.Open, requestedFileAccess, FileShare.ReadWrite)) { if (_updateTimer != null) { @@ -655,7 +662,7 @@ namespace MediaBrowser.Server.Implementations.IO // If the item has been deleted find the first valid parent that still exists while (!_fileSystem.DirectoryExists(item.Path) && !_fileSystem.FileExists(item.Path)) { - item = item.Parent; + item = item.GetParent(); if (item == null) { |
