diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.cs index d3b7cbe41b..eabda673a4 100644 --- a/MediaBrowser.Api/GamesService.cs +++ b/MediaBrowser.Api/GamesService.cs @@ -155,11 +155,11 @@ namespace MediaBrowser.Api var games = items.OfType().ToList(); - summary.ClientInstalledGameCount = games.Count(i => !i.IsInstalledOnClient); + summary.ClientInstalledGameCount = games.Count(i => !i.IsPlaceHolder); summary.GameCount = games.Count; - summary.GameFileExtensions = games.Where(i => !i.IsInstalledOnClient).Select(i => Path.GetExtension(i.Path)) + summary.GameFileExtensions = games.Where(i => !i.IsPlaceHolder).Select(i => Path.GetExtension(i.Path)) .Distinct(StringComparer.OrdinalIgnoreCase) .ToList(); diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 9075bdfc6f..4a5b69704b 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -220,6 +220,12 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "IsInBoxSet", Description = "Optional filter by items that are in boxsets, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool? IsInBoxSet { get; set; } + + [ApiMember(Name = "IsLocked", Description = "Optional filter by items that are locked.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public bool? IsLocked { get; set; } + + [ApiMember(Name = "HasSubtitles", Description = "Optional filter by items that are unidentified by internet metadata providers.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public bool? IsUnidentified { get; set; } } /// @@ -1019,6 +1025,18 @@ namespace MediaBrowser.Api.UserLibrary items = items.Where(i => i.IsPlayed(user) == val); } + if (request.IsUnidentified.HasValue) + { + var val = request.IsUnidentified.Value; + items = items.Where(i => i.IsUnidentified == val); + } + + if (request.IsLocked.HasValue) + { + var val = request.IsLocked.Value; + items = items.Where(i => i.IsLocked == val); + } + if (request.ParentIndexNumber.HasValue) { var filterValue = request.ParentIndexNumber.Value; diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index 1688fac8bd..04b8865c1d 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -48,13 +48,13 @@ Always - + False - ..\packages\SimpleInjector.2.4.1\lib\net45\SimpleInjector.dll + ..\packages\SimpleInjector.2.5.0\lib\net45\SimpleInjector.dll - + False - ..\packages\SimpleInjector.2.4.1\lib\net45\SimpleInjector.Diagnostics.dll + ..\packages\SimpleInjector.2.5.0\lib\net45\SimpleInjector.Diagnostics.dll diff --git a/MediaBrowser.Common.Implementations/packages.config b/MediaBrowser.Common.Implementations/packages.config index e04fecc1d9..38d6be2efe 100644 --- a/MediaBrowser.Common.Implementations/packages.config +++ b/MediaBrowser.Common.Implementations/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index f7f2346a8e..923673bd83 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -229,19 +229,7 @@ namespace MediaBrowser.Controller.Entities } } - [IgnoreDataMember] - public bool IsUnidentified - { - get - { - if (ProviderIds.Any()) - { - return false; - } - - return false; - } - } + public bool IsUnidentified { get; set; } /// /// Gets or sets the locked fields. diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 522bc3a2d7..627f657ab3 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -352,6 +352,26 @@ namespace MediaBrowser.Controller.Entities return dictionary; } + private bool IsValidFromResolver(BaseItem current, BaseItem newItem) + { + var currentAsPlaceHolder = current as ISupportsPlaceHolders; + + if (currentAsPlaceHolder != null) + { + var newHasPlaceHolder = newItem as ISupportsPlaceHolders; + + if (newHasPlaceHolder != null) + { + if (currentAsPlaceHolder.IsPlaceHolder != newHasPlaceHolder.IsPlaceHolder) + { + return false; + } + } + } + + return current.IsInMixedFolder == newItem.IsInMixedFolder; + } + /// /// Validates the children internal. /// @@ -401,7 +421,7 @@ namespace MediaBrowser.Controller.Entities { BaseItem currentChild; - if (currentChildren.TryGetValue(child.Id, out currentChild) && child.IsInMixedFolder == currentChild.IsInMixedFolder) + if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child)) { var currentChildLocationType = currentChild.LocationType; if (currentChildLocationType != LocationType.Remote && diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index e490a59cd0..062bdfa88a 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -7,7 +7,7 @@ using System.Linq; namespace MediaBrowser.Controller.Entities { - public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, IHasPreferredMetadataLanguage, IHasLookupInfo + public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, ISupportsPlaceHolders, IHasPreferredMetadataLanguage, IHasLookupInfo { public List SoundtrackIds { get; set; } @@ -63,10 +63,10 @@ namespace MediaBrowser.Controller.Entities public int? PlayersSupported { get; set; } /// - /// Gets or sets a value indicating whether this instance is installed on client. + /// Gets a value indicating whether this instance is place holder. /// - /// true if this instance is installed on client; otherwise, false. - public bool IsInstalledOnClient { get; set; } + /// true if this instance is place holder; otherwise, false. + public bool IsPlaceHolder { get; set; } /// /// Gets or sets the game system. diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs index 095db08157..91f37135f1 100644 --- a/MediaBrowser.Controller/Entities/IHasMetadata.cs +++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs @@ -49,5 +49,11 @@ namespace MediaBrowser.Controller.Entities /// /// true if XXXX, false otherwise. bool BeforeMetadataRefresh(); + + /// + /// Gets or sets a value indicating whether this instance is unidentified. + /// + /// true if this instance is unidentified; otherwise, false. + bool IsUnidentified { get; set; } } } diff --git a/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs b/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs new file mode 100644 index 0000000000..2507c8ee65 --- /dev/null +++ b/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs @@ -0,0 +1,12 @@ + +namespace MediaBrowser.Controller.Entities +{ + public interface ISupportsPlaceHolders + { + /// + /// Gets a value indicating whether this instance is place holder. + /// + /// true if this instance is place holder; otherwise, false. + bool IsPlaceHolder { get; } + } +} diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index fa85f0edce..e61e958f5e 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Entities /// /// Class Video /// - public class Video : BaseItem, IHasMediaStreams, IHasAspectRatio, IHasTags + public class Video : BaseItem, IHasMediaStreams, IHasAspectRatio, IHasTags, ISupportsPlaceHolders { public bool IsMultiPart { get; set; } @@ -42,6 +42,8 @@ namespace MediaBrowser.Controller.Entities /// true if this instance has subtitles; otherwise, false. public bool HasSubtitles { get; set; } + public bool IsPlaceHolder { get; set; } + /// /// Gets or sets the tags. /// diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 82911117f3..c64e4fa0ca 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -234,9 +234,12 @@ namespace MediaBrowser.Controller.Library { var fullName = child.FullName; - if (EntityResolutionHelper.IsVideoFile(fullName) && GetEpisodeNumberFromFile(fullName, false).HasValue) + if (EntityResolutionHelper.IsVideoFile(fullName) || EntityResolutionHelper.IsVideoPlaceHolder(fullName)) { - return true; + if (GetEpisodeNumberFromFile(fullName, false).HasValue) + { + return true; + } } } } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index c07693b36b..ff446f2ef8 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -105,6 +105,7 @@ + diff --git a/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs b/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs index aadaf54231..9e5d68c489 100644 --- a/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs +++ b/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs @@ -35,7 +35,9 @@ namespace MediaBrowser.Controller.Resolvers // If the path is a file check for a matching extensions if (!args.IsDirectory) { - if (EntityResolutionHelper.IsVideoFile(args.Path)) + var isPlaceHolder = EntityResolutionHelper.IsVideoPlaceHolder(args.Path); + + if (EntityResolutionHelper.IsVideoFile(args.Path) || isPlaceHolder) { var extension = Path.GetExtension(args.Path); @@ -46,7 +48,8 @@ namespace MediaBrowser.Controller.Resolvers { VideoType = type, Path = args.Path, - IsInMixedFolder = true + IsInMixedFolder = true, + IsPlaceHolder = isPlaceHolder }; } } diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs index 42b637140f..0f93e8e8a1 100644 --- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs +++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs @@ -139,6 +139,24 @@ namespace MediaBrowser.Controller.Resolvers return VideoFileExtensionsDictionary.ContainsKey(extension); } + /// + /// Determines whether [is place holder] [the specified path]. + /// + /// The path. + /// true if [is place holder] [the specified path]; otherwise, false. + /// path + public static bool IsVideoPlaceHolder(string path) + { + if (string.IsNullOrEmpty(path)) + { + throw new ArgumentNullException("path"); + } + + var extension = Path.GetExtension(path); + + return string.Equals(extension, ".disc", StringComparison.OrdinalIgnoreCase); + } + /// /// Ensures DateCreated and DateModified have values /// diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 661dc62bb6..9e57f045a5 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -208,6 +208,12 @@ namespace MediaBrowser.Model.Dto /// The players. public int? Players { get; set; } + /// + /// Gets or sets a value indicating whether this instance is place holder. + /// + /// null if [is place holder] contains no value, true if [is place holder]; otherwise, false. + public bool? IsPlaceHolder { get; set; } + /// /// Gets or sets the index number. /// diff --git a/MediaBrowser.Model/Providers/RemoteSearchResult.cs b/MediaBrowser.Model/Providers/RemoteSearchResult.cs index 1222666143..8c9e116d60 100644 --- a/MediaBrowser.Model/Providers/RemoteSearchResult.cs +++ b/MediaBrowser.Model/Providers/RemoteSearchResult.cs @@ -31,6 +31,8 @@ namespace MediaBrowser.Model.Providers public string SearchProviderName { get; set; } + public string GameSystem { get; set; } + public RemoteSearchResult() { ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); diff --git a/MediaBrowser.Providers/Games/GameMetadataService.cs b/MediaBrowser.Providers/Games/GameMetadataService.cs index 1586414ea2..1e184bb063 100644 --- a/MediaBrowser.Providers/Games/GameMetadataService.cs +++ b/MediaBrowser.Providers/Games/GameMetadataService.cs @@ -1,25 +1,19 @@ using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; namespace MediaBrowser.Providers.Games { public class GameMetadataService : MetadataService { - private readonly ILibraryManager _libraryManager; - - public GameMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, ILibraryManager libraryManager) + public GameMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem) { - _libraryManager = libraryManager; } /// @@ -38,6 +32,11 @@ namespace MediaBrowser.Providers.Games { target.GameSystem = source.GameSystem; } + + if (replaceData || !target.PlayersSupported.HasValue) + { + target.PlayersSupported = source.PlayersSupported; + } } } } diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 24f4b3b2f1..2ecc6c9dd8 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -386,6 +386,9 @@ namespace MediaBrowser.Providers.Manager { TIdType id = null; + var unidentifiedCount = 0; + var identifiedCount = 0; + foreach (var provider in providers) { var providerName = provider.GetType().Name; @@ -410,9 +413,11 @@ namespace MediaBrowser.Providers.Manager refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataDownload; + identifiedCount++; } else { + unidentifiedCount++; Logger.Debug("{0} returned no metadata for {1}", providerName, item.Path ?? item.Name); } } @@ -422,11 +427,20 @@ namespace MediaBrowser.Providers.Manager } catch (Exception ex) { + unidentifiedCount++; refreshResult.Status = ProviderRefreshStatus.CompletedWithErrors; refreshResult.ErrorMessage = ex.Message; Logger.ErrorException("Error in {0}", ex, provider.Name); } } + + var isUnidentified = unidentifiedCount > 0 && identifiedCount == 0; + + if (item.IsUnidentified != isUnidentified) + { + item.IsUnidentified = isUnidentified; + refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataImport; + } } private void MergeNewData(TItemType source, TIdType lookupInfo) diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs index bb417536af..55d09b68b7 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs @@ -126,6 +126,11 @@ namespace MediaBrowser.Providers.MediaInfo return _cachedTask; } + if (item.IsPlaceHolder) + { + return _cachedTask; + } + var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager); return prober.ProbeVideo(item, directoryService, cancellationToken); @@ -155,7 +160,7 @@ namespace MediaBrowser.Providers.MediaInfo { var video = item as Video; - if (video != null) + if (video != null && !video.IsPlaceHolder) { var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager); diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs index 68216c6e17..3547584979 100644 --- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs @@ -56,7 +56,7 @@ namespace MediaBrowser.Providers.MediaInfo var video = (Video)item; // No support for this - if (video.VideoType == VideoType.HdDvd) + if (video.VideoType == VideoType.HdDvd || video.IsPlaceHolder) { return Task.FromResult(new DynamicImageResponse { HasImage = false }); } diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 1174f16aea..7bf87875ed 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -970,6 +970,12 @@ namespace MediaBrowser.Server.Implementations.Dto } } + var supportsPlaceHolders = item as ISupportsPlaceHolders; + if (supportsPlaceHolders != null) + { + dto.IsPlaceHolder = supportsPlaceHolders.IsPlaceHolder; + } + // Add audio info var audio = item as Audio; if (audio != null) diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index c5cddf40a0..6e9d803bfb 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -451,7 +451,7 @@ namespace MediaBrowser.Server.Implementations.Library } } - if (options.DeleteFileLocation && (locationType == LocationType.FileSystem || locationType == LocationType.Offline)) + if (options.DeleteFileLocation && locationType != LocationType.Remote && locationType != LocationType.Virtual) { foreach (var path in item.GetDeletePaths().ToList()) { diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs index 7e643cd99f..8711715412 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs @@ -132,6 +132,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio return true; } if (EntityResolutionHelper.IsVideoFile(fullName)) return false; + if (EntityResolutionHelper.IsVideoPlaceHolder(fullName)) return false; } // or a single audio file and no video files diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs index 6f4b7a8a7c..f74865d2c7 100644 --- a/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs +++ b/MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs @@ -84,6 +84,11 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder /// true if [is eligible for chapter image extraction] [the specified video]; otherwise, false. private bool IsEligibleForChapterImageExtraction(Video video) { + if (video.IsPlaceHolder) + { + return false; + } + if (video is Movie) { if (!_config.Configuration.EnableMovieChapterImageExtraction) diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index b9e4fc39ca..e570f18d86 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.334 + 3.0.335 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 0db7f2139b..75b6955848 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.334 + 3.0.335 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 7bcee1e78a..581a821068 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.334 + 3.0.335 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +