Переглянути джерело

Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser

Conflicts:
	SharedVersion.cs
Luke Pulverenti 10 роки тому
батько
коміт
c48458f215
22 змінених файлів з 176 додано та 170 видалено
  1. 1 1
      MediaBrowser.Api/PackageReviewService.cs
  2. 1 1
      MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
  3. 1 1
      MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs
  4. 1 1
      MediaBrowser.Common.Implementations/Updates/InstallationManager.cs
  5. 2 113
      MediaBrowser.Controller/Entities/BaseItem.cs
  6. 1 2
      MediaBrowser.Controller/Entities/Folder.cs
  7. 1 1
      MediaBrowser.Controller/Entities/Movies/Movie.cs
  8. 20 40
      MediaBrowser.Controller/Library/ILibraryManager.cs
  9. 25 3
      MediaBrowser.Dlna/Didl/DidlBuilder.cs
  10. BIN
      MediaBrowser.Dlna/Images/people48.jpg
  11. BIN
      MediaBrowser.Dlna/Images/people48.png
  12. BIN
      MediaBrowser.Dlna/Images/people480.jpg
  13. BIN
      MediaBrowser.Dlna/Images/people480.png
  14. 8 0
      MediaBrowser.Dlna/MediaBrowser.Dlna.csproj
  15. 1 1
      MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs
  16. 1 1
      MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs
  17. 108 0
      MediaBrowser.Server.Implementations/Library/LibraryManager.cs
  18. 1 1
      MediaBrowser.Server.Implementations/Library/Validators/ArtistsPostScanTask.cs
  19. 1 1
      MediaBrowser.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs
  20. 1 1
      MediaBrowser.Server.Implementations/Library/Validators/GenresPostScanTask.cs
  21. 1 1
      MediaBrowser.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs
  22. 1 1
      MediaBrowser.Server.Implementations/Library/Validators/StudiosPostScanTask.cs

+ 1 - 1
MediaBrowser.Api/PackageReviewService.cs

@@ -102,7 +102,7 @@ namespace MediaBrowser.Api
         private readonly IHttpClient _httpClient;
         private readonly IHttpClient _httpClient;
         private readonly INetworkManager _netManager;
         private readonly INetworkManager _netManager;
         private readonly IJsonSerializer _serializer;
         private readonly IJsonSerializer _serializer;
-        private const string MbAdminUrl = "http://www.mb3admin.com/admin/";
+        private const string MbAdminUrl = "https://www.mb3admin.com/admin/";
 
 
         public PackageReviewService(IHttpClient client, INetworkManager net, IJsonSerializer serializer)
         public PackageReviewService(IHttpClient client, INetworkManager net, IJsonSerializer serializer)
         {
         {

+ 1 - 1
MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs

@@ -135,7 +135,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
                 request.Referer = options.Referer;
                 request.Referer = options.Referer;
             }
             }
 
 
-            request.ServicePoint.BindIPEndPointDelegate = BindIPEndPointCallback;
+            //request.ServicePoint.BindIPEndPointDelegate = BindIPEndPointCallback;
 
 
             return request;
             return request;
         }
         }

+ 1 - 1
MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs

@@ -17,7 +17,7 @@ namespace MediaBrowser.Common.Implementations.Security
     /// </summary>
     /// </summary>
     public class PluginSecurityManager : ISecurityManager
     public class PluginSecurityManager : ISecurityManager
     {
     {
-        private const string MbAdminUrl = "http://www.mb3admin.com/admin/";
+        private const string MbAdminUrl = "https://www.mb3admin.com/admin/";
         
         
         private const string MBValidateUrl = MbAdminUrl + "service/registration/validate";
         private const string MBValidateUrl = MbAdminUrl + "service/registration/validate";
 
 

+ 1 - 1
MediaBrowser.Common.Implementations/Updates/InstallationManager.cs

@@ -172,7 +172,7 @@ namespace MediaBrowser.Common.Implementations.Updates
         }
         }
 
 
         private Tuple<List<PackageInfo>, DateTime> _lastPackageListResult;
         private Tuple<List<PackageInfo>, DateTime> _lastPackageListResult;
