Browse Source

updated nuget

Luke Pulverenti 10 years ago
parent
commit
c87c516ea3

+ 80 - 70
MediaBrowser.Api/Library/LibraryStructureService.cs

@@ -212,24 +212,26 @@ namespace MediaBrowser.Api.Library
 
                     File.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.Library
             try
             {
                 _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.Library
             try
             {
                 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.Library
             try
             {
                 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();
+                    }
+                });
             }
         }
     }

+ 2 - 1
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&lt;List&lt;DeviceFileInfo&gt;&gt;.</returns>
-        Task<List<DeviceFileInfo>> GetFileSystemEntries(string path, SyncTarget target);
+        Task<List<DeviceFileInfo>> GetFileSystemEntries(string path, SyncTarget target, CancellationToken cancellationToken);
     }
 }

+ 12 - 1
MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs

@@ -62,6 +62,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
                 return 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.Movies
                 CollectionType.Movies,
                 CollectionType.HomeVideos,
                 CollectionType.MusicVideos,
-                CollectionType.Movies
+                CollectionType.Movies,
+                CollectionType.Photos
             };
 
             return !validCollectionTypes.Contains(collectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);

+ 3 - 3
MediaBrowser.Server.Implementations/Sync/MediaSync.cs

@@ -203,7 +203,7 @@ namespace MediaBrowser.Server.Implementations.Sync
 
             foreach (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.Sync
             return _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>();
 

+ 2 - 2
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>

+ 1 - 1
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>

+ 1 - 1
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>

+ 2 - 2
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>