diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 5809d84fd9..af1594cf74 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 5e55b893f3..beb08cc251 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 7954b86ba4..449a4104fb 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 6d21906808..eda6ee1af3 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 c26664921e..6a5945b761 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 814368d32f..4f93f476f3 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 85f475ca25..0eb9e27303 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");