-        private const string MbAdminUrl = "http://www.mb3admin.com/admin/";
+        private const string MbAdminUrl = "https://www.mb3admin.com/admin/";
 
 
         /// <summary>
         /// <summary>
         /// Gets all available packages.
         /// Gets all available packages.

+ 2 - 113
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -602,118 +602,6 @@ namespace MediaBrowser.Controller.Entities
             return PlayAccess.Full;
             return PlayAccess.Full;
         }
         }
 
 
-        /// <summary>
-        /// Loads local trailers from the file system
-        /// </summary>
-        /// <returns>List{Video}.</returns>
-        private IEnumerable<Trailer> LoadLocalTrailers(List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
-        {
-            var files = fileSystemChildren.OfType<DirectoryInfo>()
-                .Where(i => string.Equals(i.Name, TrailerFolderName, StringComparison.OrdinalIgnoreCase))
-                .SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
-                .ToList();
-
-            var extraTypes = new List<ExtraType> { ExtraType.Trailer };
-            var suffixes = ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
-                .Select(i => i.Key)
-                .ToList();
-
-            files.AddRange(fileSystemChildren.OfType<FileInfo>()
-                .Where(i =>
-                {
-                    var nameEithoutExtension = FileSystem.GetFileNameWithoutExtension(i);
-
-                    if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
-                    {
-                        return false;
-                    }
-
-                    return !string.Equals(Path, i.FullName, StringComparison.OrdinalIgnoreCase);
-                }));
-
-            return LibraryManager.ResolvePaths<Trailer>(files, directoryService, null).Select(video =>
-            {
-                // Try to retrieve it from the db. If we don't find it, use the resolved version
-                var dbItem = LibraryManager.GetItemById(video.Id) as Trailer;
-
-                if (dbItem != null)
-                {
-                    video = dbItem;
-                }
-
-                if (video != null)
-                {
-                    video.ExtraType = ExtraType.Trailer;
-                }
-
-                return video;
-
-                // Sort them so that the list can be easily compared for changes
-            }).OrderBy(i => i.Path).ToList();
-        }
-
-        protected IEnumerable<Video> LoadSpecialFeatures(List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
-        {
-            var files = fileSystemChildren.OfType<DirectoryInfo>()
-                .Where(i => string.Equals(i.Name, "extras", StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, "specials", StringComparison.OrdinalIgnoreCase))
-                .SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
-                .ToList();
-
-            var extraTypes = new List<ExtraType> { ExtraType.BehindTheScenes, ExtraType.DeletedScene, ExtraType.Interview, ExtraType.Sample, ExtraType.Scene, ExtraType.Clip };
-            var suffixes = ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
-                .Select(i => i.Key)
-                .ToList();
-
-            files.AddRange(fileSystemChildren.OfType<FileInfo>()
-                .Where(i =>
-                {
-                    var nameEithoutExtension = FileSystem.GetFileNameWithoutExtension(i);
-
-                    if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
-                    {
-                        return false;
-                    }
-
-                    return !string.Equals(Path, i.FullName, StringComparison.OrdinalIgnoreCase);
-                }));
-
-            return LibraryManager.ResolvePaths<Video>(files, directoryService, null).Select(video =>
-            {
-                // Try to retrieve it from the db. If we don't find it, use the resolved version
-                var dbItem = LibraryManager.GetItemById(video.Id) as Video;
-
-                if (dbItem != null)
-                {
-                    video = dbItem;
-                }
-
-                if (video != null)
-                {
-                    SetExtraTypeFromFilename(video);
-                }
-
-                return video;
-
-                // Sort them so that the list can be easily compared for changes
-            }).OrderBy(i => i.Path).ToList();
-        }
-
-        private void SetExtraTypeFromFilename(Video item)
-        {
-            var name = System.IO.Path.GetFileNameWithoutExtension(item.Path) ?? string.Empty;
-
-            foreach (var suffix in ExtraSuffixes)
-            {
-                if (name.EndsWith(suffix.Key, StringComparison.OrdinalIgnoreCase))
-                {
-                    item.ExtraType = suffix.Value;
-                    return;
-                }
-            }
-
-            item.ExtraType = ExtraType.Clip;
-        }
-
         /// <summary>
         /// <summary>
         /// Loads the theme songs.
         /// Loads the theme songs.
         /// </summary>
         /// </summary>
@@ -879,7 +767,8 @@ namespace MediaBrowser.Controller.Entities
 
 
         private async Task<bool> RefreshLocalTrailers(IHasTrailers item, MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
         private async Task<bool> RefreshLocalTrailers(IHasTrailers item, MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
         {
         {
-            var newItems = LoadLocalTrailers(fileSystemChildren, options.DirectoryService).ToList();
+            var newItems = LibraryManager.FindTrailers(this, fileSystemChildren, options.DirectoryService).ToList();
+
             var newItemIds = newItems.Select(i => i.Id).ToList();
             var newItemIds = newItems.Select(i => i.Id).ToList();
 
 
             var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds);
             var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds);

+ 1 - 2
MediaBrowser.Controller/Entities/Folder.cs

@@ -1,5 +1,4 @@
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.Progress;
+using MediaBrowser.Common.Progress;
 using MediaBrowser.Controller.Entities.TV;
 using MediaBrowser.Controller.Entities.TV;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Localization;
 using MediaBrowser.Controller.Localization;

+ 1 - 1
MediaBrowser.Controller/Entities/Movies/Movie.cs

@@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Entities.Movies
 
 
         private async Task<bool> RefreshSpecialFeatures(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
         private async Task<bool> RefreshSpecialFeatures(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
         {
         {
-            var newItems = LoadSpecialFeatures(fileSystemChildren, options.DirectoryService).ToList();
+            var newItems = LibraryManager.FindExtras(this, fileSystemChildren, options.DirectoryService).ToList();
             var newItemIds = newItems.Select(i => i.Id).ToList();
             var newItemIds = newItems.Select(i => i.Id).ToList();
 
 
             var itemsChanged = !SpecialFeatureIds.SequenceEqual(newItemIds);
             var itemsChanged = !SpecialFeatureIds.SequenceEqual(newItemIds);

+ 20 - 40
MediaBrowser.Controller/Library/ILibraryManager.cs

@@ -229,46 +229,6 @@ namespace MediaBrowser.Controller.Library
         /// <returns>BaseItem.</returns>
         /// <returns>BaseItem.</returns>
         BaseItem RetrieveItem(Guid id);
         BaseItem RetrieveItem(Guid id);
 
 
-        /// <summary>
-        /// Validates the artists.
-        /// </summary>
-        /// <param name="cancellationToken">The cancellation token.</param>
-        /// <param name="progress">The progress.</param>
-        /// <returns>Task.</returns>
-        Task ValidateArtists(CancellationToken cancellationToken, IProgress<double> progress);
-
-        /// <summary>
-        /// Validates the music genres.
-        /// </summary>
-        /// <param name="cancellationToken">The cancellation token.</param>
-        /// <param name="progress">The progress.</param>
-        /// <returns>Task.</returns>
-        Task ValidateMusicGenres(CancellationToken cancellationToken, IProgress<double> progress);
-
-        /// <summary>
-        /// Validates the game genres.
-        /// </summary>
-        /// <param name="cancellationToken">The cancellation token.</param>
-        /// <param name="progress">The progress.</param>
-        /// <returns>Task.</returns>
-        Task ValidateGameGenres(CancellationToken cancellationToken, IProgress<double> progress);
-
-        /// <summary>
-        /// Validates the genres.
-        /// </summary>
-        /// <param name="cancellationToken">The cancellation token.</param>
-        /// <param name="progress">The progress.</param>
-        /// <returns>Task.</returns>
-        Task ValidateGenres(CancellationToken cancellationToken, IProgress<double> progress);
-
-        /// <summary>
-        /// Validates the studios.
-        /// </summary>
-        /// <param name="cancellationToken">The cancellation token.</param>
-        /// <param name="progress">The progress.</param>
-        /// <returns>Task.</returns>
-        Task ValidateStudios(CancellationToken cancellationToken, IProgress<double> progress);
-
         /// <summary>
         /// <summary>
         /// Occurs when [item added].
         /// Occurs when [item added].
         /// </summary>
         /// </summary>
@@ -422,5 +382,25 @@ namespace MediaBrowser.Controller.Library
         /// <param name="type">The type.</param>
         /// <param name="type">The type.</param>
         /// <returns>Guid.</returns>
         /// <returns>Guid.</returns>
         Guid GetNewItemId(string key, Type type);
         Guid GetNewItemId(string key, Type type);
+
+        /// <summary>
+        /// Finds the trailers.
+        /// </summary>
+        /// <param name="owner">The owner.</param>
+        /// <param name="fileSystemChildren">The file system children.</param>
+        /// <param name="directoryService">The directory service.</param>
+        /// <returns>IEnumerable&lt;Trailer&gt;.</returns>
+        IEnumerable<Trailer> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren,
+            IDirectoryService directoryService);
+
+        /// <summary>
+        /// Finds the extras.
+        /// </summary>
+        /// <param name="owner">The owner.</param>
+        /// <param name="fileSystemChildren">The file system children.</param>
+        /// <param name="directoryService">The directory service.</param>
+        /// <returns>IEnumerable&lt;Video&gt;.</returns>
+        IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemInfo> fileSystemChildren,
+            IDirectoryService directoryService);
     }
     }
 }
 }

+ 25 - 3
MediaBrowser.Dlna/Didl/DidlBuilder.cs

@@ -111,7 +111,7 @@ namespace MediaBrowser.Dlna.Didl
                 }
                 }
             }
             }
 
 
-            AddCover(item, element);
+            AddCover(item, null, element);
 
 
             return element;
             return element;
         }
         }
@@ -469,7 +469,7 @@ namespace MediaBrowser.Dlna.Didl
 
 
             AddCommonFields(folder, stubType, null, container, filter);
             AddCommonFields(folder, stubType, null, container, filter);
 
 
-            AddCover(folder, container);
+            AddCover(folder, stubType, container);
 
 
             return container;
             return container;
         }
         }
@@ -750,8 +750,14 @@ namespace MediaBrowser.Dlna.Didl
             }
             }
         }
         }
 
 
-        private void AddCover(BaseItem item, XmlElement element)
+        private void AddCover(BaseItem item, StubType? stubType, XmlElement element)
         {
         {
+            if (stubType.HasValue && stubType.Value == StubType.People)
+            {
+                AddEmbeddedImageAsCover("people", element);
+                return;
+            }
+
             var imageInfo = GetImageInfo(item);
             var imageInfo = GetImageInfo(item);
 
 
             if (imageInfo == null)
             if (imageInfo == null)
@@ -810,6 +816,22 @@ namespace MediaBrowser.Dlna.Didl
             }
             }
         }
         }
 
 
+        private void AddEmbeddedImageAsCover(string name, XmlElement element)
+        {
+            var result = element.OwnerDocument;
+            
+            var icon = result.CreateElement("upnp", "albumArtURI", NS_UPNP);
+            var profile = result.CreateAttribute("dlna", "profileID", NS_DLNA);
+            profile.InnerText = _profile.AlbumArtPn;
+            icon.SetAttributeNode(profile);
+            icon.InnerText = _serverAddress + "/Dlna/icons/people480.jpg";
+            element.AppendChild(icon);
+
+            icon = result.CreateElement("upnp", "icon", NS_UPNP);
+            icon.InnerText = _serverAddress + "/Dlna/icons/people48.jpg";
+            element.AppendChild(icon);
+        }
+
         private void AddImageResElement(BaseItem item,
         private void AddImageResElement(BaseItem item,
             XmlElement element,
             XmlElement element,
             int maxWidth,
             int maxWidth,

BIN
MediaBrowser.Dlna/Images/people48.jpg


BIN
MediaBrowser.Dlna/Images/people48.png


BIN
MediaBrowser.Dlna/Images/people480.jpg


BIN
MediaBrowser.Dlna/Images/people480.png


+ 8 - 0
MediaBrowser.Dlna/MediaBrowser.Dlna.csproj

@@ -198,6 +198,14 @@
   <ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Profiles\Xml\Popcorn Hour.xml" />
     <EmbeddedResource Include="Profiles\Xml\Popcorn Hour.xml" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Images\people48.jpg" />
+    <EmbeddedResource Include="Images\people48.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Images\people480.jpg" />
+    <EmbeddedResource Include="Images\people480.png" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
        Other similar extension points exist, see Microsoft.Common.targets.

+ 1 - 1
MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs

@@ -18,7 +18,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
 {
 {
     public class RemoteNotifications : IServerEntryPoint
     public class RemoteNotifications : IServerEntryPoint
     {
     {
-        private const string Url = "http://www.mb3admin.com/admin/service/MB3ServerNotifications.json";
+        private const string Url = "https://www.mb3admin.com/admin/service/MB3ServerNotifications.json";
 
 
         private Timer _timer;
         private Timer _timer;
         private readonly IHttpClient _httpClient;
         private readonly IHttpClient _httpClient;

+ 1 - 1
MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs

@@ -12,7 +12,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
         private readonly IApplicationHost _applicationHost;
         private readonly IApplicationHost _applicationHost;
         private readonly INetworkManager _networkManager;
         private readonly INetworkManager _networkManager;
         private readonly IHttpClient _httpClient;
         private readonly IHttpClient _httpClient;
-        private const string MbAdminUrl = "http://www.mb3admin.com/admin/";
+        private const string MbAdminUrl = "https://www.mb3admin.com/admin/";
 
 
         public UsageReporter(IApplicationHost applicationHost, INetworkManager networkManager, IHttpClient httpClient)
         public UsageReporter(IApplicationHost applicationHost, INetworkManager networkManager, IHttpClient httpClient)
         {
         {

+ 108 - 0
MediaBrowser.Server.Implementations/Library/LibraryManager.cs

@@ -1736,5 +1736,113 @@ namespace MediaBrowser.Server.Implementations.Library
 
 
             return new List<FileSystemInfo>();
             return new List<FileSystemInfo>();
         }
         }
+
+        public IEnumerable<Trailer> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
+        {
+            var files = fileSystemChildren.OfType<DirectoryInfo>()
+                .Where(i => string.Equals(i.Name, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
+                .SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
+                .ToList();
+
+            var extraTypes = new List<ExtraType> { ExtraType.Trailer };
+            var suffixes = BaseItem.ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
+                .Select(i => i.Key)
+                .ToList();
+
+            files.AddRange(fileSystemChildren.OfType<FileInfo>()
+                .Where(i =>
+                {
+                    var nameEithoutExtension = _fileSystem.GetFileNameWithoutExtension(i);
+
+                    if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
+                    {
+                        return false;
+                    }
+
+                    return !string.Equals(owner.Path, i.FullName, StringComparison.OrdinalIgnoreCase);
+                }));
+
+            return ResolvePaths<Trailer>(files, directoryService, null).Select(video =>
+            {
+                // Try to retrieve it from the db. If we don't find it, use the resolved version
+                var dbItem = GetItemById(video.Id) as Trailer;
+
+                if (dbItem != null)
+                {
+                    video = dbItem;
+                }
+
+                if (video != null)
+                {
+                    video.ExtraType = ExtraType.Trailer;
+                }
+
+                return video;
+
+                // Sort them so that the list can be easily compared for changes
+            }).OrderBy(i => i.Path).ToList();
+        }
+
+        public IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
+        {
+            var files = fileSystemChildren.OfType<DirectoryInfo>()
+                .Where(i => string.Equals(i.Name, "extras", StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, "specials", StringComparison.OrdinalIgnoreCase))
+                .SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
+                .ToList();
+
+            var extraTypes = new List<ExtraType> { ExtraType.BehindTheScenes, ExtraType.DeletedScene, ExtraType.Interview, ExtraType.Sample, ExtraType.Scene, ExtraType.Clip };
+            var suffixes = BaseItem.ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
+                .Select(i => i.Key)
+                .ToList();
+
+            files.AddRange(fileSystemChildren.OfType<FileInfo>()
+                .Where(i =>
+                {
+                    var nameEithoutExtension = _fileSystem.GetFileNameWithoutExtension(i);
+
+                    if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
+                    {
+                        return false;
+                    }
+
+                    return !string.Equals(owner.Path, i.FullName, StringComparison.OrdinalIgnoreCase);
+                }));
+
+            return ResolvePaths<Video>(files, directoryService, null).Select(video =>
+            {
+                // Try to retrieve it from the db. If we don't find it, use the resolved version
+                var dbItem = GetItemById(video.Id) as Video;
+
+                if (dbItem != null)
+                {
+                    video = dbItem;
+                }
+
+                if (video != null)
+                {
+                    SetExtraTypeFromFilename(video);
+                }
+
+                return video;
+
+                // Sort them so that the list can be easily compared for changes
+            }).OrderBy(i => i.Path).ToList();
+        }
+
+        private void SetExtraTypeFromFilename(Video item)
+        {
+            var name = System.IO.Path.GetFileNameWithoutExtension(item.Path) ?? string.Empty;
+
+            foreach (var suffix in BaseItem.ExtraSuffixes)
+            {
+                if (name.EndsWith(suffix.Key, StringComparison.OrdinalIgnoreCase))
+                {
+                    item.ExtraType = suffix.Value;
+                    return;
+                }
+            }
+
+            item.ExtraType = ExtraType.Clip;
+        }
     }
     }
 }
 }

+ 1 - 1
MediaBrowser.Server.Implementations/Library/Validators/ArtistsPostScanTask.cs

@@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         {
         {
-            return _libraryManager.ValidateArtists(cancellationToken, progress);
+            return ((LibraryManager)_libraryManager).ValidateArtists(cancellationToken, progress);
         }
         }
     }
     }
 }
 }

