From b35051463b6241bae93e5d50c0a2a1fe06da5e2f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 6 Feb 2017 01:05:34 -0500 Subject: restore features --- .../Encoder/EncodingHelper.cs | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'MediaBrowser.MediaEncoding/Encoder') diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs index 83057dba4..ed9552964 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs @@ -1486,33 +1486,33 @@ namespace MediaBrowser.MediaEncoding.Encoder //inputModifier += " -noaccurate_seek"; } - //if (!string.IsNullOrWhiteSpace(state.InputContainer)) - //{ - // var inputFormat = GetInputFormat(state.InputContainer); - // if (!string.IsNullOrWhiteSpace(inputFormat)) - // { - // inputModifier += " -f " + inputFormat; - // } - //} - - //if (state.RunTimeTicks.HasValue) - //{ - // foreach (var stream in state.MediaSource.MediaStreams) - // { - // if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) - // { - // if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) - // { - // var decoder = GetDecoderFromCodec(stream.Codec); - - // if (!string.IsNullOrWhiteSpace(decoder)) - // { - // inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; - // } - // } - // } - // } - //} + if (!string.IsNullOrWhiteSpace(state.InputContainer)) + { + var inputFormat = GetInputFormat(state.InputContainer); + if (!string.IsNullOrWhiteSpace(inputFormat)) + { + inputModifier += " -f " + inputFormat; + } + } + + if (state.RunTimeTicks.HasValue) + { + foreach (var stream in state.MediaSource.MediaStreams) + { + if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) + { + if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) + { + var decoder = GetDecoderFromCodec(stream.Codec); + + if (!string.IsNullOrWhiteSpace(decoder)) + { + inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; + } + } + } + } + } } return inputModifier; -- cgit v1.2.3 From 8deb423883cf8a6dcf3588a7707693f14ac6a166 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 13:50:33 -0500 Subject: restore config settings for now --- .../Library/LibraryManager.cs | 12 ++++++++++++ .../Library/Resolvers/Audio/MusicArtistResolver.cs | 21 ++++++++++----------- MediaBrowser.Common/Net/HttpRequestOptions.cs | 1 + MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 5 ----- .../Configuration/ServerConfiguration.cs | 12 ++++++++++++ 5 files changed, 35 insertions(+), 16 deletions(-) (limited to 'MediaBrowser.MediaEncoding/Encoder') diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index de3a1664e..616c6c1a2 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -2627,6 +2627,18 @@ namespace Emby.Server.Implementations.Library } } + foreach (var map in ConfigurationManager.Configuration.PathSubstitutions) + { + if (!string.IsNullOrWhiteSpace(map.From)) + { + var substitutionResult = SubstitutePathInternal(path, map.From, map.To); + if (substitutionResult.Item2) + { + return substitutionResult.Item1; + } + } + } + return path; } diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs index 6cf201990..2971405b9 100644 --- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs @@ -74,21 +74,20 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio return new MusicArtist(); } - return null; - //if (_config.Configuration.EnableSimpleArtistDetection) - //{ - // return null; - //} + if (_config.Configuration.EnableSimpleArtistDetection) + { + return null; + } - //// Avoid mis-identifying top folders - //if (args.Parent.IsRoot) return null; + // Avoid mis-identifying top folders + if (args.Parent.IsRoot) return null; - //var directoryService = args.DirectoryService; + var directoryService = args.DirectoryService; - //var albumResolver = new MusicAlbumResolver(_logger, _fileSystem, _libraryManager); + var albumResolver = new MusicAlbumResolver(_logger, _fileSystem, _libraryManager); - //// If we contain an album assume we are an artist folder - //return args.FileSystemChildren.Where(i => i.IsDirectory).Any(i => albumResolver.IsMusicAlbum(i.FullName, directoryService, args.GetLibraryOptions())) ? new MusicArtist() : null; + // If we contain an album assume we are an artist folder + return args.FileSystemChildren.Where(i => i.IsDirectory).Any(i => albumResolver.IsMusicAlbum(i.FullName, directoryService, args.GetLibraryOptions())) ? new MusicArtist() : null; } } diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index e1ecd6595..4a894e662 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -100,6 +100,7 @@ namespace MediaBrowser.Common.Net public int TimeoutMs { get; set; } public bool PreferIpv4 { get; set; } + public bool EnableDefaultUserAgent { get; set; } private string GetHeaderValue(string name) { diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index ee3482a70..e7737b6a6 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -725,11 +725,6 @@ namespace MediaBrowser.MediaEncoding.Encoder if (video.Protocol != MediaProtocol.File) { - // If it's mpeg based, assume true - if ((videoStream.Codec ?? string.Empty).IndexOf("mpeg", StringComparison.OrdinalIgnoreCase) != -1) - { - return true; - } return false; } diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index f9df776df..c2b1e3c89 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -192,6 +192,10 @@ namespace MediaBrowser.Model.Configuration public bool EnableExternalContentInSuggestions { get; set; } public int ImageExtractionTimeoutMs { get; set; } + + public PathSubstitution[] PathSubstitutions { get; set; } + public bool EnableSimpleArtistDetection { get; set; } + /// /// Initializes a new instance of the class. /// @@ -202,6 +206,8 @@ namespace MediaBrowser.Model.Configuration Migrations = new string[] { }; ImageExtractionTimeoutMs = 0; EnableLocalizedGuids = true; + PathSubstitutions = new PathSubstitution[] { }; + EnableSimpleArtistDetection = true; DisplaySpecialsWithinSeasons = true; EnableExternalContentInSuggestions = true; @@ -563,4 +569,10 @@ namespace MediaBrowser.Model.Configuration }; } } + + public class PathSubstitution + { + public string From { get; set; } + public string To { get; set; } + } } \ No newline at end of file -- cgit v1.2.3 From 35415d6a504ae8e2f066b2e0e4b1a94745c95bf3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 9 Feb 2017 18:59:27 -0500 Subject: add error handling --- .../LiveTv/EmbyTV/EncodedRecorder.cs | 1 + .../LiveTv/ProgramImageProvider.cs | 15 +++--- .../Encoder/EncodingHelper.cs | 54 +++++++++++----------- 3 files changed, 37 insertions(+), 33 deletions(-) (limited to 'MediaBrowser.MediaEncoding/Encoder') diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 68126f926..9a8282250 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -155,6 +155,7 @@ 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"; + mapArgs = "-sn"; var commandLineArgs = "-i \"{0}\"{4} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; long startTimeTicks = 0; diff --git a/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs b/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs index 5a0389b16..5cff88a67 100644 --- a/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs +++ b/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs @@ -50,13 +50,16 @@ namespace Emby.Server.Implementations.LiveTv { var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId); - var response = await service.GetProgramImageAsync(GetItemExternalId(liveTvItem), GetItemExternalId(channel), cancellationToken).ConfigureAwait(false); - - if (response != null) + if (channel != null) { - imageResponse.HasImage = true; - imageResponse.Stream = response.Stream; - imageResponse.Format = response.Format; + var response = await service.GetProgramImageAsync(GetItemExternalId(liveTvItem), GetItemExternalId(channel), cancellationToken).ConfigureAwait(false); + + if (response != null) + { + imageResponse.HasImage = true; + imageResponse.Stream = response.Stream; + imageResponse.Format = response.Format; + } } } catch (NotImplementedException) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs index ed9552964..83057dba4 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs @@ -1486,33 +1486,33 @@ namespace MediaBrowser.MediaEncoding.Encoder //inputModifier += " -noaccurate_seek"; } - if (!string.IsNullOrWhiteSpace(state.InputContainer)) - { - var inputFormat = GetInputFormat(state.InputContainer); - if (!string.IsNullOrWhiteSpace(inputFormat)) - { - inputModifier += " -f " + inputFormat; - } - } - - if (state.RunTimeTicks.HasValue) - { - foreach (var stream in state.MediaSource.MediaStreams) - { - if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) - { - if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) - { - var decoder = GetDecoderFromCodec(stream.Codec); - - if (!string.IsNullOrWhiteSpace(decoder)) - { - inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; - } - } - } - } - } + //if (!string.IsNullOrWhiteSpace(state.InputContainer)) + //{ + // var inputFormat = GetInputFormat(state.InputContainer); + // if (!string.IsNullOrWhiteSpace(inputFormat)) + // { + // inputModifier += " -f " + inputFormat; + // } + //} + + //if (state.RunTimeTicks.HasValue) + //{ + // foreach (var stream in state.MediaSource.MediaStreams) + // { + // if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) + // { + // if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) + // { + // var decoder = GetDecoderFromCodec(stream.Codec); + + // if (!string.IsNullOrWhiteSpace(decoder)) + // { + // inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; + // } + // } + // } + // } + //} } return inputModifier; -- cgit v1.2.3