From 3f24af13427d16f8b5eb4c71af14ec23e51ee0df Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 2 Jun 2017 14:48:31 -0400 Subject: [PATCH 01/30] update nlog --- .../Emby.Common.Implementations.csproj | 2 +- Emby.Common.Implementations/packages.config | 2 +- .../Emby.Server.Implementations.csproj | 3 +++ Emby.Server.Implementations/Properties/AssemblyInfo.cs | 4 +--- MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj | 2 +- MediaBrowser.Server.Mono/packages.config | 2 +- .../MediaBrowser.ServerApplication.csproj | 2 +- MediaBrowser.ServerApplication/packages.config | 2 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 ++-- 10 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Emby.Common.Implementations/Emby.Common.Implementations.csproj b/Emby.Common.Implementations/Emby.Common.Implementations.csproj index bf52ff0c7..567f29526 100644 --- a/Emby.Common.Implementations/Emby.Common.Implementations.csproj +++ b/Emby.Common.Implementations/Emby.Common.Implementations.csproj @@ -32,7 +32,7 @@ - ..\packages\NLog.4.4.9\lib\net45\NLog.dll + ..\packages\NLog.4.4.10\lib\net45\NLog.dll ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll diff --git a/Emby.Common.Implementations/packages.config b/Emby.Common.Implementations/packages.config index ec0fc45bc..9cc054db0 100644 --- a/Emby.Common.Implementations/packages.config +++ b/Emby.Common.Implementations/packages.config @@ -1,6 +1,6 @@  - + diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 14d976325..df70680f1 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -31,6 +31,9 @@ 4 + + Properties\SharedVersion.cs + diff --git a/Emby.Server.Implementations/Properties/AssemblyInfo.cs b/Emby.Server.Implementations/Properties/AssemblyInfo.cs index ed7f9631f..28ffcbac6 100644 --- a/Emby.Server.Implementations/Properties/AssemblyInfo.cs +++ b/Emby.Server.Implementations/Properties/AssemblyInfo.cs @@ -25,6 +25,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index 8199cf2c4..f515f5a68 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -50,7 +50,7 @@ ..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll - ..\packages\NLog.4.4.9\lib\net45\NLog.dll + ..\packages\NLog.4.4.10\lib\net45\NLog.dll ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll diff --git a/MediaBrowser.Server.Mono/packages.config b/MediaBrowser.Server.Mono/packages.config index 0e846ac8f..4f1b09ac8 100644 --- a/MediaBrowser.Server.Mono/packages.config +++ b/MediaBrowser.Server.Mono/packages.config @@ -1,7 +1,7 @@  - + diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 637474380..32b93db00 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -78,7 +78,7 @@ ..\packages\ImageMagickSharp.1.0.0.18\lib\net45\ImageMagickSharp.dll - ..\packages\NLog.4.4.9\lib\net45\NLog.dll + ..\packages\NLog.4.4.10\lib\net45\NLog.dll ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index 4d4bde09f..db675a901 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -1,7 +1,7 @@  - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 23fbb9bc3..0b988ddab 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.701 + 3.0.702 Emby.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 8f59afce3..18128c7b1 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.701 + 3.0.702 Emby.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - + From 2a909caaec468e74d3181f9e94ef9c45b260374d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 2 Jun 2017 15:45:40 -0400 Subject: [PATCH 02/30] ignore qnap folder --- .../Library/CoreResolutionIgnoreRule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 54f9ca392..961f9886c 100644 --- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -38,7 +38,10 @@ namespace Emby.Server.Implementations.Library // Synology "@eaDir", "eaDir", - "#recycle" + "#recycle", + + // Qnap + "@Recycle" }; From acfd90b6ff060cb52c6119453955de7a61f47561 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 3 Jun 2017 01:43:33 -0400 Subject: [PATCH 03/30] update opening of hdhr stream --- .../LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs index 90bbaaf3d..d2e9c8bf0 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs @@ -117,7 +117,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun } else { - await _multicastStream.CopyUntilCancelled(response.Content, () => Resolve(openTaskCompletionSource), cancellationToken).ConfigureAwait(false); + Resolve(openTaskCompletionSource); + + await _multicastStream.CopyUntilCancelled(response.Content, null, cancellationToken).ConfigureAwait(false); } } } From e91f569c154e571f52ea6a86fc3920700c317a56 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 3 Jun 2017 03:36:32 -0400 Subject: [PATCH 04/30] update live tv startup --- .../Channels/ChannelManager.cs | 6 - .../Data/SqliteItemRepository.cs | 72 +-- Emby.Server.Implementations/Dto/DtoService.cs | 5 - .../Library/LibraryManager.cs | 14 +- .../Library/UserViewManager.cs | 11 +- .../LiveTv/EmbyTV/EmbyTV.cs | 5 - .../LiveTv/LiveStreamHelper.cs | 2 +- .../TunerHosts/HdHomerun/HdHomerunHost.cs | 2 + MediaBrowser.Api/ItemUpdateService.cs | 1 - MediaBrowser.Api/Library/LibraryService.cs | 1 - MediaBrowser.Api/Playback/MediaInfoService.cs | 37 +- MediaBrowser.Api/StartupWizardService.cs | 1 - MediaBrowser.Controller/Channels/Channel.cs | 1 - .../Entities/AggregateFolder.cs | 2 +- .../Entities/Audio/Audio.cs | 2 +- .../Entities/Audio/MusicArtist.cs | 4 +- MediaBrowser.Controller/Entities/BaseItem.cs | 121 +--- .../Entities/CollectionFolder.cs | 4 +- MediaBrowser.Controller/Entities/Folder.cs | 26 +- .../Entities/IHasMetadata.cs | 2 +- .../Entities/InternalItemsQuery.cs | 4 - .../Entities/InternalPeopleQuery.cs | 2 - .../Entities/Movies/BoxSet.cs | 2 +- .../Entities/TV/Episode.cs | 574 +++++++++--------- MediaBrowser.Controller/Entities/TV/Season.cs | 2 +- .../Entities/UserRootFolder.cs | 2 +- .../Library/ILibraryManager.cs | 2 + .../LiveTv/LiveTvAudioRecording.cs | 1 - .../LiveTv/LiveTvChannel.cs | 3 +- .../LiveTv/LiveTvProgram.cs | 1 - .../LiveTv/LiveTvVideoRecording.cs | 1 - .../LiveTv/RecordingGroup.cs | 1 - .../MediaEncoding/EncodingHelper.cs | 2 +- MediaBrowser.Controller/Playlists/Playlist.cs | 2 +- .../Parsers/BaseItemXmlParser.cs | 14 - .../Savers/BaseXmlSaver.cs | 5 - .../Configuration/ServerConfiguration.cs | 2 - MediaBrowser.Model/Dto/BaseItemDto.cs | 6 - .../MediaInfo/PlaybackInfoRequest.cs | 1 + MediaBrowser.Model/Querying/ItemFields.cs | 5 - .../Manager/ProviderUtils.cs | 36 +- .../Movies/GenericMovieDbInfo.cs | 2 +- MediaBrowser.Providers/Omdb/OmdbProvider.cs | 4 +- .../TV/TheMovieDb/MovieDbEpisodeProvider.cs | 2 +- .../TV/TheMovieDb/MovieDbSeriesProvider.cs | 2 +- .../TV/TheTVDB/TvdbEpisodeProvider.cs | 2 +- .../TV/TheTVDB/TvdbSeriesProvider.cs | 2 +- .../Parsers/BaseNfoParser.cs | 15 - .../Savers/BaseNfoSaver.cs | 6 - 49 files changed, 446 insertions(+), 576 deletions(-) diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 809771b04..66ec57dba 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -1378,12 +1378,6 @@ namespace Emby.Server.Implementations.Channels item.SetImagePath(ImageType.Primary, info.ImageUrl); } - if (item.SourceType != SourceType.Channel) - { - item.SourceType = SourceType.Channel; - forceUpdate = true; - } - if (isNew) { await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false); diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 49ba6c9f3..df3cecbf9 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -199,10 +199,11 @@ namespace Emby.Server.Implementations.Data AddColumn(db, "TypedBaseItems", "ParentId", "GUID", existingColumnNames); AddColumn(db, "TypedBaseItems", "Genres", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SortName", "Text", existingColumnNames); + AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames); + AddColumn(db, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames); AddColumn(db, "TypedBaseItems", "HomePageUrl", "Text", existingColumnNames); - AddColumn(db, "TypedBaseItems", "VoteCount", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "DisplayMediaType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames); @@ -233,7 +234,6 @@ namespace Emby.Server.Implementations.Data AddColumn(db, "TypedBaseItems", "UnratedType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "TopParentId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsItemByName", "BIT", existingColumnNames); - AddColumn(db, "TypedBaseItems", "SourceType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "CriticRating", "Float", existingColumnNames); AddColumn(db, "TypedBaseItems", "InheritedTags", "Text", existingColumnNames); @@ -424,9 +424,8 @@ namespace Emby.Server.Implementations.Data "OfficialRating", "HomePageUrl", "DisplayMediaType", - "SortName", + "ForcedSortName", "RunTimeTicks", - "VoteCount", "DateCreated", "DateModified", "guid", @@ -439,7 +438,6 @@ namespace Emby.Server.Implementations.Data "LockedFields", "Studios", "Tags", - "SourceType", "TrailerTypes", "OriginalTitle", "PrimaryVersionId", @@ -541,9 +539,9 @@ namespace Emby.Server.Implementations.Data "Genres", "InheritedParentalRatingValue", "SortName", + "ForcedSortName", "RunTimeTicks", "HomePageUrl", - "VoteCount", "DisplayMediaType", "DateCreated", "DateModified", @@ -563,7 +561,6 @@ namespace Emby.Server.Implementations.Data "UnratedType", "TopParentId", "IsItemByName", - "SourceType", "TrailerTypes", "CriticRating", "InheritedTags", @@ -815,10 +812,12 @@ namespace Emby.Server.Implementations.Data saveItemStatement.TryBind("@InheritedParentalRatingValue", item.InheritedParentalRatingValue); saveItemStatement.TryBind("@SortName", item.SortName); + + saveItemStatement.TryBind("@ForcedSortName", item.ForcedSortName); + saveItemStatement.TryBind("@RunTimeTicks", item.RunTimeTicks); saveItemStatement.TryBind("@HomePageUrl", item.HomePageUrl); - saveItemStatement.TryBind("@VoteCount", item.VoteCount); saveItemStatement.TryBind("@DisplayMediaType", item.DisplayMediaType); saveItemStatement.TryBind("@DateCreated", item.DateCreated); saveItemStatement.TryBind("@DateModified", item.DateModified); @@ -909,7 +908,6 @@ namespace Emby.Server.Implementations.Data isByName = dualAccess == null || dualAccess.IsAccessedByName; } saveItemStatement.TryBind("@IsItemByName", isByName); - saveItemStatement.TryBind("@SourceType", item.SourceType.ToString()); var trailer = item as Trailer; if (trailer != null && trailer.TrailerTypes.Count > 0) @@ -1624,7 +1622,7 @@ namespace Emby.Server.Implementations.Data { if (!reader.IsDBNull(index)) { - item.SortName = reader.GetString(index); + item.ForcedSortName = reader.GetString(index); } index++; } @@ -1635,15 +1633,6 @@ namespace Emby.Server.Implementations.Data } index++; - if (HasField(query, ItemFields.VoteCount)) - { - if (!reader.IsDBNull(index)) - { - item.VoteCount = reader.GetInt32(index); - } - index++; - } - if (HasField(query, ItemFields.DateCreated)) { if (!reader.IsDBNull(index)) @@ -1733,12 +1722,6 @@ namespace Emby.Server.Implementations.Data index++; } - if (!reader.IsDBNull(index)) - { - item.SourceType = (SourceType)Enum.Parse(typeof(SourceType), reader.GetString(index), true); - } - index++; - if (hasTrailerTypes) { var trailer = item as Trailer; @@ -2283,7 +2266,7 @@ namespace Emby.Server.Implementations.Data } if (field == ItemFields.SortName) { - return new[] { "SortName" }; + return new[] { "ForcedSortName" }; } if (field == ItemFields.Taglines) { @@ -2306,7 +2289,6 @@ namespace Emby.Server.Implementations.Data case ItemFields.HomePageUrl: case ItemFields.Keywords: case ItemFields.DisplayMediaType: - case ItemFields.VoteCount: case ItemFields.CustomRating: case ItemFields.ProductionLocations: case ItemFields.Settings: @@ -3872,34 +3854,6 @@ namespace Emby.Server.Implementations.Data } } - if (query.SourceTypes.Length == 1) - { - whereClauses.Add("SourceType=@SourceType"); - if (statement != null) - { - statement.TryBind("@SourceType", query.SourceTypes[0].ToString()); - } - } - else if (query.SourceTypes.Length > 1) - { - var inClause = string.Join(",", query.SourceTypes.Select(i => "'" + i + "'").ToArray()); - whereClauses.Add(string.Format("SourceType in ({0})", inClause)); - } - - if (query.ExcludeSourceTypes.Length == 1) - { - whereClauses.Add("SourceType<>@ExcludeSourceTypes"); - if (statement != null) - { - statement.TryBind("@ExcludeSourceTypes", query.ExcludeSourceTypes[0].ToString()); - } - } - else if (query.ExcludeSourceTypes.Length > 1) - { - var inClause = string.Join(",", query.ExcludeSourceTypes.Select(i => "'" + i + "'").ToArray()); - whereClauses.Add(string.Format("SourceType not in ({0})", inClause)); - } - if (query.TrailerTypes.Length > 0) { var clauses = new List(); @@ -5017,14 +4971,6 @@ namespace Emby.Server.Implementations.Data statement.TryBind("@NameContains", "%" + query.NameContains + "%"); } } - if (query.SourceTypes.Length == 1) - { - whereClauses.Add("(select sourcetype from typedbaseitems where guid=ItemId) = @SourceTypes"); - if (statement != null) - { - statement.TryBind("@SourceTypes", query.SourceTypes[0].ToString()); - } - } return whereClauses; } diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 45fbd69dc..58621f8c1 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -1058,11 +1058,6 @@ namespace Emby.Server.Implementations.Dto dto.CommunityRating = item.CommunityRating; } - if (fields.Contains(ItemFields.VoteCount)) - { - dto.VoteCount = item.VoteCount; - } - //if (item.IsFolder) //{ // var folder = (Folder)item; diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 42eda00b7..a08c74474 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -1292,7 +1292,7 @@ namespace Emby.Server.Implementations.Library return item; } - public IEnumerable GetItemList(InternalItemsQuery query) + public IEnumerable GetItemList(InternalItemsQuery query, bool allowExternalContent) { if (query.Recursive && query.ParentId.HasValue) { @@ -1305,12 +1305,17 @@ namespace Emby.Server.Implementations.Library if (query.User != null) { - AddUserToQuery(query, query.User); + AddUserToQuery(query, query.User, allowExternalContent); } return ItemRepository.GetItemList(query); } + public IEnumerable GetItemList(InternalItemsQuery query) + { + return GetItemList(query, true); + } + public int GetCount(InternalItemsQuery query) { if (query.Recursive && query.ParentId.HasValue) @@ -1548,7 +1553,7 @@ namespace Emby.Server.Implementations.Library query.Parent = null; } - private void AddUserToQuery(InternalItemsQuery query, User user) + private void AddUserToQuery(InternalItemsQuery query, User user, bool allowExternalContent = true) { if (query.AncestorIds.Length == 0 && !query.ParentId.HasValue && @@ -1561,7 +1566,8 @@ namespace Emby.Server.Implementations.Library var userViews = _userviewManager().GetUserViews(new UserViewQuery { UserId = user.Id.ToString("N"), - IncludeHidden = true + IncludeHidden = true, + IncludeExternalContent = allowExternalContent }, CancellationToken.None).Result.ToList(); diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs index f403ca266..a6ed84f29 100644 --- a/Emby.Server.Implementations/Library/UserViewManager.cs +++ b/Emby.Server.Implementations/Library/UserViewManager.cs @@ -280,7 +280,7 @@ namespace Emby.Server.Implementations.Library } : new string[] { }; - return _libraryManager.GetItemList(new InternalItemsQuery(user) + var query = new InternalItemsQuery(user) { IncludeItemTypes = includeItemTypes, SortOrder = SortOrder.Descending, @@ -289,11 +289,16 @@ namespace Emby.Server.Implementations.Library ExcludeItemTypes = excludeItemTypes, IsVirtualItem = false, Limit = limit * 5, - SourceTypes = parents.Count == 0 ? new[] { SourceType.Library } : new SourceType[] { }, IsPlayed = isPlayed, DtoOptions = options + }; - }, parents); + if (parents.Count == 0) + { + return _libraryManager.GetItemList(query, false); + } + + return _libraryManager.GetItemList(query, parents); } } } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 6ce2b88f1..a4c5b338e 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -2270,11 +2270,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV writer.WriteElementString("studio", studio); } - if (item.VoteCount.HasValue) - { - writer.WriteElementString("votes", item.VoteCount.Value.ToString(CultureInfo.InvariantCulture)); - } - writer.WriteEndElement(); writer.WriteEndDocument(); } diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs index d56ddc57d..12da1464b 100644 --- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs +++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs @@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.LiveTv private readonly IMediaEncoder _mediaEncoder; private readonly ILogger _logger; - const int AnalyzeDurationMs = 2000; + const int AnalyzeDurationMs = 1000; public LiveStreamHelper(IMediaEncoder mediaEncoder, ILogger logger) { diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 2afc3744f..153f86aed 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -422,6 +422,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun SupportsTranscoding = true, IsInfiniteStream = true, IgnoreDts = true, + //SupportsProbing = false, + //AnalyzeDurationMs = 2000000 //IgnoreIndex = true, //ReadAtNativeFramerate = true }; diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index cdc33dfd4..58bce3856 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -243,7 +243,6 @@ namespace MediaBrowser.Api item.DisplayMediaType = request.DisplayMediaType; item.CommunityRating = request.CommunityRating; - item.VoteCount = request.VoteCount; item.HomePageUrl = request.HomePageUrl; item.IndexNumber = request.IndexNumber; item.ParentIndexNumber = request.ParentIndexNumber; diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 4e0bdc8a9..4112eb444 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -675,7 +675,6 @@ namespace MediaBrowser.Api.Library Limit = 0, Recursive = true, IsVirtualItem = false, - SourceTypes = new[] { SourceType.Library }, IsFavorite = request.IsFavorite, DtoOptions = new DtoOptions(false) { diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index 55fe738e8..911d92555 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -106,6 +106,13 @@ namespace MediaBrowser.Api.Playback } public async Task Post(OpenMediaSource request) + { + var result = await OpenMediaSource(request).ConfigureAwait(false); + + return ToOptimizedResult(result); + } + + private async Task OpenMediaSource(OpenMediaSource request) { var authInfo = _authContext.GetAuthorizationInfo(Request); @@ -137,7 +144,7 @@ namespace MediaBrowser.Api.Playback } } - return ToOptimizedResult(result); + return result; } public void Post(CloseMediaSource request) @@ -172,6 +179,34 @@ namespace MediaBrowser.Api.Playback SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.ForceDirectPlayRemoteMediaSource, request.EnableDirectStream, request.EnableTranscoding, request.AllowVideoStreamCopy, request.AllowAudioStreamCopy); } + if (request.AutoOpenLiveStream) + { + var mediaSource = string.IsNullOrWhiteSpace(request.MediaSourceId) ? info.MediaSources.FirstOrDefault() : info.MediaSources.FirstOrDefault(i => string.Equals(i.Id, request.MediaSourceId, StringComparison.Ordinal)); + + if (mediaSource != null && mediaSource.RequiresOpening && string.IsNullOrWhiteSpace(mediaSource.LiveStreamId)) + { + var openStreamResult = await OpenMediaSource(new OpenMediaSource + { + AudioStreamIndex = request.AudioStreamIndex, + DeviceProfile = request.DeviceProfile, + EnableDirectPlay = request.EnableDirectPlay, + EnableDirectStream = request.EnableDirectStream, + ForceDirectPlayRemoteMediaSource = request.ForceDirectPlayRemoteMediaSource, + ItemId = request.Id, + MaxAudioChannels = request.MaxAudioChannels, + MaxStreamingBitrate = request.MaxStreamingBitrate, + PlaySessionId = info.PlaySessionId, + StartTimeTicks = request.StartTimeTicks, + SubtitleStreamIndex = request.SubtitleStreamIndex, + UserId = request.UserId, + OpenToken = mediaSource.OpenToken + + }).ConfigureAwait(false); + + info.MediaSources = new List { openStreamResult.MediaSource }; + } + } + return info; } diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index 2df6d225b..cd56b69bd 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -100,7 +100,6 @@ namespace MediaBrowser.Api config.EnableSimpleArtistDetection = true; config.EnableNormalizedItemByNameIds = true; config.DisableLiveTvChannelUserDataName = true; - config.EnableSimpleSortNameHandling = true; } public void Post(UpdateStartupConfiguration request) diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs index 35c2ea1aa..862c8e5ac 100644 --- a/MediaBrowser.Controller/Channels/Channel.cs +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -35,7 +35,6 @@ namespace MediaBrowser.Controller.Channels public override SourceType SourceType { get { return SourceType.Channel; } - set { } } protected override QueryResult GetItemsInternal(InternalItemsQuery query) diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index fe8ac0919..e8ebbdb70 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Entities private List _childrenIds = null; private readonly object _childIdsLock = new object(); - protected override IEnumerable LoadChildren() + protected override List LoadChildren() { lock (_childIdsLock) { diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 4d35531cb..873ac3104 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -131,7 +131,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// Creates the name of the sort. /// /// System.String. - protected override string CreateSortNameInternal() + protected override string CreateSortName() { return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "") + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs index b0b9493a5..4b232de49 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs @@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - protected override IEnumerable ActualChildren + public override IEnumerable Children { get { @@ -99,7 +99,7 @@ namespace MediaBrowser.Controller.Entities.Audio return new List(); } - return base.ActualChildren; + return base.Children; } } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 346442f59..4efea94d8 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -54,7 +54,6 @@ namespace MediaBrowser.Controller.Entities ImageInfos = new List(); InheritedTags = new List(); ProductionLocations = new List(); - SourceType = SourceType.Library; } public static readonly char[] SlugReplaceChars = { '?', '/', '&' }; @@ -187,15 +186,10 @@ namespace MediaBrowser.Controller.Entities } set { - var isSortNameDefault = IsSortNameDefault(SortName); - _name = value; - if (isSortNameDefault) - { - // lazy load this again - SortName = null; - } + // lazy load this again + _sortName = null; } } @@ -279,7 +273,18 @@ namespace MediaBrowser.Controller.Entities public virtual string Path { get; set; } [IgnoreDataMember] - public virtual SourceType SourceType { get; set; } + public virtual SourceType SourceType + { + get + { + if (!string.IsNullOrWhiteSpace(ChannelId)) + { + return SourceType.Channel; + } + + return SourceType.Library; + } + } /// /// Returns the folder containing the item. @@ -586,6 +591,7 @@ namespace MediaBrowser.Controller.Entities } } + private string _forcedSortName; /// /// Gets or sets the name of the forced sort. /// @@ -593,42 +599,8 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public string ForcedSortName { - get - { - var sortName = SortName; - - if (string.IsNullOrWhiteSpace(sortName)) - { - return null; - } - - if (string.Equals(sortName, CreateSortName(), StringComparison.OrdinalIgnoreCase)) - { - return null; - } - - return sortName; - } - set - { - if (string.IsNullOrWhiteSpace(value)) - { - SortName = null; - } - else - { - var newValue = CreateSortNameFromCustomValue(value); - - if (string.Equals(newValue, CreateSortName(), StringComparison.OrdinalIgnoreCase)) - { - SortName = null; - } - else - { - SortName = newValue; - } - } - } + get { return _forcedSortName; } + set { _forcedSortName = value; _sortName = null; } } private string _sortName; @@ -643,7 +615,15 @@ namespace MediaBrowser.Controller.Entities { if (_sortName == null) { - _sortName = CreateSortName(); + if (!string.IsNullOrWhiteSpace(ForcedSortName)) + { + // Need the ToLower because that's what CreateSortName does + _sortName = ModifySortChunks(ForcedSortName).ToLower(); + } + else + { + _sortName = CreateSortName(); + } } return _sortName; } @@ -653,31 +633,6 @@ namespace MediaBrowser.Controller.Entities } } - private string CreateSortNameFromCustomValue(string value) - { - return string.IsNullOrWhiteSpace(value) ? null : NormalizeCustomSortName(value); - } - - protected virtual string NormalizeCustomSortName(string value) - { - if (ConfigurationManager.Configuration.EnableSimpleSortNameHandling) - { - return value.RemoveDiacritics().ToLower(); - } - - return ModifySortChunks(value).ToLower(); - } - - public bool IsSortNameDefault(string value) - { - if (string.IsNullOrWhiteSpace(value)) - { - return true; - } - - return string.Equals(CreateSortNameFromCustomValue(value), CreateSortName(), StringComparison.OrdinalIgnoreCase); - } - public string GetInternalMetadataPath() { var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath; @@ -699,22 +654,14 @@ namespace MediaBrowser.Controller.Entities return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString); } - protected string CreateSortName() - { - if (string.IsNullOrWhiteSpace(Name)) - { - return null; - } - - return CreateSortNameInternal(); - } - /// /// Creates the name of the sort. /// /// System.String. - protected virtual string CreateSortNameInternal() + protected virtual string CreateSortName() { + if (Name == null) return null; //some items may not have name filled in properly + if (!EnableAlphaNumericSorting) { return Name.TrimStart(); @@ -951,13 +898,6 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public float? CommunityRating { get; set; } - /// - /// Gets or sets the community rating vote count. - /// - /// The community rating vote count. - [IgnoreDataMember] - public int? VoteCount { get; set; } - /// /// Gets or sets the run time ticks. /// @@ -1367,6 +1307,7 @@ namespace MediaBrowser.Controller.Entities public void AfterMetadataRefresh() { + _sortName = null; } /// @@ -2253,6 +2194,8 @@ namespace MediaBrowser.Controller.Entities /// public virtual bool BeforeMetadataRefresh() { + _sortName = null; + var hasChanges = false; if (string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Path)) diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 0a5faa727..8bc23a581 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -311,12 +311,12 @@ namespace MediaBrowser.Controller.Entities /// /// The actual children. [IgnoreDataMember] - protected override IEnumerable ActualChildren + public override IEnumerable Children { get { return GetActualChildren(); } } - private IEnumerable GetActualChildren() + public IEnumerable GetActualChildren() { return GetPhysicalFolders(true).SelectMany(c => c.Children); } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 7566911a1..48c9b83aa 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -185,7 +185,7 @@ namespace MediaBrowser.Controller.Entities item.Id = LibraryManager.GetNewItemId(item.Path, item.GetType()); } - if (ActualChildren.Any(i => i.Id == item.Id)) + if (Children.Any(i => i.Id == item.Id)) { throw new ArgumentException(string.Format("A child with the Id {0} already exists.", item.Id)); } @@ -243,7 +243,7 @@ namespace MediaBrowser.Controller.Entities /// /// The actual children. [IgnoreDataMember] - protected virtual IEnumerable ActualChildren + public virtual IEnumerable Children { get { @@ -251,16 +251,6 @@ namespace MediaBrowser.Controller.Entities } } - /// - /// thread-safe access to the actual children of this folder - without regard to user - /// - /// The children. - [IgnoreDataMember] - public IEnumerable Children - { - get { return ActualChildren.ToList(); } - } - /// /// thread-safe access to all recursive children of this folder - without regard to user /// @@ -301,7 +291,7 @@ namespace MediaBrowser.Controller.Entities /// Loads our children. Validation will occur externally. /// We want this sychronous. /// - protected virtual IEnumerable LoadChildren() + protected virtual List LoadChildren() { //Logger.Debug("Loading children from {0} {1} {2}", GetType().Name, Id, Path); //just load our children from the repo - the library will be validated and maintained in other processes @@ -330,7 +320,9 @@ namespace MediaBrowser.Controller.Entities { var dictionary = new Dictionary(); - foreach (var child in ActualChildren) + var childrenList = Children.ToList(); + + foreach (var child in childrenList) { var id = child.Id; if (dictionary.ContainsKey(id)) @@ -466,7 +458,7 @@ namespace MediaBrowser.Controller.Entities if (recursive) { - await ValidateSubFolders(ActualChildren.OfType().ToList(), directoryService, progress, cancellationToken).ConfigureAwait(false); + await ValidateSubFolders(Children.ToList().OfType().ToList(), directoryService, progress, cancellationToken).ConfigureAwait(false); } progress.Report(20); @@ -494,7 +486,7 @@ namespace MediaBrowser.Controller.Entities private async Task RefreshMetadataRecursive(MetadataRefreshOptions refreshOptions, bool recursive, IProgress progress, CancellationToken cancellationToken) { - var children = ActualChildren.ToList(); + var children = Children.ToList(); var percentages = new Dictionary(children.Count); var numComplete = 0; @@ -668,7 +660,7 @@ namespace MediaBrowser.Controller.Entities /// Get our children from the repo - stubbed for now /// /// IEnumerable{BaseItem}. - protected IEnumerable GetCachedChildren() + protected List GetCachedChildren() { return ItemRepository.GetItemList(new InternalItemsQuery { diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs index aee58b445..62c67336c 100644 --- a/MediaBrowser.Controller/Entities/IHasMetadata.cs +++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs @@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.Entities /// The date last saved. DateTime DateLastSaved { get; set; } - SourceType SourceType { get; set; } + SourceType SourceType { get; } /// /// Gets or sets the date last refreshed. diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index 743e7642e..f3caac492 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -148,8 +148,6 @@ namespace MediaBrowser.Controller.Entities } public string[] PresetViews { get; set; } - public SourceType[] SourceTypes { get; set; } - public SourceType[] ExcludeSourceTypes { get; set; } public TrailerType[] TrailerTypes { get; set; } public DayOfWeek[] AirDays { get; set; } @@ -215,8 +213,6 @@ namespace MediaBrowser.Controller.Entities ExcludeTags = new string[] { }; ExcludeInheritedTags = new string[] { }; PresetViews = new string[] { }; - SourceTypes = new SourceType[] { }; - ExcludeSourceTypes = new SourceType[] { }; TrailerTypes = new TrailerType[] { }; AirDays = new DayOfWeek[] { }; SeriesStatuses = new SeriesStatus[] { }; diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs index 2ba6842ca..05d23d986 100644 --- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs @@ -11,13 +11,11 @@ namespace MediaBrowser.Controller.Entities public int? MaxListOrder { get; set; } public Guid AppearsInItemId { get; set; } public string NameContains { get; set; } - public SourceType[] SourceTypes { get; set; } public InternalPeopleQuery() { PersonTypes = new List(); ExcludePersonTypes = new List(); - SourceTypes = new SourceType[] { }; } } } diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index efa85f3ae..406a99f8b 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Entities.Movies return new List(); } - protected override IEnumerable LoadChildren() + protected override List LoadChildren() { if (IsLegacyBoxSet) { diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index e963ab184..45b4de1b3 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -1,19 +1,19 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Serialization; - -namespace MediaBrowser.Controller.Entities.TV -{ - /// - /// Class Episode - /// - public class Episode : Video, IHasTrailers, IHasLookupInfo, IHasSeries +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; + +namespace MediaBrowser.Controller.Entities.TV +{ + /// + /// Class Episode + /// + public class Episode : Video, IHasTrailers, IHasLookupInfo, IHasSeries { public Episode() { @@ -26,35 +26,35 @@ namespace MediaBrowser.Controller.Entities.TV public List RemoteTrailerIds { get; set; } public List RemoteTrailers { get; set; } - /// - /// Gets the season in which it aired. - /// - /// The aired season. - public int? AirsBeforeSeasonNumber { get; set; } - public int? AirsAfterSeasonNumber { get; set; } - public int? AirsBeforeEpisodeNumber { get; set; } - - /// - /// Gets or sets the DVD season number. - /// - /// The DVD season number. - public int? DvdSeasonNumber { get; set; } - /// - /// Gets or sets the DVD episode number. - /// - /// The DVD episode number. - public float? DvdEpisodeNumber { get; set; } - - /// - /// Gets or sets the absolute episode number. - /// - /// The absolute episode number. - public int? AbsoluteEpisodeNumber { get; set; } - - /// - /// This is the ending episode number for double episodes. - /// - /// The index number. + /// + /// Gets the season in which it aired. + /// + /// The aired season. + public int? AirsBeforeSeasonNumber { get; set; } + public int? AirsAfterSeasonNumber { get; set; } + public int? AirsBeforeEpisodeNumber { get; set; } + + /// + /// Gets or sets the DVD season number. + /// + /// The DVD season number. + public int? DvdSeasonNumber { get; set; } + /// + /// Gets or sets the DVD episode number. + /// + /// The DVD episode number. + public float? DvdEpisodeNumber { get; set; } + + /// + /// Gets or sets the absolute episode number. + /// + /// The absolute episode number. + public int? AbsoluteEpisodeNumber { get; set; } + + /// + /// This is the ending episode number for double episodes. + /// + /// The index number. public int? IndexNumberEnd { get; set; } public string FindSeriesSortName() @@ -62,56 +62,56 @@ namespace MediaBrowser.Controller.Entities.TV var series = Series; return series == null ? SeriesName : series.SortName; } - - [IgnoreDataMember] - protected override bool SupportsOwnedItems - { - get - { - return IsStacked || MediaSourceCount > 1; - } + + [IgnoreDataMember] + protected override bool SupportsOwnedItems + { + get + { + return IsStacked || MediaSourceCount > 1; + } } [IgnoreDataMember] public override bool SupportsInheritedParentImages { get { return true; } - } - - [IgnoreDataMember] - public int? AiredSeasonNumber - { - get - { - return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber; - } - } - - [IgnoreDataMember] - public override Folder LatestItemsIndexContainer - { - get - { - return Series; - } - } - - [IgnoreDataMember] - public override Guid? DisplayParentId - { - get - { - return SeasonId; - } - } - - [IgnoreDataMember] - protected override bool EnableDefaultVideoUserDataKeys - { - get - { - return false; - } + } + + [IgnoreDataMember] + public int? AiredSeasonNumber + { + get + { + return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber; + } + } + + [IgnoreDataMember] + public override Folder LatestItemsIndexContainer + { + get + { + return Series; + } + } + + [IgnoreDataMember] + public override Guid? DisplayParentId + { + get + { + return SeasonId; + } + } + + [IgnoreDataMember] + protected override bool EnableDefaultVideoUserDataKeys + { + get + { + return false; + } } public override double? GetDefaultPrimaryImageAspectRatio() @@ -120,64 +120,64 @@ namespace MediaBrowser.Controller.Entities.TV value /= 9; return value; - } - - public override List GetUserDataKeys() - { - var list = base.GetUserDataKeys(); - - var series = Series; - if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue) - { - var seriesUserDataKeys = series.GetUserDataKeys(); - var take = seriesUserDataKeys.Count; - if (seriesUserDataKeys.Count > 1) - { - take--; - } - list.InsertRange(0, seriesUserDataKeys.Take(take).Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000"))); - } - - return list; - } - - /// - /// This Episode's Series Instance - /// - /// The series. - [IgnoreDataMember] - public Series Series - { - get - { + } + + public override List GetUserDataKeys() + { + var list = base.GetUserDataKeys(); + + var series = Series; + if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue) + { + var seriesUserDataKeys = series.GetUserDataKeys(); + var take = seriesUserDataKeys.Count; + if (seriesUserDataKeys.Count > 1) + { + take--; + } + list.InsertRange(0, seriesUserDataKeys.Take(take).Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000"))); + } + + return list; + } + + /// + /// This Episode's Series Instance + /// + /// The series. + [IgnoreDataMember] + public Series Series + { + get + { var seriesId = SeriesId ?? FindSeriesId(); - return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null; - } - } - - [IgnoreDataMember] - public Season Season - { - get - { + return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null; + } + } + + [IgnoreDataMember] + public Season Season + { + get + { var seasonId = SeasonId ?? FindSeasonId(); - return seasonId.HasValue ? (LibraryManager.GetItemById(seasonId.Value) as Season) : null; - } - } - - [IgnoreDataMember] - public bool IsInSeasonFolder - { - get - { - return FindParent() != null; - } + return seasonId.HasValue ? (LibraryManager.GetItemById(seasonId.Value) as Season) : null; + } + } + + [IgnoreDataMember] + public bool IsInSeasonFolder + { + get + { + return FindParent() != null; + } } [IgnoreDataMember] public string SeriesPresentationUniqueKey { get; set; } - - [IgnoreDataMember] + + [IgnoreDataMember] public string SeriesName { get; set; } [IgnoreDataMember] @@ -187,17 +187,17 @@ namespace MediaBrowser.Controller.Entities.TV { var series = Series; return series == null ? null : series.PresentationUniqueKey; - } - - public string FindSeasonName() + } + + public string FindSeasonName() { - var season = Season; - - if (season == null) - { - if (ParentIndexNumber.HasValue) - { - return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture); + var season = Season; + + if (season == null) + { + if (ParentIndexNumber.HasValue) + { + return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture); } return "Season Unknown"; } @@ -231,92 +231,92 @@ namespace MediaBrowser.Controller.Entities.TV } return season == null ? (Guid?)null : season.Id; - } - - /// - /// Creates the name of the sort. - /// - /// System.String. - protected override string CreateSortNameInternal() - { - return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "") - + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; - } - - /// - /// Determines whether [contains episode number] [the specified number]. - /// - /// The number. - /// true if [contains episode number] [the specified number]; otherwise, false. - public bool ContainsEpisodeNumber(int number) - { - if (IndexNumber.HasValue) - { - if (IndexNumberEnd.HasValue) - { - return number >= IndexNumber.Value && number <= IndexNumberEnd.Value; - } - - return IndexNumber.Value == number; - } - - return false; - } - - [IgnoreDataMember] - public override bool SupportsRemoteImageDownloading - { - get - { - if (IsMissingEpisode) - { - return false; - } - - return true; - } - } - - [IgnoreDataMember] - public bool IsMissingEpisode - { - get - { - return LocationType == LocationType.Virtual && !IsUnaired; - } - } - - [IgnoreDataMember] - public bool IsVirtualUnaired - { - get { return LocationType == LocationType.Virtual && IsUnaired; } - } - - [IgnoreDataMember] + } + + /// + /// Creates the name of the sort. + /// + /// System.String. + protected override string CreateSortName() + { + return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "") + + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; + } + + /// + /// Determines whether [contains episode number] [the specified number]. + /// + /// The number. + /// true if [contains episode number] [the specified number]; otherwise, false. + public bool ContainsEpisodeNumber(int number) + { + if (IndexNumber.HasValue) + { + if (IndexNumberEnd.HasValue) + { + return number >= IndexNumber.Value && number <= IndexNumberEnd.Value; + } + + return IndexNumber.Value == number; + } + + return false; + } + + [IgnoreDataMember] + public override bool SupportsRemoteImageDownloading + { + get + { + if (IsMissingEpisode) + { + return false; + } + + return true; + } + } + + [IgnoreDataMember] + public bool IsMissingEpisode + { + get + { + return LocationType == LocationType.Virtual && !IsUnaired; + } + } + + [IgnoreDataMember] + public bool IsVirtualUnaired + { + get { return LocationType == LocationType.Virtual && IsUnaired; } + } + + [IgnoreDataMember] public Guid? SeasonId { get; set; } [IgnoreDataMember] public Guid? SeriesId { get; set; } public Guid? FindSeriesId() { - var series = FindParent(); + var series = FindParent(); return series == null ? (Guid?)null : series.Id; - } - - public override IEnumerable GetAncestorIds() - { - var list = base.GetAncestorIds().ToList(); - - var seasonId = SeasonId; - - if (seasonId.HasValue && !list.Contains(seasonId.Value)) - { - list.Add(seasonId.Value); - } - - return list; - } - + } + + public override IEnumerable GetAncestorIds() + { + var list = base.GetAncestorIds().ToList(); + + var seasonId = SeasonId; + + if (seasonId.HasValue && !list.Contains(seasonId.Value)) + { + list.Add(seasonId.Value); + } + + return list; + } + public override IEnumerable GetDeletePaths() { return new[] { @@ -327,60 +327,60 @@ namespace MediaBrowser.Controller.Entities.TV } }.Concat(GetLocalMetadataFilesToDelete()); } - - public override UnratedItem GetBlockUnratedType() - { - return UnratedItem.Series; - } - - public EpisodeInfo GetLookupInfo() - { - var id = GetItemLookupInfo(); - - var series = Series; - - if (series != null) - { - id.SeriesProviderIds = series.ProviderIds; - } - - id.IsMissingEpisode = IsMissingEpisode; - id.IndexNumberEnd = IndexNumberEnd; - id.IsVirtualUnaired = IsVirtualUnaired; - - return id; - } - - public override bool BeforeMetadataRefresh() - { - var hasChanges = base.BeforeMetadataRefresh(); - - try - { - if (LibraryManager.FillMissingEpisodeNumbersFromPath(this)) - { - hasChanges = true; - } - } - catch (Exception ex) - { - Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString()); - } - - if (!ParentIndexNumber.HasValue) - { - var season = Season; - if (season != null) - { - if (season.ParentIndexNumber.HasValue) - { - ParentIndexNumber = season.ParentIndexNumber; - hasChanges = true; - } - } - } - - return hasChanges; - } - } -} + + public override UnratedItem GetBlockUnratedType() + { + return UnratedItem.Series; + } + + public EpisodeInfo GetLookupInfo() + { + var id = GetItemLookupInfo(); + + var series = Series; + + if (series != null) + { + id.SeriesProviderIds = series.ProviderIds; + } + + id.IsMissingEpisode = IsMissingEpisode; + id.IndexNumberEnd = IndexNumberEnd; + id.IsVirtualUnaired = IsVirtualUnaired; + + return id; + } + + public override bool BeforeMetadataRefresh() + { + var hasChanges = base.BeforeMetadataRefresh(); + + try + { + if (LibraryManager.FillMissingEpisodeNumbersFromPath(this)) + { + hasChanges = true; + } + } + catch (Exception ex) + { + Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString()); + } + + if (!ParentIndexNumber.HasValue) + { + var season = Season; + if (season != null) + { + if (season.ParentIndexNumber.HasValue) + { + ParentIndexNumber = season.ParentIndexNumber; + hasChanges = true; + } + } + } + + return hasChanges; + } + } +} diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 4ccf6d623..17494eb08 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -145,7 +145,7 @@ namespace MediaBrowser.Controller.Entities.TV /// Creates the name of the sort. /// /// System.String. - protected override string CreateSortNameInternal() + protected override string CreateSortName() { return IndexNumber != null ? IndexNumber.Value.ToString("0000") : Name; } diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs index c93c81401..3e4931e77 100644 --- a/MediaBrowser.Controller/Entities/UserRootFolder.cs +++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Entities { private List _childrenIds = null; private readonly object _childIdsLock = new object(); - protected override IEnumerable LoadChildren() + protected override List LoadChildren() { lock (_childIdsLock) { diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 3f6b5a806..5a702b4f0 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -527,6 +527,8 @@ namespace MediaBrowser.Controller.Library /// QueryResult<BaseItem>. IEnumerable GetItemList(InternalItemsQuery query); + IEnumerable GetItemList(InternalItemsQuery query, bool allowExternalContent); + /// /// Gets the items. /// diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs index 8501f1580..45786e795 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs @@ -43,7 +43,6 @@ namespace MediaBrowser.Controller.LiveTv public override SourceType SourceType { get { return SourceType.LiveTV; } - set { } } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index 34a9103f8..898ea9ff4 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -55,7 +55,6 @@ namespace MediaBrowser.Controller.LiveTv public override SourceType SourceType { get { return SourceType.LiveTV; } - set { } } [IgnoreDataMember] @@ -89,7 +88,7 @@ namespace MediaBrowser.Controller.LiveTv } } - protected override string CreateSortNameInternal() + protected override string CreateSortName() { if (!string.IsNullOrEmpty(Number)) { diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 5919d87fd..665640dfd 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -65,7 +65,6 @@ namespace MediaBrowser.Controller.LiveTv public override SourceType SourceType { get { return SourceType.LiveTV; } - set { } } /// diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs index 18894120a..2b527c4b0 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs @@ -42,7 +42,6 @@ namespace MediaBrowser.Controller.LiveTv public override SourceType SourceType { get { return SourceType.LiveTV; } - set { } } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/LiveTv/RecordingGroup.cs b/MediaBrowser.Controller/LiveTv/RecordingGroup.cs index 8093b5a76..b54ca8974 100644 --- a/MediaBrowser.Controller/LiveTv/RecordingGroup.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingGroup.cs @@ -30,7 +30,6 @@ namespace MediaBrowser.Controller.LiveTv public override SourceType SourceType { get { return SourceType.LiveTV; } - set { } } } } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 54a361ff7..82d18a373 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1604,7 +1604,7 @@ namespace MediaBrowser.Controller.MediaEncoding } // Only do this for video files due to sometimes unpredictable codec names coming from BDInfo - if (state.RunTimeTicks.HasValue && state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) + if (state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) { foreach (var stream in state.MediaSource.MediaStreams) { diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs index 790e8e824..854f8d7a2 100644 --- a/MediaBrowser.Controller/Playlists/Playlist.cs +++ b/MediaBrowser.Controller/Playlists/Playlist.cs @@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Playlists return true; } - protected override IEnumerable LoadChildren() + protected override List LoadChildren() { // Save a trip to the database return new List(); diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs index 53327deca..2edccf8c8 100644 --- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs @@ -598,20 +598,6 @@ namespace MediaBrowser.LocalMetadata.Parsers break; } - case "VoteCount": - { - var val = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(val)) - { - int num; - - if (int.TryParse(val, NumberStyles.Integer, _usCulture, out num)) - { - item.VoteCount = num; - } - } - break; - } case "CollectionNumber": var tmdbCollection = reader.ReadElementContentAsString(); if (!string.IsNullOrWhiteSpace(tmdbCollection)) diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index dab637a34..4eec33003 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -109,7 +109,6 @@ namespace MediaBrowser.LocalMetadata.Savers "TvDbId", "Type", "TVRageId", - "VoteCount", "Website", "Zap2ItId", "CollectionItems", @@ -407,10 +406,6 @@ namespace MediaBrowser.LocalMetadata.Savers { writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(UsCulture)); } - if (item.VoteCount.HasValue) - { - writer.WriteElementString("VoteCount", item.VoteCount.Value.ToString(UsCulture)); - } if (item.ProductionYear.HasValue && !(item is Person)) { diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index e30364de9..4529de59a 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -17,8 +17,6 @@ namespace MediaBrowser.Model.Configuration /// true if [enable u pn p]; otherwise, false. public bool EnableUPnP { get; set; } - public bool EnableSimpleSortNameHandling { get; set; } - /// /// Gets or sets the public mapped port. /// diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index d44659705..f53e3ae65 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -221,12 +221,6 @@ namespace MediaBrowser.Model.Dto /// The community rating. public float? CommunityRating { get; set; } - /// - /// Gets or sets the vote count. - /// - /// The vote count. - public int? VoteCount { get; set; } - /// /// Gets or sets the cumulative run time ticks. /// diff --git a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs index 0518064c9..1843fb69a 100644 --- a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs +++ b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs @@ -30,6 +30,7 @@ namespace MediaBrowser.Model.MediaInfo public bool ForceDirectPlayRemoteMediaSource { get; set; } public bool AllowVideoStreamCopy { get; set; } public bool AllowAudioStreamCopy { get; set; } + public bool AutoOpenLiveStream { get; set; } public PlaybackInfoRequest() { diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 9a7052089..85d0a0baf 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -206,11 +206,6 @@ /// Tags, - /// - /// The vote count - /// - VoteCount, - /// /// The trailer url of the item /// diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs index 1e107d0be..042b7241b 100644 --- a/MediaBrowser.Providers/Manager/ProviderUtils.cs +++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs @@ -180,11 +180,6 @@ namespace MediaBrowser.Providers.Manager } } - if (replaceData || !target.VoteCount.HasValue) - { - target.VoteCount = source.VoteCount; - } - foreach (var id in source.ProviderIds) { var key = id.Key; @@ -200,6 +195,32 @@ namespace MediaBrowser.Providers.Manager MergeCriticRating(source, target, lockedFields, replaceData); MergeTrailers(source, target, lockedFields, replaceData); MergeVideoInfo(source, target, lockedFields, replaceData); + MergeDisplayOrder(source, target, lockedFields, replaceData); + + //if (!lockedFields.Contains(MetadataFields.SortName)) + { + if (replaceData || string.IsNullOrEmpty(target.ForcedSortName)) + { + var forcedSortName = source.ForcedSortName; + + if (!string.IsNullOrWhiteSpace(forcedSortName)) + { + target.ForcedSortName = forcedSortName; + } + } + } + + //if (!lockedFields.Contains(MetadataFields.DisplayMediaType)) + { + if (replaceData || string.IsNullOrEmpty(target.DisplayMediaType)) + { + // Safeguard against incoming data having an emtpy name + if (!string.IsNullOrWhiteSpace(source.DisplayMediaType)) + { + target.DisplayMediaType = source.DisplayMediaType; + } + } + } if (mergeMetadataSettings) { @@ -235,10 +256,8 @@ namespace MediaBrowser.Providers.Manager public static void MergeMetadataSettings(BaseItem source, BaseItem target) { - target.ForcedSortName = source.ForcedSortName; target.LockedFields = source.LockedFields; target.IsLocked = source.IsLocked; - target.DisplayMediaType = source.DisplayMediaType; // Grab the value if it's there, but if not then don't overwrite the default if (source.DateCreated != default(DateTime)) @@ -248,7 +267,10 @@ namespace MediaBrowser.Providers.Manager target.PreferredMetadataCountryCode = source.PreferredMetadataCountryCode; target.PreferredMetadataLanguage = source.PreferredMetadataLanguage; + } + private static void MergeDisplayOrder(BaseItem source, BaseItem target, List lockedFields, bool replaceData) + { var sourceHasDisplayOrder = source as IHasDisplayOrder; var targetHasDisplayOrder = target as IHasDisplayOrder; diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs index 6a1af9272..b40e4a120 100644 --- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs +++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs @@ -173,7 +173,7 @@ namespace MediaBrowser.Providers.Movies movie.CommunityRating = rating; } - movie.VoteCount = movieData.vote_count; + //movie.VoteCount = movieData.vote_count; //release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match if (movieData.releases != null && movieData.releases.countries != null) diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index 41ff71070..0a95b449c 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -78,7 +78,7 @@ namespace MediaBrowser.Providers.Omdb && int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount) && voteCount >= 0) { - item.VoteCount = voteCount; + //item.VoteCount = voteCount; } float imdbRating; @@ -185,7 +185,7 @@ namespace MediaBrowser.Providers.Omdb && int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount) && voteCount >= 0) { - item.VoteCount = voteCount; + //item.VoteCount = voteCount; } float imdbRating; diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs index 1938f7ff0..2e549f610 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs @@ -122,7 +122,7 @@ namespace MediaBrowser.Providers.TV item.Overview = response.overview; item.CommunityRating = (float)response.vote_average; - item.VoteCount = response.vote_count; + //item.VoteCount = response.vote_count; if (response.videos != null && response.videos.results != null) { diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs index fe3d7d78c..0b5708b56 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs @@ -217,7 +217,7 @@ namespace MediaBrowser.Providers.TV series.Name = seriesInfo.name; series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.id.ToString(_usCulture)); - series.VoteCount = seriesInfo.vote_count; + //series.VoteCount = seriesInfo.vote_count; string voteAvg = seriesInfo.vote_average.ToString(CultureInfo.InvariantCulture); float rating; diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs index 686bacfe1..d823de786 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs @@ -680,7 +680,7 @@ namespace MediaBrowser.Providers.TV // int.TryParse is local aware, so it can be probamatic, force us culture if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval)) { - item.VoteCount = rval; + //item.VoteCount = rval; } } diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs index 4c5e57a94..8a10affb9 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs @@ -1150,7 +1150,7 @@ namespace MediaBrowser.Providers.TV // int.TryParse is local aware, so it can be probamatic, force us culture if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval)) { - item.VoteCount = rval; + //item.VoteCount = rval; } } diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index c9ec195d9..d424cc0ca 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -704,21 +704,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers break; } - case "votes": - { - var val = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(val)) - { - int num; - - if (int.TryParse(val, NumberStyles.Integer, _usCulture, out num)) - { - item.VoteCount = num; - } - } - break; - } - case "genre": { var val = reader.ReadElementContentAsString(); diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index a5955e14d..cf7c25584 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -63,7 +63,6 @@ namespace MediaBrowser.XbmcMetadata.Savers "releasedate", "outline", "id", - "votes", "credits", "originaltitle", "watched", @@ -659,11 +658,6 @@ namespace MediaBrowser.XbmcMetadata.Savers } } - if (item.VoteCount.HasValue) - { - writer.WriteElementString("votes", item.VoteCount.Value.ToString(UsCulture)); - } - // Use original runtime here, actual file runtime later in MediaInfo var runTimeTicks = item.RunTimeTicks; From 7fbea5d96d9df7b5e487c534ad5c37d54d2105ea Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 3 Jun 2017 03:37:02 -0400 Subject: [PATCH 05/30] 3.2.19.2 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index f3992d52c..9f7672998 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.18.3")] +[assembly: AssemblyVersion("3.2.19.2")] From 5b6356e7795cfeadcb86ba731658733b494a9e8b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 4 Jun 2017 14:31:40 -0400 Subject: [PATCH 06/30] remove ImageMagick from Windows --- .../Emby.Common.Implementations.csproj | 5 +- Emby.Common.Implementations/packages.config | 2 +- Emby.Dlna/Profiles/DefaultProfile.cs | 2 +- Emby.Drawing.Skia/SkiaEncoder.cs | 15 +- Emby.Server.Core/Emby.Server.Core.csproj | 5 +- Emby.Server.Core/packages.config | 2 +- .../Library/UserManager.cs | 3 +- .../MediaBrowser.Server.Mono.csproj | 5 +- MediaBrowser.Server.Mono/packages.config | 2 +- .../ImageEncoderHelper.cs | 9 - .../MediaBrowser.ServerApplication.csproj | 878 +----------------- .../packages.config | 2 +- 12 files changed, 18 insertions(+), 912 deletions(-) diff --git a/Emby.Common.Implementations/Emby.Common.Implementations.csproj b/Emby.Common.Implementations/Emby.Common.Implementations.csproj index 567f29526..50d0d05ec 100644 --- a/Emby.Common.Implementations/Emby.Common.Implementations.csproj +++ b/Emby.Common.Implementations/Emby.Common.Implementations.csproj @@ -42,9 +42,8 @@ ..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll True - - ..\packages\SimpleInjector.4.0.7\lib\net45\SimpleInjector.dll - True + + ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll diff --git a/Emby.Common.Implementations/packages.config b/Emby.Common.Implementations/packages.config index 9cc054db0..1e6b10c01 100644 --- a/Emby.Common.Implementations/packages.config +++ b/Emby.Common.Implementations/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/DefaultProfile.cs b/Emby.Dlna/Profiles/DefaultProfile.cs index 70d08f9a9..06ce93640 100644 --- a/Emby.Dlna/Profiles/DefaultProfile.cs +++ b/Emby.Dlna/Profiles/DefaultProfile.cs @@ -70,7 +70,7 @@ namespace Emby.Dlna.Profiles new DirectPlayProfile { - Container = "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus,flac", + Container = "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus,flac,m4a", Type = DlnaProfileType.Audio } }; diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs index 222ecf733..8a38b9248 100644 --- a/Emby.Drawing.Skia/SkiaEncoder.cs +++ b/Emby.Drawing.Skia/SkiaEncoder.cs @@ -126,11 +126,11 @@ namespace Emby.Drawing.Skia for (int row = 0; row < bitmap.Height; ++row) { if (IsAllWhiteRow(bitmap, row)) - topmost = row; + topmost = row + 1; else break; } - int bottommost = 0; + int bottommost = bitmap.Height; for (int row = bitmap.Height - 1; row >= 0; --row) { if (IsAllWhiteRow(bitmap, row)) @@ -138,11 +138,11 @@ namespace Emby.Drawing.Skia else break; } - int leftmost = 0, rightmost = 0; + int leftmost = 0, rightmost = bitmap.Width; for (int col = 0; col < bitmap.Width; ++col) { if (IsAllWhiteColumn(bitmap, col)) - leftmost = col; + leftmost = col + 1; else break; } @@ -162,13 +162,6 @@ namespace Emby.Drawing.Skia using (var subset = image.Subset(newRect)) { return SKBitmap.FromImage(subset); - //using (var data = subset.Encode(StripCollageBuilder.GetEncodedFormat(outputPath), 90)) - //{ - // using (var fileStream = _fileSystem.GetFileStream(outputPath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) - // { - // data.AsStream().CopyTo(fileStream); - // } - //} } } } diff --git a/Emby.Server.Core/Emby.Server.Core.csproj b/Emby.Server.Core/Emby.Server.Core.csproj index 01193bb6c..063ef6eb9 100644 --- a/Emby.Server.Core/Emby.Server.Core.csproj +++ b/Emby.Server.Core/Emby.Server.Core.csproj @@ -41,9 +41,8 @@ ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll True - - ..\packages\SimpleInjector.4.0.7\lib\net45\SimpleInjector.dll - True + + ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll diff --git a/Emby.Server.Core/packages.config b/Emby.Server.Core/packages.config index 24e8a26b6..6311b55eb 100644 --- a/Emby.Server.Core/packages.config +++ b/Emby.Server.Core/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index 0b9027291..8e8f8c4dc 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -202,8 +202,7 @@ namespace Emby.Server.Implementations.Library private bool IsValidUsernameCharacter(char i) { - return char.IsLetterOrDigit(i) || char.Equals(i, '-') || char.Equals(i, '_') || char.Equals(i, '\'') || - char.Equals(i, '.'); + return !char.Equals(i, '<') && !char.Equals(i, '>'); } public string MakeValidUsername(string username) diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index f515f5a68..ed5e4d96e 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -60,9 +60,8 @@ ..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll True - - ..\packages\SimpleInjector.4.0.7\lib\net45\SimpleInjector.dll - True + + ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll ..\packages\SQLitePCLRaw.core.1.1.5\lib\net45\SQLitePCLRaw.core.dll diff --git a/MediaBrowser.Server.Mono/packages.config b/MediaBrowser.Server.Mono/packages.config index 4f1b09ac8..85f3d58b0 100644 --- a/MediaBrowser.Server.Mono/packages.config +++ b/MediaBrowser.Server.Mono/packages.config @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs index a6651ea40..56729e74c 100644 --- a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs +++ b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs @@ -30,15 +30,6 @@ namespace MediaBrowser.Server.Startup.Common logger.Error("Error loading Skia. Will revert to ImageMagick."); } - try - { - return new ImageMagickEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem); - } - catch - { - logger.Error("Error loading ImageMagick. Will revert to GDI."); - } - return new NullImageEncoder(); } } diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 32b93db00..14b186b72 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -88,9 +88,8 @@ ..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll True - - ..\packages\SimpleInjector.4.0.7\lib\net45\SimpleInjector.dll - True + + ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll ..\packages\SkiaSharp.1.58.0\lib\net45\SkiaSharp.dll @@ -191,886 +190,13 @@ MediaBrowser.Updater.exe PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - PreserveNewest PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - PreserveNewest diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index db675a901..9abd370f3 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -4,7 +4,7 @@ - + From a39d7e888bf7c0da814427d2db107b8c3eaa9d95 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 4 Jun 2017 16:24:45 -0400 Subject: [PATCH 07/30] move xml providers to plugin --- .../Images/EpisodeLocalImageProvider.cs | 17 +- .../MediaBrowser.LocalMetadata.csproj | 9 - .../Parsers/EpisodeXmlParser.cs | 271 ------------------ .../Parsers/MovieXmlParser.cs | 65 ----- .../Parsers/MusicVideoXmlParser.cs | 51 ---- .../Parsers/SeriesXmlParser.cs | 102 ------- .../Providers/EpisodeXmlProvider.cs | 50 ---- .../Providers/MovieXmlProvider.cs | 62 ---- .../Providers/MusicVideoXmlProvider.cs | 37 --- .../Providers/SeriesXmlProvider.cs | 50 ---- .../Providers/VideoXmlProvider.cs | 37 --- 11 files changed, 1 insertion(+), 750 deletions(-) delete mode 100644 MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs delete mode 100644 MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs delete mode 100644 MediaBrowser.LocalMetadata/Parsers/MusicVideoXmlParser.cs delete mode 100644 MediaBrowser.LocalMetadata/Parsers/SeriesXmlParser.cs delete mode 100644 MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs delete mode 100644 MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs delete mode 100644 MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs delete mode 100644 MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs delete mode 100644 MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs diff --git a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs index fbb6b20f1..033c38420 100644 --- a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs @@ -45,22 +45,7 @@ namespace MediaBrowser.LocalMetadata.Images var nameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(item.Path); - var files = GetFilesFromParentFolder(nameWithoutExtension, parentPathFiles); - - if (files.Count > 0) - { - return files; - } - - var metadataPath = Path.Combine(parentPath, "metadata"); - - if (parentPathFiles.Any(i => string.Equals(i.FullName, metadataPath, StringComparison.OrdinalIgnoreCase))) - { - var filesInMetadataFolder = _fileSystem.GetFiles(metadataPath, BaseItem.SupportedImageExtensions, false, false); - return GetFilesFromParentFolder(nameWithoutExtension, filesInMetadataFolder); - } - - return new List(); + return GetFilesFromParentFolder(nameWithoutExtension, parentPathFiles); } private List GetFilesFromParentFolder(string filenameWithoutExtension, IEnumerable parentPathFiles) diff --git a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj index f7b7fa5f2..9a7371a66 100644 --- a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj +++ b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj @@ -44,24 +44,15 @@ - - - - - - - - - diff --git a/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs deleted file mode 100644 index 6aba137eb..000000000 --- a/MediaBrowser.LocalMetadata/Parsers/EpisodeXmlParser.cs +++ /dev/null @@ -1,271 +0,0 @@ -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Logging; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Threading; -using System.Xml; - -using MediaBrowser.Controller.IO; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Xml; - -namespace MediaBrowser.LocalMetadata.Parsers -{ - /// - /// Class EpisodeXmlParser - /// - public class EpisodeXmlParser : BaseItemXmlParser - { - private List _imagesFound; - private readonly IFileSystem _fileSystem; - - public EpisodeXmlParser(ILogger logger, IFileSystem fileSystem, IProviderManager providerManager, IXmlReaderSettingsFactory xmlSettings) - : base(logger, providerManager, xmlSettings, fileSystem) - { - _fileSystem = fileSystem; - } - - private string _xmlPath; - - public void Fetch(MetadataResult item, - List images, - string metadataFile, - CancellationToken cancellationToken) - { - _imagesFound = images; - _xmlPath = metadataFile; - - Fetch(item, metadataFile, cancellationToken); - } - - private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - - /// - /// Fetches the data from XML node. - /// - /// The reader. - /// The result. - protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult result) - { - var item = result.Item; - - switch (reader.Name) - { - case "Episode": - - //MB generated metadata is within an "Episode" node - using (var subTree = reader.ReadSubtree()) - { - subTree.MoveToContent(); - - // Loop through each element - while (subTree.Read()) - { - if (subTree.NodeType == XmlNodeType.Element) - { - FetchDataFromXmlNode(subTree, result); - } - } - - } - break; - - case "filename": - { - var filename = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(filename)) - { - // Strip off everything but the filename. Some metadata tools like MetaBrowser v1.0 will have an 'episodes' prefix - // even though it's actually using the metadata folder. - filename = Path.GetFileName(filename); - - var parentFolder = _fileSystem.GetDirectoryName(_xmlPath); - filename = Path.Combine(parentFolder, filename); - var file = _fileSystem.GetFileInfo(filename); - - if (file.Exists) - { - _imagesFound.Add(new LocalImageInfo - { - Type = ImageType.Primary, - FileInfo = file - }); - } - } - break; - } - case "SeasonNumber": - { - var number = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(number)) - { - int num; - - if (int.TryParse(number, out num)) - { - item.ParentIndexNumber = num; - } - } - break; - } - - case "EpisodeNumber": - { - var number = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(number)) - { - int num; - - if (int.TryParse(number, out num)) - { - item.IndexNumber = num; - } - } - break; - } - - case "EpisodeNumberEnd": - { - var number = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(number)) - { - int num; - - if (int.TryParse(number, out num)) - { - item.IndexNumberEnd = num; - } - } - break; - } - - case "absolute_number": - { - var val = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(val)) - { - int rval; - - // int.TryParse is local aware, so it can be probamatic, force us culture - if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval)) - { - item.AbsoluteEpisodeNumber = rval; - } - } - - break; - } - case "DVD_episodenumber": - { - var number = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(number)) - { - float num; - - if (float.TryParse(number, NumberStyles.Any, UsCulture, out num)) - { - item.DvdEpisodeNumber = num; - } - } - break; - } - - case "DVD_season": - { - var number = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(number)) - { - float num; - - if (float.TryParse(number, NumberStyles.Any, UsCulture, out num)) - { - item.DvdSeasonNumber = Convert.ToInt32(num); - } - } - break; - } - - case "airsbefore_episode": - { - var val = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(val)) - { - int rval; - - // int.TryParse is local aware, so it can be probamatic, force us culture - if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval)) - { - item.AirsBeforeEpisodeNumber = rval; - } - } - - break; - } - - case "airsafter_season": - { - var val = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(val)) - { - int rval; - - // int.TryParse is local aware, so it can be probamatic, force us culture - if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval)) - { - item.AirsAfterSeasonNumber = rval; - } - } - - break; - } - - case "airsbefore_season": - { - var val = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(val)) - { - int rval; - - // int.TryParse is local aware, so it can be probamatic, force us culture - if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval)) - { - item.AirsBeforeSeasonNumber = rval; - } - } - - break; - } - - case "EpisodeName": - { - var name = reader.ReadElementContentAsString(); - - if (!string.IsNullOrWhiteSpace(name)) - { - item.Name = name; - } - break; - } - - - default: - base.FetchDataFromXmlNode(reader, result); - break; - } - } - } -} diff --git a/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs deleted file mode 100644 index 08c895c43..000000000 --- a/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs +++ /dev/null @@ -1,65 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Logging; -using System.Xml; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Xml; - -namespace MediaBrowser.LocalMetadata.Parsers -{ - /// - /// Class EpisodeXmlParser - /// - public class BaseVideoXmlParser : BaseItemXmlParser - where T : Video - { - /// - /// Fetches the data from XML node. - /// - /// The reader. - /// The result. - protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult result) - { - var item = result.Item; - - switch (reader.Name) - { - case "TmdbCollectionName": - { - var val = reader.ReadElementContentAsString(); - var movie = item as Movie; - - if (!string.IsNullOrWhiteSpace(val) && movie != null) - { - movie.CollectionName = val; - } - - break; - } - - default: - base.FetchDataFromXmlNode(reader, result); - break; - } - } - - public BaseVideoXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem) - { - } - } - - public class MovieXmlParser : BaseVideoXmlParser - { - public MovieXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem) - { - } - } - - public class VideoXmlParser : BaseVideoXmlParser