+ 1 - 1
MediaBrowser.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs

@@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         {
         {
-            return _libraryManager.ValidateGameGenres(cancellationToken, progress);
+            return ((LibraryManager)_libraryManager).ValidateGameGenres(cancellationToken, progress);
         }
         }
     }
     }
 }
 }

+ 1 - 1
MediaBrowser.Server.Implementations/Library/Validators/GenresPostScanTask.cs

@@ -29,7 +29,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         {
         {
-            return _libraryManager.ValidateGenres(cancellationToken, progress);
+            return ((LibraryManager)_libraryManager).ValidateGenres(cancellationToken, progress);
         }
         }
     }
     }
 }
 }

+ 1 - 1
MediaBrowser.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs

@@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         {
         {
-            return _libraryManager.ValidateMusicGenres(cancellationToken, progress);
+            return ((LibraryManager)_libraryManager).ValidateMusicGenres(cancellationToken, progress);
         }
         }
     }
     }
 }
 }

+ 1 - 1
MediaBrowser.Server.Implementations/Library/Validators/StudiosPostScanTask.cs

@@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         {
         {
-            return _libraryManager.ValidateStudios(cancellationToken, progress);
+            return ((LibraryManager)_libraryManager).ValidateStudios(cancellationToken, progress);
         }
         }
     }
     }
 }
 }