From 9da48106c893bf179a00db7dadbb74f513277263 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 29 Dec 2016 16:50:53 -0500 Subject: update logging --- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs') diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 89730a11f..c26664921 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -533,8 +533,10 @@ namespace MediaBrowser.MediaEncoding.Encoder probeSize = probeSize + " " + analyzeDuration; probeSize = probeSize.Trim(); + var forceEnableLogging = request.Protocol != MediaProtocol.File; + return GetMediaInfoInternal(GetInputArgument(inputFiles, request.Protocol), request.InputPath, request.Protocol, extractChapters, - probeSize, request.MediaType == DlnaProfileType.Audio, request.VideoType, cancellationToken); + probeSize, request.MediaType == DlnaProfileType.Audio, request.VideoType, forceEnableLogging, cancellationToken); } /// @@ -577,14 +579,6 @@ namespace MediaBrowser.MediaEncoding.Encoder /// /// Gets the media info internal. /// - /// The input path. - /// The primary path. - /// The protocol. - /// if set to true [extract chapters]. - /// The probe size argument. - /// if set to true [is audio]. - /// Type of the video. - /// The cancellation token. /// Task{MediaInfoResult}. private async Task GetMediaInfoInternal(string inputPath, string primaryPath, @@ -593,6 +587,7 @@ namespace MediaBrowser.MediaEncoding.Encoder string probeSizeArgument, bool isAudio, VideoType videoType, + bool forceEnableLogging, CancellationToken cancellationToken) { var args = extractChapters @@ -614,7 +609,14 @@ namespace MediaBrowser.MediaEncoding.Encoder EnableRaisingEvents = true }); - _logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); + if (forceEnableLogging) + { + _logger.Info("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); + } + else + { + _logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); + } using (var processWrapper = new ProcessWrapper(process, this, _logger)) { -- cgit v1.2.3 From 8d668095bb663c51083b97eb61b09811cb97575b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 20 Jan 2017 12:53:48 -0500 Subject: add IsRemote property --- .../Data/SqliteItemRepository.cs | 6 ++-- .../LiveTv/EmbyTV/EncodedRecorder.cs | 39 ++++++++++++++++++++-- .../LiveTv/TunerHosts/M3UTunerHost.cs | 3 +- .../Channels/ChannelMediaInfo.cs | 3 +- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 12 +++---- MediaBrowser.Model/Dto/MediaSourceInfo.cs | 5 +++ MediaBrowser.Model/Entities/MediaStream.cs | 5 +++ 7 files changed, 61 insertions(+), 12 deletions(-) (limited to 'MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs') diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 5809d84fd..af1594cf7 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -3617,10 +3617,12 @@ namespace Emby.Server.Implementations.Data var index = 0; foreach (var type in query.TrailerTypes) { - clauses.Add("TrailerTypes like @TrailerTypes" + index); + var paramName = "@TrailerTypes" + index; + + clauses.Add("TrailerTypes like " + paramName); if (statement != null) { - statement.TryBind("@TrailerTypes" + index, "%" + type + "%"); + statement.TryBind(paramName, "%" + type + "%"); } index++; } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 5e55b893f..beb08cc25 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -240,14 +240,49 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV { try { - _logger.Info("Killing ffmpeg recording process for {0}", _targetPath); + _logger.Info("Stopping ffmpeg recording process for {0}", _targetPath); //process.Kill(); _process.StandardInput.WriteLine("q"); } catch (Exception ex) { - _logger.ErrorException("Error killing transcoding job for {0}", ex, _targetPath); + _logger.ErrorException("Error stopping recording transcoding job for {0}", ex, _targetPath); + } + + if (_hasExited) + { + return; + } + + try + { + _logger.Info("Calling recording process.WaitForExit for {0}", _targetPath); + + if (_process.WaitForExit(5000)) + { + return; + } + } + catch (Exception ex) + { + _logger.ErrorException("Error waiting for recording process to exit for {0}", ex, _targetPath); + } + + if (_hasExited) + { + return; + } + + try + { + _logger.Info("Killing ffmpeg recording process for {0}", _targetPath); + + _process.Kill(); + } + catch (Exception ex) + { + _logger.ErrorException("Error killing recording transcoding job for {0}", ex, _targetPath); } } } diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs index 7954b86ba..449a4104f 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs @@ -160,7 +160,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts Id = channel.Path.GetMD5().ToString("N"), IsInfiniteStream = true, - SupportsDirectStream = false + SupportsDirectStream = false, + IsRemote = true }; return new List { mediaSource }; diff --git a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs index 6d2190680..eda6ee1af 100644 --- a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs @@ -68,7 +68,8 @@ namespace MediaBrowser.Controller.Channels Id = id, ReadAtNativeFramerate = ReadAtNativeFramerate, SupportsDirectStream = false, - SupportsDirectPlay = SupportsDirectPlay + SupportsDirectPlay = SupportsDirectPlay, + IsRemote = true }; var bitrate = (AudioBitrate ?? 0) + (VideoBitrate ?? 0); diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index c26664921..6a5945b76 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -1250,8 +1250,8 @@ namespace MediaBrowser.MediaEncoding.Encoder lock (_runningProcesses) { proceses = _runningProcesses.ToList(); + _runningProcesses.Clear(); } - _runningProcesses.Clear(); foreach (var process in proceses) { @@ -1321,16 +1321,16 @@ namespace MediaBrowser.MediaEncoding.Encoder { } - lock (_mediaEncoder._runningProcesses) - { - _mediaEncoder._runningProcesses.Remove(this); - } - DisposeProcess(process); } private void DisposeProcess(IProcess process) { + lock (_mediaEncoder._runningProcesses) + { + _mediaEncoder._runningProcesses.Remove(this); + } + try { process.Dispose(); diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index 814368d32..4f93f476f 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -21,6 +21,11 @@ namespace MediaBrowser.Model.Dto public string Name { get; set; } + /// + /// Differentiate internet url vs local network + /// + public bool IsRemote { get; set; } + public string ETag { get; set; } public long? RunTimeTicks { get; set; } public bool ReadAtNativeFramerate { get; set; } diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 85f475ca2..0eb9e2730 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -92,6 +92,11 @@ namespace MediaBrowser.Model.Entities { attributes.Add(StringHelper.FirstToUpper(Language)); } + else + { + attributes.Add("Und"); + } + if (IsDefault) { attributes.Add("Default"); -- cgit v1.2.3