From c0e549482500ce4d1f454162175d8c367fcbdf7c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 21 Feb 2017 13:04:18 -0500 Subject: [PATCH 1/3] respect locked fields during media probe --- .../MediaInfo/FFProbeVideoInfo.cs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 1bb715866..2270ad65c 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -348,7 +348,7 @@ namespace MediaBrowser.Providers.MediaInfo { var isFullRefresh = options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh; - if (!video.LockedFields.Contains(MetadataFields.OfficialRating)) + if (!video.IsLocked && !video.LockedFields.Contains(MetadataFields.OfficialRating)) { if (!string.IsNullOrWhiteSpace(data.OfficialRating) || isFullRefresh) { @@ -361,7 +361,7 @@ namespace MediaBrowser.Providers.MediaInfo video.OfficialRatingDescription = data.OfficialRatingDescription; } - if (!video.LockedFields.Contains(MetadataFields.Genres)) + if (!video.IsLocked && !video.LockedFields.Contains(MetadataFields.Genres)) { if (video.Genres.Count == 0 || isFullRefresh) { @@ -374,7 +374,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - if (!video.LockedFields.Contains(MetadataFields.Studios)) + if (!video.IsLocked && !video.LockedFields.Contains(MetadataFields.Studios)) { if (video.Studios.Count == 0 || isFullRefresh) { @@ -415,14 +415,18 @@ namespace MediaBrowser.Providers.MediaInfo video.ParentIndexNumber = data.ParentIndexNumber; } } - if (!string.IsNullOrWhiteSpace(data.Name)) + + if (!video.IsLocked && !video.LockedFields.Contains(MetadataFields.Name)) { - if (string.IsNullOrWhiteSpace(video.Name) || (string.Equals(video.Name, Path.GetFileNameWithoutExtension(video.Path), StringComparison.OrdinalIgnoreCase) && !video.ProviderIds.Any())) + if (!string.IsNullOrWhiteSpace(data.Name)) { - // Don't use the embedded name for extras because it will often be the same name as the movie - if (!video.ExtraType.HasValue && !video.IsOwnedItem) + if (string.IsNullOrWhiteSpace(video.Name) || (string.Equals(video.Name, Path.GetFileNameWithoutExtension(video.Path), StringComparison.OrdinalIgnoreCase) && !video.ProviderIds.Any())) { - video.Name = data.Name; + // Don't use the embedded name for extras because it will often be the same name as the movie + if (!video.ExtraType.HasValue && !video.IsOwnedItem) + { + video.Name = data.Name; + } } } } @@ -433,7 +437,7 @@ namespace MediaBrowser.Providers.MediaInfo video.ProductionYear = video.PremiereDate.Value.ToLocalTime().Year; } - if (!video.LockedFields.Contains(MetadataFields.Overview)) + if (!video.IsLocked && !video.LockedFields.Contains(MetadataFields.Overview)) { if (string.IsNullOrWhiteSpace(video.Overview) || isFullRefresh) { @@ -446,7 +450,7 @@ namespace MediaBrowser.Providers.MediaInfo { var isFullRefresh = options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh; - if (!video.LockedFields.Contains(MetadataFields.Cast)) + if (!video.IsLocked && !video.LockedFields.Contains(MetadataFields.Cast)) { if (isFullRefresh || _libraryManager.GetPeople(video).Count == 0) { From 8d3e94ffb1c1c09642a551deb6a2a876044339c9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 21 Feb 2017 13:04:35 -0500 Subject: [PATCH 2/3] update recording conversion --- .../LiveTv/EmbyTV/EncodedRecorder.cs | 17 ++++-- .../Music/MusicBrainzAlbumProvider.cs | 57 +++---------------- 2 files changed, 20 insertions(+), 54 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 5adb0b3c6..d5c2ec5d0 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -65,6 +65,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV } } + private bool CopySubtitles + { + get { return string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase); } + } + public string GetOutputPath(MediaSourceInfo mediaSource, string targetFile) { return Path.ChangeExtension(targetFile, "." + OutputFormat); @@ -154,8 +159,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks); var inputModifiers = "-fflags +genpts -async 1 -vsync -1"; - var mapArgs = string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase) ? "-map 0" : "-sn"; - var commandLineArgs = "-i \"{0}\"{4} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; + var mapArgs = "-map 0 -ignore_unknown"; + var commandLineArgs = "-i \"{0}\"{5} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3}{4} -y \"{1}\""; long startTimeTicks = 0; //if (mediaSource.DateLiveStreamOpened.HasValue) @@ -183,7 +188,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV (analyzeDurationSeconds * 1000000).ToString(CultureInfo.InvariantCulture); inputModifiers += analyzeDuration; - commandLineArgs = string.Format(commandLineArgs, inputTempFile, targetFile, videoArgs, GetAudioArgs(mediaSource), durationParam); + var subtitleArgs = CopySubtitles ? " -codec:s copy" : " -sn"; + + commandLineArgs = string.Format(commandLineArgs, inputTempFile, targetFile, videoArgs, GetAudioArgs(mediaSource), subtitleArgs, durationParam); return inputModifiers + " " + commandLineArgs; } @@ -196,7 +203,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV // do not copy aac because many players have difficulty with aac_latm if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings && !string.Equals(inputAudioCodec, "aac", StringComparison.OrdinalIgnoreCase)) { - return "-codec:a:0 copy"; + return "-codec:a copy"; } var audioChannels = 2; @@ -205,7 +212,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV { audioChannels = audioStream.Channels ?? audioChannels; } - return "-codec:a:0 aac -strict experimental -ab 320000"; + return "-codec:a aac -strict experimental -ab 320000"; } private bool EncodeVideo(MediaSourceInfo mediaSource) diff --git a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs index 30617643a..e6eb0951d 100644 --- a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs @@ -45,7 +45,6 @@ namespace MediaBrowser.Providers.Music public async Task> GetSearchResults(AlbumInfo searchInfo, CancellationToken cancellationToken) { var releaseId = searchInfo.GetReleaseId(); - var releaseGroupId = searchInfo.GetReleaseGroupId(); string url = null; var isNameSearch = false; @@ -54,10 +53,6 @@ namespace MediaBrowser.Providers.Music { url = string.Format("/ws/2/release/?query=reid:{0}", releaseId); } - else if (!string.IsNullOrEmpty(releaseGroupId)) - { - url = string.Format("/ws/2/release?release-group={0}", releaseGroupId); - } else { var artistMusicBrainzId = searchInfo.GetMusicBrainzArtistId(); @@ -136,14 +131,7 @@ namespace MediaBrowser.Providers.Music Item = new MusicAlbum() }; - // If we have a release group Id but not a release Id... - if (string.IsNullOrWhiteSpace(releaseId) && !string.IsNullOrWhiteSpace(releaseGroupId)) - { - releaseId = await GetReleaseIdFromReleaseGroupId(releaseGroupId, cancellationToken).ConfigureAwait(false); - result.HasMetadata = true; - } - - if (string.IsNullOrWhiteSpace(releaseId)) + if (string.IsNullOrEmpty(releaseId)) { var artistMusicBrainzId = id.GetMusicBrainzArtistId(); @@ -151,13 +139,13 @@ namespace MediaBrowser.Providers.Music if (releaseResult != null) { - if (!string.IsNullOrWhiteSpace(releaseResult.ReleaseId)) + if (!string.IsNullOrEmpty(releaseResult.ReleaseId)) { releaseId = releaseResult.ReleaseId; result.HasMetadata = true; } - if (!string.IsNullOrWhiteSpace(releaseResult.ReleaseGroupId)) + if (!string.IsNullOrEmpty(releaseResult.ReleaseGroupId)) { releaseGroupId = releaseResult.ReleaseGroupId; result.HasMetadata = true; @@ -169,13 +157,13 @@ namespace MediaBrowser.Providers.Music } // If we have a release Id but not a release group Id... - if (!string.IsNullOrWhiteSpace(releaseId) && string.IsNullOrWhiteSpace(releaseGroupId)) + if (!string.IsNullOrEmpty(releaseId) && string.IsNullOrEmpty(releaseGroupId)) { - releaseGroupId = await GetReleaseGroupFromReleaseId(releaseId, cancellationToken).ConfigureAwait(false); + releaseGroupId = await GetReleaseGroupId(releaseId, cancellationToken).ConfigureAwait(false); result.HasMetadata = true; } - if (!string.IsNullOrWhiteSpace(releaseId) || !string.IsNullOrWhiteSpace(releaseGroupId)) + if (!string.IsNullOrEmpty(releaseId) || !string.IsNullOrEmpty(releaseGroupId)) { result.HasMetadata = true; } @@ -423,42 +411,13 @@ namespace MediaBrowser.Providers.Music } } - private async Task GetReleaseIdFromReleaseGroupId(string releaseGroupId, CancellationToken cancellationToken) - { - var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId); - - using (var stream = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false)) - { - using (var oReader = new StreamReader(stream, Encoding.UTF8)) - { - var settings = _xmlSettings.Create(false); - - settings.CheckCharacters = false; - settings.IgnoreProcessingInstructions = true; - settings.IgnoreComments = true; - - using (var reader = XmlReader.Create(oReader, settings)) - { - var result = ReleaseResult.Parse(reader).FirstOrDefault(); - - if (result != null) - { - return result.ReleaseId; - } - } - } - } - - return null; - } - /// /// Gets the release group id internal. /// /// The release entry id. /// The cancellation token. /// Task{System.String}. - private async Task GetReleaseGroupFromReleaseId(string releaseEntryId, CancellationToken cancellationToken) + private async Task GetReleaseGroupId(string releaseEntryId, CancellationToken cancellationToken) { var url = string.Format("/ws/2/release-group/?query=reid:{0}", releaseEntryId); @@ -662,4 +621,4 @@ namespace MediaBrowser.Providers.Music public int throttleMs { get; set; } } } -} +} \ No newline at end of file From 389d3f7629b05330c6d3b29299da3198396728c1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 21 Feb 2017 13:04:54 -0500 Subject: [PATCH 3/3] 3.2.1.114 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index bede8da60..68d9dc4d4 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.1.113")] +[assembly: AssemblyVersion("3.2.1.114")]