The Free Software Media System - Server Backend & API
updated nuget
Luke Pulverentic87c516ea32b
diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.csindex 27944a4ea7..f5fe921cec 100644--- a/MediaBrowser.Api/Library/LibraryStructureService.cs+++ b/MediaBrowser.Api/Library/LibraryStructureService.cs@@ -212,24 +212,26 @@ namespace MediaBrowser.Api.LibraryFile.Create(path);}-- // Need to add a delay here or directory watchers may still pick up the changes- var task = Task.Delay(1000);- // Have to block here to allow exceptions to bubble- Task.WaitAll(task);}finally{- // No need to start if scanning the library because it will handle it- if (!request.RefreshLibrary)+ Task.Run(() =>{- _libraryMonitor.Start();- }- }-- if (request.RefreshLibrary)- {- _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ // No need to start if scanning the library because it will handle it+ if (request.RefreshLibrary)+ {+ _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ }+ else+ {+ // Need to add a delay here or directory watchers may still pick up the changes+ var task = Task.Delay(1000);+ // Have to block here to allow exceptions to bubble+ Task.WaitAll(task);++ _libraryMonitor.Start();+ }+ });}}@@ -279,24 +281,26 @@ namespace MediaBrowser.Api.Library}Directory.Move(currentPath, newPath);-- // Need to add a delay here or directory watchers may still pick up the changes- var task = Task.Delay(1000);- // Have to block here to allow exceptions to bubble- Task.WaitAll(task);}finally{- // No need to start if scanning the library because it will handle it- if (!request.RefreshLibrary)+ Task.Run(() =>{- _libraryMonitor.Start();- }- }-- if (request.RefreshLibrary)- {- _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ // No need to start if scanning the library because it will handle it+ if (request.RefreshLibrary)+ {+ _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ }+ else+ {+ // Need to add a delay here or directory watchers may still pick up the changes+ var task = Task.Delay(1000);+ // Have to block here to allow exceptions to bubble+ Task.WaitAll(task);++ _libraryMonitor.Start();+ }+ });}}@@ -325,24 +329,26 @@ namespace MediaBrowser.Api.Librarytry{_fileSystem.DeleteDirectory(path, true);-- // Need to add a delay here or directory watchers may still pick up the changes- var delayTask = Task.Delay(1000);- // Have to block here to allow exceptions to bubble- Task.WaitAll(delayTask);}finally{- // No need to start if scanning the library because it will handle it- if (!request.RefreshLibrary)+ Task.Run(() =>{- _libraryMonitor.Start();- }- }-- if (request.RefreshLibrary)- {- _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ // No need to start if scanning the library because it will handle it+ if (request.RefreshLibrary)+ {+ _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ }+ else+ {+ // Need to add a delay here or directory watchers may still pick up the changes+ var task = Task.Delay(1000);+ // Have to block here to allow exceptions to bubble+ Task.WaitAll(task);++ _libraryMonitor.Start();+ }+ });}}@@ -362,24 +368,26 @@ namespace MediaBrowser.Api.Librarytry{LibraryHelpers.AddMediaPath(_fileSystem, request.Name, request.Path, _appPaths);-- // Need to add a delay here or directory watchers may still pick up the changes- var task = Task.Delay(1000);- // Have to block here to allow exceptions to bubble- Task.WaitAll(task);}finally{- // No need to start if scanning the library because it will handle it- if (!request.RefreshLibrary)+ Task.Run(() =>{- _libraryMonitor.Start();- }- }-- if (request.RefreshLibrary)- {- _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ // No need to start if scanning the library because it will handle it+ if (request.RefreshLibrary)+ {+ _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ }+ else+ {+ // Need to add a delay here or directory watchers may still pick up the changes+ var task = Task.Delay(1000);+ // Have to block here to allow exceptions to bubble+ Task.WaitAll(task);++ _libraryMonitor.Start();+ }+ });}}@@ -399,24 +407,26 @@ namespace MediaBrowser.Api.Librarytry{LibraryHelpers.RemoveMediaPath(_fileSystem, request.Name, request.Path, _appPaths);-- // Need to add a delay here or directory watchers may still pick up the changes- var task = Task.Delay(1000);- // Have to block here to allow exceptions to bubble- Task.WaitAll(task);}finally{- // No need to start if scanning the library because it will handle it- if (!request.RefreshLibrary)+ Task.Run(() =>{- _libraryMonitor.Start();- }- }-- if (request.RefreshLibrary)- {- _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ // No need to start if scanning the library because it will handle it+ if (request.RefreshLibrary)+ {+ _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);+ }+ else+ {+ // Need to add a delay here or directory watchers may still pick up the changes+ var task = Task.Delay(1000);+ // Have to block here to allow exceptions to bubble+ Task.WaitAll(task);++ _libraryMonitor.Start();+ }+ });}}}diff --git a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs b/MediaBrowser.Controller/Sync/IServerSyncProvider.csindex 422349b80e..abf884e9d5 100644--- a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs+++ b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs@@ -60,7 +60,8 @@ namespace MediaBrowser.Controller.Sync/// </summary>/// <param name="path">The path.</param>/// <param name="target">The target.</param>+ /// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task<List<DeviceFileInfo>>.</returns>- Task<List<DeviceFileInfo>> GetFileSystemEntries(string path, SyncTarget target);+ Task<List<DeviceFileInfo>> GetFileSystemEntries(string path, SyncTarget target, CancellationToken cancellationToken);}}diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.csindex 95dcee98ad..71daf2b0cf 100644--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs@@ -62,6 +62,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Moviesreturn ResolveVideos<Video>(parent, files, directoryService, collectionType, false);}+ if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))+ {+ return ResolveVideos<Video>(parent, files, directoryService, collectionType, false);+ }+if (string.IsNullOrEmpty(collectionType)){// Owned items should just use the plain video type@@ -225,6 +230,10 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies{item = ResolveVideo<Video>(args, false);}+ else if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))+ {+ item = ResolveVideo<Video>(args, false);+ }else if (string.IsNullOrEmpty(collectionType)){if (args.HasParent<Series>())@@ -358,6 +367,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies}var supportsMultiVersion = !string.Equals(collectionType, CollectionType.HomeVideos) &&+ !string.Equals(collectionType, CollectionType.Photos) &&!string.Equals(collectionType, CollectionType.MusicVideos);var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, collectionType, supportsMultiVersion);@@ -474,7 +484,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.MoviesCollectionType.Movies,CollectionType.HomeVideos,CollectionType.MusicVideos,- CollectionType.Movies+ CollectionType.Movies,+ CollectionType.Photos};return !validCollectionTypes.Contains(collectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);diff --git a/MediaBrowser.Server.Implementations/Sync/MediaSync.cs b/MediaBrowser.Server.Implementations/Sync/MediaSync.csindex 48f682f98a..c9ed4637a6 100644--- a/MediaBrowser.Server.Implementations/Sync/MediaSync.cs+++ b/MediaBrowser.Server.Implementations/Sync/MediaSync.cs@@ -203,7 +203,7 @@ namespace MediaBrowser.Server.Implementations.Syncforeach (var localItem in localItems){- var files = await GetFiles(provider, localItem, target);+ var files = await GetFiles(provider, localItem, target, cancellationToken);foreach (var file in files){@@ -326,12 +326,12 @@ namespace MediaBrowser.Server.Implementations.Syncreturn _fileSystem.GetValidFilename(filename);}- private async Task<List<ItemFileInfo>> GetFiles(IServerSyncProvider provider, LocalItem item, SyncTarget target)+ private async Task<List<ItemFileInfo>> GetFiles(IServerSyncProvider provider, LocalItem item, SyncTarget target, CancellationToken cancellationToken){var path = item.LocalPath;path = provider.GetParentDirectoryPath(path, target);- var list = await provider.GetFileSystemEntries(path, target).ConfigureAwait(false);+ var list = await provider.GetFileSystemEntries(path, target, cancellationToken).ConfigureAwait(false);var itemFiles = new List<ItemFileInfo>();diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspecindex 5941a2a15f..bbdce1f110 100644--- a/Nuget/MediaBrowser.Common.Internal.nuspec+++ b/Nuget/MediaBrowser.Common.Internal.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common.Internal</id>- <version>3.0.591</version>+ <version>3.0.593</version><title>MediaBrowser.Common.Internal</title><authors>Luke</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.591" />+ <dependency id="MediaBrowser.Common" version="3.0.593" /><dependency id="NLog" version="3.2.0.0" /><dependency id="SimpleInjector" version="2.7.0" /></dependencies>diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspecindex dd0e8602d1..7aa7a9f695 100644--- a/Nuget/MediaBrowser.Common.nuspec+++ b/Nuget/MediaBrowser.Common.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common</id>- <version>3.0.591</version>+ <version>3.0.593</version><title>MediaBrowser.Common</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspecindex 2e09e01fd2..b33205c1e1 100644--- a/Nuget/MediaBrowser.Model.Signed.nuspec+++ b/Nuget/MediaBrowser.Model.Signed.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Model.Signed</id>- <version>3.0.591</version>+ <version>3.0.593</version><title>MediaBrowser.Model - Signed Edition</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspecindex ce2248e09a..9d6ad279ca 100644--- a/Nuget/MediaBrowser.Server.Core.nuspec+++ b/Nuget/MediaBrowser.Server.Core.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata><id>MediaBrowser.Server.Core</id>- <version>3.0.591</version>+ <version>3.0.593</version><title>Media Browser.Server.Core</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains core components required to build plugins for Media Browser Server.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.591" />+ <dependency id="MediaBrowser.Common" version="3.0.593" /></dependencies></metadata><files>