aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-01-06 12:28:05 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-01-06 12:28:05 -0500
commitc6580287f5886609fadb9144f2e62f4eb1076a26 (patch)
tree627420816b26f391291d83a72923d35e9851da65 /MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
parentf19e3ca7a85ffb54895dfbbc33c595b06a540c76 (diff)
parentb67683e0b5fffc3cce5ddcb8d77f965b8508adb8 (diff)
Merge branch 'dev' into beta
Diffstat (limited to 'MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs')
-rw-r--r--MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
index e107ea9f1..edc6b14ab 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);
}
@@ -532,9 +532,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)
{
@@ -651,7 +658,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)
{