mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Rebase
This commit is contained in:
parent
a8fde5e89c
commit
0c1b9d3bff
@ -180,7 +180,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
if (!message.StartsWith("{", StringComparison.OrdinalIgnoreCase))
|
if (!message.StartsWith("{", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// This info is useful sometimes but also clogs up the log
|
// This info is useful sometimes but also clogs up the log
|
||||||
//_logger.Error("Received web socket message that is not a json structure: " + message);
|
//_lLogError("Received web socket message that is not a json structure: " + message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using MediaBrowser.Common.Events;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ namespace Emby.XmlTv.Classes
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
//Logger.Error("No id found for channel row");
|
//LLogError("No id found for channel row");
|
||||||
// Log.Error(" channel#{0} doesnt contain an id", iChannel);
|
// Log.Error(" channel#{0} doesnt contain an id", iChannel);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ namespace Emby.XmlTv.Classes
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(result.DisplayName))
|
if (string.IsNullOrEmpty(result.DisplayName))
|
||||||
{
|
{
|
||||||
//Logger.Error("No display-name found for channel {0}", id);
|
//LLogError("No display-name found for channel {0}", id);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ namespace MediaBrowser.Api
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error deleting encoded media cache", ex);
|
Logger.LogError("Error deleting encoded media cache", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ namespace MediaBrowser.Api
|
|||||||
public void OnTranscodeEndRequest(TranscodingJob job)
|
public void OnTranscodeEndRequest(TranscodingJob job)
|
||||||
{
|
{
|
||||||
job.ActiveRequestCount--;
|
job.ActiveRequestCount--;
|
||||||
//Logger.Debug("OnTranscodeEndRequest job.ActiveRequestCount={0}", job.ActiveRequestCount);
|
//Logger.LogDebug("OnTranscodeEndRequest job.ActiveRequestCount={0}", job.ActiveRequestCount);
|
||||||
if (job.ActiveRequestCount <= 0)
|
if (job.ActiveRequestCount <= 0)
|
||||||
{
|
{
|
||||||
PingTimer(job, false);
|
PingTimer(job, false);
|
||||||
@ -391,7 +391,7 @@ namespace MediaBrowser.Api
|
|||||||
throw new ArgumentNullException("playSessionId");
|
throw new ArgumentNullException("playSessionId");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Logger.Debug("PingTranscodingJob PlaySessionId={0} isUsedPaused: {1}", playSessionId, isUserPaused);
|
//Logger.LogDebug("PingTranscodingJob PlaySessionId={0} isUsedPaused: {1}", playSessionId, isUserPaused);
|
||||||
|
|
||||||
List<TranscodingJob> jobs;
|
List<TranscodingJob> jobs;
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
if (isUserPaused.HasValue)
|
if (isUserPaused.HasValue)
|
||||||
{
|
{
|
||||||
//Logger.Debug("Setting job.IsUserPaused to {0}. jobId: {1}", isUserPaused, job.Id);
|
//Logger.LogDebug("Setting job.IsUserPaused to {0}. jobId: {1}", isUserPaused, job.Id);
|
||||||
job.IsUserPaused = isUserPaused.Value;
|
job.IsUserPaused = isUserPaused.Value;
|
||||||
}
|
}
|
||||||
PingTimer(job, true);
|
PingTimer(job, true);
|
||||||
@ -461,7 +461,7 @@ namespace MediaBrowser.Api
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
|
Logger.LogInformation("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
|
||||||
|
|
||||||
KillTranscodingJob(job, true, path => true);
|
KillTranscodingJob(job, true, path => true);
|
||||||
}
|
}
|
||||||
@ -525,7 +525,7 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
job.DisposeKillTimer();
|
job.DisposeKillTimer();
|
||||||
|
|
||||||
Logger.Debug("KillTranscodingJob - JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
|
Logger.LogDebug("KillTranscodingJob - JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
|
||||||
|
|
||||||
lock (_activeTranscodingJobs)
|
lock (_activeTranscodingJobs)
|
||||||
{
|
{
|
||||||
@ -557,7 +557,7 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.Info("Stopping ffmpeg process with q command for {0}", job.Path);
|
Logger.LogInformation("Stopping ffmpeg process with q command for {0}", job.Path);
|
||||||
|
|
||||||
//process.Kill();
|
//process.Kill();
|
||||||
process.StandardInput.WriteLine("q");
|
process.StandardInput.WriteLine("q");
|
||||||
@ -565,13 +565,13 @@ namespace MediaBrowser.Api
|
|||||||
// Need to wait because killing is asynchronous
|
// Need to wait because killing is asynchronous
|
||||||
if (!process.WaitForExit(5000))
|
if (!process.WaitForExit(5000))
|
||||||
{
|
{
|
||||||
Logger.Info("Killing ffmpeg process for {0}", job.Path);
|
Logger.LogInformation("Killing ffmpeg process for {0}", job.Path);
|
||||||
process.Kill();
|
process.Kill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error killing transcoding job for {0}", ex, job.Path);
|
Logger.LogError("Error killing transcoding job for {0}", ex, job.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -589,7 +589,7 @@ namespace MediaBrowser.Api
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error closing live stream for {0}", ex, job.Path);
|
Logger.LogError("Error closing live stream for {0}", ex, job.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -601,7 +601,7 @@ namespace MediaBrowser.Api
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info("Deleting partial stream file(s) {0}", path);
|
Logger.LogInformation("Deleting partial stream file(s) {0}", path);
|
||||||
|
|
||||||
await Task.Delay(delayMs).ConfigureAwait(false);
|
await Task.Delay(delayMs).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -622,13 +622,13 @@ namespace MediaBrowser.Api
|
|||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
//Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
//Logger.LogError("Error deleting partial stream file(s) {0}", ex, path);
|
||||||
|
|
||||||
DeletePartialStreamFiles(path, jobType, retryCount + 1, 500);
|
DeletePartialStreamFiles(path, jobType, retryCount + 1, 500);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
//Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
//Logger.LogError("Error deleting partial stream file(s) {0}", ex, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,7 +660,7 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Logger.Debug("Deleting HLS file {0}", file);
|
//Logger.LogDebug("Deleting HLS file {0}", file);
|
||||||
_fileSystem.DeleteFile(file);
|
_fileSystem.DeleteFile(file);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
@ -670,7 +670,7 @@ namespace MediaBrowser.Api
|
|||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
e = ex;
|
e = ex;
|
||||||
//Logger.ErrorException("Error deleting HLS file {0}", ex, file);
|
//Logger.LogError("Error deleting HLS file {0}", ex, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -802,12 +802,12 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
if (KillTimer == null)
|
if (KillTimer == null)
|
||||||
{
|
{
|
||||||
//Logger.Debug("Starting kill timer at {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
|
//Logger.LogDebug("Starting kill timer at {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
|
||||||
KillTimer = _timerFactory.Create(callback, this, intervalMs, Timeout.Infinite);
|
KillTimer = _timerFactory.Create(callback, this, intervalMs, Timeout.Infinite);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Logger.Debug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
|
//Logger.LogDebug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
|
||||||
KillTimer.Change(intervalMs, Timeout.Infinite);
|
KillTimer.Change(intervalMs, Timeout.Infinite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -826,7 +826,7 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
var intervalMs = PingTimeout;
|
var intervalMs = PingTimeout;
|
||||||
|
|
||||||
//Logger.Debug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
|
//Logger.LogDebug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
|
||||||
KillTimer.Change(intervalMs, Timeout.Infinite);
|
KillTimer.Change(intervalMs, Timeout.Infinite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.LiveTv
|
namespace MediaBrowser.Api.LiveTv
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@ using MediaBrowser.Controller;
|
|||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.Diagnostics;
|
using MediaBrowser.Model.Diagnostics;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback
|
namespace MediaBrowser.Api.Playback
|
||||||
{
|
{
|
||||||
@ -248,7 +249,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
cancellationTokenSource);
|
cancellationTokenSource);
|
||||||
|
|
||||||
var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
|
var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
|
||||||
Logger.Info(commandLineLogMessage);
|
Logger.LogInformation(commandLineLogMessage);
|
||||||
|
|
||||||
var logFilePrefix = "ffmpeg-transcode";
|
var logFilePrefix = "ffmpeg-transcode";
|
||||||
if (state.VideoRequest != null && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) && string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
if (state.VideoRequest != null && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) && string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||||
@ -277,7 +278,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error starting ffmpeg", ex);
|
Logger.LogError("Error starting ffmpeg", ex);
|
||||||
|
|
||||||
ApiEntryPoint.Instance.OnTranscodeFailedToStart(outputPath, TranscodingJobType, state);
|
ApiEntryPoint.Instance.OnTranscodeFailedToStart(outputPath, TranscodingJobType, state);
|
||||||
|
|
||||||
@ -351,16 +352,16 @@ namespace MediaBrowser.Api.Playback
|
|||||||
job.HasExited = true;
|
job.HasExited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Debug("Disposing stream resources");
|
Logger.LogDebug("Disposing stream resources");
|
||||||
state.Dispose();
|
state.Dispose();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.Info("FFMpeg exited with code {0}", process.ExitCode);
|
Logger.LogInformation("FFMpeg exited with code {0}", process.ExitCode);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Logger.Error("FFMpeg exited with an error.");
|
Logger.LogError("FFMpeg exited with an error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// This causes on exited to be called twice:
|
// This causes on exited to be called twice:
|
||||||
@ -371,7 +372,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
//}
|
//}
|
||||||
//catch (Exception ex)
|
//catch (Exception ex)
|
||||||
//{
|
//{
|
||||||
// Logger.ErrorException("Error disposing ffmpeg.", ex);
|
// Logger.LogError("Error disposing ffmpeg.", ex);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback.Hls
|
namespace MediaBrowser.Api.Playback.Hls
|
||||||
{
|
{
|
||||||
@ -185,7 +186,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
|
|
||||||
protected virtual async Task WaitForMinimumSegmentCount(string playlist, int segmentCount, CancellationToken cancellationToken)
|
protected virtual async Task WaitForMinimumSegmentCount(string playlist, int segmentCount, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Logger.Debug("Waiting for {0} segments in {1}", segmentCount, playlist);
|
Logger.LogDebug("Waiting for {0} segments in {1}", segmentCount, playlist);
|
||||||
|
|
||||||
while (!cancellationToken.IsCancellationRequested)
|
while (!cancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
@ -207,7 +208,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
count++;
|
count++;
|
||||||
if (count >= segmentCount)
|
if (count >= segmentCount)
|
||||||
{
|
{
|
||||||
Logger.Debug("Finished waiting for {0} segments in {1}", segmentCount, playlist);
|
Logger.LogDebug("Finished waiting for {0} segments in {1}", segmentCount, playlist);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,4 +331,4 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ using System.Threading.Tasks;
|
|||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
|
using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback.Hls
|
namespace MediaBrowser.Api.Playback.Hls
|
||||||
{
|
{
|
||||||
@ -190,17 +191,17 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
|
|
||||||
if (currentTranscodingIndex == null)
|
if (currentTranscodingIndex == null)
|
||||||
{
|
{
|
||||||
Logger.Debug("Starting transcoding because currentTranscodingIndex=null");
|
Logger.LogDebug("Starting transcoding because currentTranscodingIndex=null");
|
||||||
startTranscoding = true;
|
startTranscoding = true;
|
||||||
}
|
}
|
||||||
else if (requestedIndex < currentTranscodingIndex.Value)
|
else if (requestedIndex < currentTranscodingIndex.Value)
|
||||||
{
|
{
|
||||||
Logger.Debug("Starting transcoding because requestedIndex={0} and currentTranscodingIndex={1}", requestedIndex, currentTranscodingIndex);
|
Logger.LogDebug("Starting transcoding because requestedIndex={0} and currentTranscodingIndex={1}", requestedIndex, currentTranscodingIndex);
|
||||||
startTranscoding = true;
|
startTranscoding = true;
|
||||||
}
|
}
|
||||||
else if (requestedIndex - currentTranscodingIndex.Value > segmentGapRequiringTranscodingChange)
|
else if (requestedIndex - currentTranscodingIndex.Value > segmentGapRequiringTranscodingChange)
|
||||||
{
|
{
|
||||||
Logger.Debug("Starting transcoding because segmentGap is {0} and max allowed gap is {1}. requestedIndex={2}", requestedIndex - currentTranscodingIndex.Value, segmentGapRequiringTranscodingChange, requestedIndex);
|
Logger.LogDebug("Starting transcoding because segmentGap is {0} and max allowed gap is {1}. requestedIndex={2}", requestedIndex - currentTranscodingIndex.Value, segmentGapRequiringTranscodingChange, requestedIndex);
|
||||||
startTranscoding = true;
|
startTranscoding = true;
|
||||||
}
|
}
|
||||||
if (startTranscoding)
|
if (startTranscoding)
|
||||||
@ -245,13 +246,13 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Logger.Info("waiting for {0}", segmentPath);
|
//Logger.LogInformation("waiting for {0}", segmentPath);
|
||||||
//while (!File.Exists(segmentPath))
|
//while (!File.Exists(segmentPath))
|
||||||
//{
|
//{
|
||||||
// await Task.Delay(50, cancellationToken).ConfigureAwait(false);
|
// await Task.Delay(50, cancellationToken).ConfigureAwait(false);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
Logger.Info("returning {0}", segmentPath);
|
Logger.LogInformation("returning {0}", segmentPath);
|
||||||
job = job ?? ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);
|
job = job ?? ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);
|
||||||
return await GetSegmentResult(state, playlistPath, segmentPath, segmentExtension, requestedIndex, job, cancellationToken).ConfigureAwait(false);
|
return await GetSegmentResult(state, playlistPath, segmentPath, segmentExtension, requestedIndex, job, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@ -358,7 +359,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Debug("Deleting partial HLS file {0}", path);
|
Logger.LogDebug("Deleting partial HLS file {path}", path);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -366,7 +367,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
Logger.LogError("Error deleting partial stream file(s) {0}", ex, path);
|
||||||
|
|
||||||
var task = Task.Delay(100);
|
var task = Task.Delay(100);
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
@ -374,7 +375,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
Logger.LogError("Error deleting partial stream file(s) {0}", ex, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,4 +969,4 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
).Trim();
|
).Trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ using MediaBrowser.Controller.Entities.Audio;
|
|||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback
|
namespace MediaBrowser.Api.Playback
|
||||||
{
|
{
|
||||||
@ -381,11 +382,11 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
if (item is Audio)
|
if (item is Audio)
|
||||||
{
|
{
|
||||||
Logger.Info("User policy for {0}. EnableAudioPlaybackTranscoding: {1}", user.Name, user.Policy.EnableAudioPlaybackTranscoding);
|
Logger.LogInformation("User policy for {0}. EnableAudioPlaybackTranscoding: {1}", user.Name, user.Policy.EnableAudioPlaybackTranscoding);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Info("User policy for {0}. EnablePlaybackRemuxing: {1} EnableVideoPlaybackTranscoding: {2} EnableAudioPlaybackTranscoding: {3}",
|
Logger.LogInformation("User policy for {0}. EnablePlaybackRemuxing: {1} EnableVideoPlaybackTranscoding: {2} EnableAudioPlaybackTranscoding: {3}",
|
||||||
user.Name,
|
user.Name,
|
||||||
user.Policy.EnablePlaybackRemuxing,
|
user.Policy.EnablePlaybackRemuxing,
|
||||||
user.Policy.EnableVideoPlaybackTranscoding,
|
user.Policy.EnableVideoPlaybackTranscoding,
|
||||||
@ -525,7 +526,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
{
|
{
|
||||||
var isInLocalNetwork = _networkManager.IsInLocalNetwork(Request.RemoteIp);
|
var isInLocalNetwork = _networkManager.IsInLocalNetwork(Request.RemoteIp);
|
||||||
|
|
||||||
Logger.Info("RemoteClientBitrateLimit: {0}, RemoteIp: {1}, IsInLocalNetwork: {2}", remoteClientMaxBitrate, Request.RemoteIp, isInLocalNetwork);
|
Logger.LogInformation("RemoteClientBitrateLimit: {0}, RemoteIp: {1}, IsInLocalNetwork: {2}", remoteClientMaxBitrate, Request.RemoteIp, isInLocalNetwork);
|
||||||
if (!isInLocalNetwork)
|
if (!isInLocalNetwork)
|
||||||
{
|
{
|
||||||
maxBitrate = Math.Min(maxBitrate ?? remoteClientMaxBitrate, remoteClientMaxBitrate);
|
maxBitrate = Math.Min(maxBitrate ?? remoteClientMaxBitrate, remoteClientMaxBitrate);
|
||||||
|
@ -17,6 +17,8 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MediaBrowser.Api.LiveTv;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback.Progressive
|
namespace MediaBrowser.Api.Playback.Progressive
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
using MediaBrowser.Model.Logging;
|
using System;
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback.Progressive
|
namespace MediaBrowser.Api.Playback.Progressive
|
||||||
{
|
{
|
||||||
@ -110,7 +109,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
|||||||
}
|
}
|
||||||
|
|
||||||
//var position = fs.Position;
|
//var position = fs.Position;
|
||||||
//_logger.Debug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
|
//_logger.LogDebug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
|
||||||
|
|
||||||
if (bytesRead == 0)
|
if (bytesRead == 0)
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ using MediaBrowser.Model.Drawing;
|
|||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
@ -14,6 +13,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback
|
namespace MediaBrowser.Api.Playback
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error disposing log stream", ex);
|
_logger.LogError("Error disposing log stream", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogFileStream = null;
|
LogFileStream = null;
|
||||||
@ -179,7 +179,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error disposing TranscodingThrottler", ex);
|
_logger.LogError("Error disposing TranscodingThrottler", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
TranscodingThrottler = null;
|
TranscodingThrottler = null;
|
||||||
@ -196,7 +196,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error closing media source", ex);
|
_logger.LogError("Error closing media source", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using System;
|
using System;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Threading;
|
using MediaBrowser.Model.Threading;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback
|
namespace MediaBrowser.Api.Playback
|
||||||
{
|
{
|
||||||
@ -60,7 +60,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
{
|
{
|
||||||
if (!_isPaused)
|
if (!_isPaused)
|
||||||
{
|
{
|
||||||
_logger.Debug("Sending pause command to ffmpeg");
|
_logger.LogDebug("Sending pause command to ffmpeg");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -69,7 +69,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error pausing transcoding", ex);
|
_logger.LogError("Error pausing transcoding", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
{
|
{
|
||||||
if (_isPaused)
|
if (_isPaused)
|
||||||
{
|
{
|
||||||
_logger.Debug("Sending unpause command to ffmpeg");
|
_logger.LogDebug("Sending unpause command to ffmpeg");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error unpausing transcoding", ex);
|
_logger.LogError("Error unpausing transcoding", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,11 +110,11 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
if (gap < targetGap)
|
if (gap < targetGap)
|
||||||
{
|
{
|
||||||
//_logger.Debug("Not throttling transcoder gap {0} target gap {1}", gap, targetGap);
|
//_logger.LogDebug("Not throttling transcoder gap {0} target gap {1}", gap, targetGap);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//_logger.Debug("Throttling transcoder gap {0} target gap {1}", gap, targetGap);
|
//_logger.LogDebug("Throttling transcoder gap {0} target gap {1}", gap, targetGap);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,21 +135,21 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
if (gap < targetGap)
|
if (gap < targetGap)
|
||||||
{
|
{
|
||||||
//_logger.Debug("Not throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded);
|
//_logger.LogDebug("Not throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//_logger.Debug("Throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded);
|
//_logger.LogDebug("Throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
//_logger.Error("Error getting output size");
|
//_logger.LogError("Error getting output size");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//_logger.Debug("No throttle data for " + path);
|
//_logger.LogDebug("No throttle data for " + path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,10 +8,10 @@ using MediaBrowser.Model.Dlna;
|
|||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
using MediaBrowser.Model.Session;
|
using MediaBrowser.Model.Session;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.MediaEncoding
|
namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Extension.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.MediaEncoding
|
namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Controller.Session;
|
using MediaBrowser.Controller.Session;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using MediaBrowser.Model.Diagnostics;
|
using MediaBrowser.Model.Diagnostics;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ using MediaBrowser.Model.Configuration;
|
|||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -105,7 +105,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
OnTranscodeBeginning(encodingJob);
|
OnTranscodeBeginning(encodingJob);
|
||||||
|
|
||||||
var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
|
var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
|
||||||
Logger.Info(commandLineLogMessage);
|
Logger.LogInformation(commandLineLogMessage);
|
||||||
|
|
||||||
var logFilePath = Path.Combine(ConfigurationManager.CommonApplicationPaths.LogDirectoryPath, "transcode-" + Guid.NewGuid() + ".txt");
|
var logFilePath = Path.Combine(ConfigurationManager.CommonApplicationPaths.LogDirectoryPath, "transcode-" + Guid.NewGuid() + ".txt");
|
||||||
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(logFilePath));
|
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(logFilePath));
|
||||||
@ -124,7 +124,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error starting ffmpeg", ex);
|
Logger.LogError("Error starting ffmpeg", ex);
|
||||||
|
|
||||||
OnTranscodeFailedToStart(encodingJob.OutputFilePath, encodingJob);
|
OnTranscodeFailedToStart(encodingJob.OutputFilePath, encodingJob);
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
private void Cancel(IProcess process, EncodingJob job)
|
private void Cancel(IProcess process, EncodingJob job)
|
||||||
{
|
{
|
||||||
Logger.Info("Killing ffmpeg process for {0}", job.OutputFilePath);
|
Logger.LogInformation("Killing ffmpeg process for {0}", job.OutputFilePath);
|
||||||
|
|
||||||
//process.Kill();
|
//process.Kill();
|
||||||
process.StandardInput.WriteLine("q");
|
process.StandardInput.WriteLine("q");
|
||||||
@ -167,7 +167,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
{
|
{
|
||||||
job.HasExited = true;
|
job.HasExited = true;
|
||||||
|
|
||||||
Logger.Debug("Disposing stream resources");
|
Logger.LogDebug("Disposing stream resources");
|
||||||
job.Dispose();
|
job.Dispose();
|
||||||
|
|
||||||
var isSuccesful = false;
|
var isSuccesful = false;
|
||||||
@ -175,13 +175,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var exitCode = process.ExitCode;
|
var exitCode = process.ExitCode;
|
||||||
Logger.Info("FFMpeg exited with code {0}", exitCode);
|
Logger.LogInformation("FFMpeg exited with code {0}", exitCode);
|
||||||
|
|
||||||
isSuccesful = exitCode == 0;
|
isSuccesful = exitCode == 0;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Logger.Error("FFMpeg exited with an error.");
|
Logger.LogError("FFMpeg exited with an error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSuccesful && !job.IsCancelled)
|
if (isSuccesful && !job.IsCancelled)
|
||||||
@ -231,7 +231,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
//}
|
//}
|
||||||
//catch (Exception ex)
|
//catch (Exception ex)
|
||||||
//{
|
//{
|
||||||
// Logger.ErrorException("Error disposing ffmpeg.", ex);
|
// Logger.LogError("Error disposing ffmpeg.", ex);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using MediaBrowser.Model.Diagnostics;
|
using MediaBrowser.Model.Diagnostics;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Encoder
|
namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
{
|
{
|
||||||
@ -20,12 +20,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
public Tuple<List<string>, List<string>> Validate(string encoderPath)
|
public Tuple<List<string>, List<string>> Validate(string encoderPath)
|
||||||
{
|
{
|
||||||
_logger.Info("Validating media encoder at {0}", encoderPath);
|
_logger.LogInformation("Validating media encoder at {0}", encoderPath);
|
||||||
|
|
||||||
var decoders = GetDecoders(encoderPath);
|
var decoders = GetDecoders(encoderPath);
|
||||||
var encoders = GetEncoders(encoderPath);
|
var encoders = GetEncoders(encoderPath);
|
||||||
|
|
||||||
_logger.Info("Encoder validation complete");
|
_logger.LogInformation("Encoder validation complete");
|
||||||
|
|
||||||
return new Tuple<List<string>, List<string>>(decoders, encoders);
|
return new Tuple<List<string>, List<string>>(decoders, encoders);
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
{
|
{
|
||||||
if (logOutput)
|
if (logOutput)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error validating encoder", ex);
|
_logger.LogError("Error validating encoder", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Info("ffmpeg info: {0}", output);
|
_logger.LogInformation("ffmpeg info: {0}", output);
|
||||||
|
|
||||||
if (output.IndexOf("Libav developers", StringComparison.OrdinalIgnoreCase) != -1)
|
if (output.IndexOf("Libav developers", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception )
|
catch (Exception )
|
||||||
{
|
{
|
||||||
//_logger.ErrorException("Error detecting available decoders", ex);
|
//_logger.LogError("Error detecting available decoders", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
var found = new List<string>();
|
var found = new List<string>();
|
||||||
@ -107,7 +107,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
if (output.IndexOf(srch, StringComparison.OrdinalIgnoreCase) != -1)
|
if (output.IndexOf(srch, StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
_logger.Info("Decoder available: " + codec);
|
_logger.LogInformation("Decoder available: " + codec);
|
||||||
found.Add(codec);
|
found.Add(codec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
{
|
{
|
||||||
if (index < required.Length - 1)
|
if (index < required.Length - 1)
|
||||||
{
|
{
|
||||||
_logger.Info("Encoder available: " + codec);
|
_logger.LogInformation("Encoder available: " + codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
found.Add(codec);
|
found.Add(codec);
|
||||||
@ -187,7 +187,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
RedirectStandardOutput = true
|
RedirectStandardOutput = true
|
||||||
});
|
});
|
||||||
|
|
||||||
_logger.Info("Running {0} {1}", path, arguments);
|
_logger.LogInformation("Running {0} {1}", path, arguments);
|
||||||
|
|
||||||
using (process)
|
using (process)
|
||||||
{
|
{
|
||||||
@ -199,7 +199,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
_logger.Info("Killing process {0} {1}", path, arguments);
|
_logger.LogInformation("Killing process {0} {1}", path, arguments);
|
||||||
|
|
||||||
// Hate having to do this
|
// Hate having to do this
|
||||||
try
|
try
|
||||||
@ -208,7 +208,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex1)
|
catch (Exception ex1)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error killing process", ex1);
|
_logger.LogError("Error killing process", ex1);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
|
@ -5,7 +5,6 @@ using MediaBrowser.Model.Drawing;
|
|||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
@ -14,6 +13,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Encoder
|
namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
{
|
{
|
||||||
@ -81,7 +81,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error disposing log stream", ex);
|
_logger.LogError("Error disposing log stream", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogFileStream = null;
|
LogFileStream = null;
|
||||||
@ -98,7 +98,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error closing media source", ex);
|
_logger.LogError("Error closing media source", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ using MediaBrowser.Model.Configuration;
|
|||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -10,7 +10,7 @@ using MediaBrowser.Common.Net;
|
|||||||
using MediaBrowser.Common.Progress;
|
using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Encoder
|
namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
@ -72,12 +72,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
catch (HttpException ex)
|
catch (HttpException ex)
|
||||||
{
|
{
|
||||||
// Don't let the server crash because of this
|
// Don't let the server crash because of this
|
||||||
_logger.ErrorException("Error downloading ffmpeg font files", ex);
|
_logger.LogError("Error downloading ffmpeg font files", ex);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Don't let the server crash because of this
|
// Don't let the server crash because of this
|
||||||
_logger.ErrorException("Error writing ffmpeg font files", ex);
|
_logger.LogError("Error writing ffmpeg font files", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// Log this, but don't let it fail the operation
|
// Log this, but don't let it fail the operation
|
||||||
_logger.ErrorException("Error copying file", ex);
|
_logger.LogError("Error copying file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// The core can function without the font file, so handle this
|
// The core can function without the font file, so handle this
|
||||||
_logger.ErrorException("Failed to download ffmpeg font file from {0}", ex, url);
|
_logger.LogError("Failed to download ffmpeg font file from {0}", ex, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,12 +145,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// Log this, but don't let it fail the operation
|
// Log this, but don't let it fail the operation
|
||||||
_logger.ErrorException("Error deleting temp file {0}", ex, tempFile);
|
_logger.LogError("Error deleting temp file {0}", ex, tempFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void Extract7zArchive(string archivePath, string targetPath)
|
private void Extract7zArchive(string archivePath, string targetPath)
|
||||||
{
|
{
|
||||||
_logger.Info("Extracting {0} to {1}", archivePath, targetPath);
|
_logger.LogInformation("Extracting {0} to {1}", archivePath, targetPath);
|
||||||
|
|
||||||
_zipClient.ExtractAllFrom7z(archivePath, targetPath, true);
|
_zipClient.ExtractAllFrom7z(archivePath, targetPath, true);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ using MediaBrowser.Model.Dlna;
|
|||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using System;
|
using System;
|
||||||
@ -25,6 +24,7 @@ using MediaBrowser.Common.Extensions;
|
|||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Model.Diagnostics;
|
using MediaBrowser.Model.Diagnostics;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Encoder
|
namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
{
|
{
|
||||||
@ -117,7 +117,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error setting FFREPORT environment variable", ex);
|
_logger.LogError("Error setting FFREPORT environment variable", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
//_logger.ErrorException("Error setting FFREPORT environment variable", ex);
|
//_logger.LogError("Error setting FFREPORT environment variable", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error setting FFREPORT environment variable", ex);
|
_logger.LogError("Error setting FFREPORT environment variable", ex);
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -153,7 +153,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error setting FFREPORT environment variable", ex);
|
_logger.LogError("Error setting FFREPORT environment variable", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Info("Attempting to update encoder path to {0}. pathType: {1}", path ?? string.Empty, pathType ?? string.Empty);
|
_logger.LogInformation("Attempting to update encoder path to {0}. pathType: {1}", path ?? string.Empty, pathType ?? string.Empty);
|
||||||
|
|
||||||
Tuple<string, string> newPaths;
|
Tuple<string, string> newPaths;
|
||||||
|
|
||||||
@ -414,8 +414,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
private void LogPaths()
|
private void LogPaths()
|
||||||
{
|
{
|
||||||
_logger.Info("FFMpeg: {0}", FFMpegPath ?? "not found");
|
_logger.LogInformation("FFMpeg: {0}", FFMpegPath ?? "not found");
|
||||||
_logger.Info("FFProbe: {0}", FFProbePath ?? "not found");
|
_logger.LogInformation("FFProbe: {0}", FFProbePath ?? "not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
private EncodingOptions GetEncodingOptions()
|
private EncodingOptions GetEncodingOptions()
|
||||||
@ -557,11 +557,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
if (forceEnableLogging)
|
if (forceEnableLogging)
|
||||||
{
|
{
|
||||||
_logger.Info("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.LogInformation("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.LogDebug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var processWrapper = new ProcessWrapper(process, this, _logger))
|
using (var processWrapper = new ProcessWrapper(process, this, _logger))
|
||||||
@ -651,7 +651,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
_logger.Error("I-frame image extraction failed, will attempt standard way. Input: {0}", inputArgument);
|
_logger.LogError("I-frame image extraction failed, will attempt standard way. Input: {0}", inputArgument);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,7 +755,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
ErrorDialog = false
|
ErrorDialog = false
|
||||||
});
|
});
|
||||||
|
|
||||||
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.LogDebug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
using (var processWrapper = new ProcessWrapper(process, this, _logger))
|
using (var processWrapper = new ProcessWrapper(process, this, _logger))
|
||||||
{
|
{
|
||||||
@ -783,7 +783,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
{
|
{
|
||||||
var msg = string.Format("ffmpeg image extraction failed for {0}", inputPath);
|
var msg = string.Format("ffmpeg image extraction failed for {0}", inputPath);
|
||||||
|
|
||||||
_logger.Error(msg);
|
_logger.LogError(msg);
|
||||||
|
|
||||||
throw new Exception(msg);
|
throw new Exception(msg);
|
||||||
}
|
}
|
||||||
@ -877,7 +877,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
ErrorDialog = false
|
ErrorDialog = false
|
||||||
});
|
});
|
||||||
|
|
||||||
_logger.Info(process.StartInfo.FileName + " " + process.StartInfo.Arguments);
|
_logger.LogInformation(process.StartInfo.FileName + " " + process.StartInfo.Arguments);
|
||||||
|
|
||||||
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -929,7 +929,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
{
|
{
|
||||||
var msg = string.Format("ffmpeg image extraction failed for {0}", inputArgument);
|
var msg = string.Format("ffmpeg image extraction failed for {0}", inputArgument);
|
||||||
|
|
||||||
_logger.Error(msg);
|
_logger.LogError(msg);
|
||||||
|
|
||||||
throw new Exception(msg);
|
throw new Exception(msg);
|
||||||
}
|
}
|
||||||
@ -961,7 +961,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
IProgress<double> progress,
|
IProgress<double> progress,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_logger.Error("EncodeVideo");
|
_logger.LogError("EncodeVideo");
|
||||||
var job = await new VideoEncoder(this,
|
var job = await new VideoEncoder(this,
|
||||||
_logger,
|
_logger,
|
||||||
ConfigurationManager,
|
ConfigurationManager,
|
||||||
@ -999,18 +999,18 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error("Error in WaitForExit", ex);
|
_logger.LogError("Error in WaitForExit", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Info("Killing ffmpeg process");
|
_logger.LogInformation("Killing ffmpeg process");
|
||||||
|
|
||||||
process.Process.Kill();
|
process.Process.Kill();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error killing process", ex);
|
_logger.LogError("Error killing process", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ using MediaBrowser.Controller.MediaEncoding;
|
|||||||
using MediaBrowser.Controller.Session;
|
using MediaBrowser.Controller.Session;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -63,4 +63,4 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ using MediaBrowser.Model.IO;
|
|||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Probing
|
namespace MediaBrowser.MediaEncoding.Probing
|
||||||
@ -1351,11 +1351,11 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
{
|
{
|
||||||
video.Timestamp = GetMpegTimestamp(video.Path);
|
video.Timestamp = GetMpegTimestamp(video.Path);
|
||||||
|
|
||||||
_logger.Debug("Video has {0} timestamp", video.Timestamp);
|
_logger.LogDebug("Video has {0} timestamp", video.Timestamp);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error extracting timestamp info from {0}", ex, video.Path);
|
_logger.LogError("Error extracting timestamp info from {0}", ex, video.Path);
|
||||||
video.Timestamp = null;
|
video.Timestamp = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ using MediaBrowser.Controller.Subtitles;
|
|||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OpenSubtitlesHandler;
|
using OpenSubtitlesHandler;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
@ -34,9 +34,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
private readonly IJsonSerializer _json;
|
private readonly IJsonSerializer _json;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
|
|
||||||
public OpenSubtitleDownloader(ILogManager logManager, IHttpClient httpClient, IServerConfigurationManager config, IEncryptionManager encryption, IJsonSerializer json, IFileSystem fileSystem)
|
public OpenSubtitleDownloader(ILoggerFactory loggerFactory, IHttpClient httpClient, IServerConfigurationManager config, IEncryptionManager encryption, IJsonSerializer json, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logManager.GetLogger(GetType().Name);
|
_logger = loggerFactory.CreateLogger(GetType().Name);
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_config = config;
|
_config = config;
|
||||||
_encryption = encryption;
|
_encryption = encryption;
|
||||||
@ -208,7 +208,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
var result = OpenSubtitles.GetSubLanguages("en");
|
var result = OpenSubtitles.GetSubLanguages("en");
|
||||||
if (!(result is MethodResponseGetSubLanguages))
|
if (!(result is MethodResponseGetSubLanguages))
|
||||||
{
|
{
|
||||||
_logger.Error("Invalid response type");
|
_logger.LogError("Invalid response type");
|
||||||
return new List<NameIdPair>();
|
return new List<NameIdPair>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,19 +243,19 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
case VideoContentType.Episode:
|
case VideoContentType.Episode:
|
||||||
if (!request.IndexNumber.HasValue || !request.ParentIndexNumber.HasValue || string.IsNullOrEmpty(request.SeriesName))
|
if (!request.IndexNumber.HasValue || !request.ParentIndexNumber.HasValue || string.IsNullOrEmpty(request.SeriesName))
|
||||||
{
|
{
|
||||||
_logger.Debug("Episode information missing");
|
_logger.LogDebug("Episode information missing");
|
||||||
return new List<RemoteSubtitleInfo>();
|
return new List<RemoteSubtitleInfo>();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VideoContentType.Movie:
|
case VideoContentType.Movie:
|
||||||
if (string.IsNullOrEmpty(request.Name))
|
if (string.IsNullOrEmpty(request.Name))
|
||||||
{
|
{
|
||||||
_logger.Debug("Movie name missing");
|
_logger.LogDebug("Movie name missing");
|
||||||
return new List<RemoteSubtitleInfo>();
|
return new List<RemoteSubtitleInfo>();
|
||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(imdbIdText) || !long.TryParse(imdbIdText.TrimStart('t'), NumberStyles.Any, _usCulture, out imdbId))
|
if (string.IsNullOrWhiteSpace(imdbIdText) || !long.TryParse(imdbIdText.TrimStart('t'), NumberStyles.Any, _usCulture, out imdbId))
|
||||||
{
|
{
|
||||||
_logger.Debug("Imdb id missing");
|
_logger.LogDebug("Imdb id missing");
|
||||||
return new List<RemoteSubtitleInfo>();
|
return new List<RemoteSubtitleInfo>();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -263,7 +263,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(request.MediaPath))
|
if (string.IsNullOrEmpty(request.MediaPath))
|
||||||
{
|
{
|
||||||
_logger.Debug("Path Missing");
|
_logger.LogDebug("Path Missing");
|
||||||
return new List<RemoteSubtitleInfo>();
|
return new List<RemoteSubtitleInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
var result = await OpenSubtitles.SearchSubtitlesAsync(parms.ToArray(), cancellationToken).ConfigureAwait(false);
|
var result = await OpenSubtitles.SearchSubtitlesAsync(parms.ToArray(), cancellationToken).ConfigureAwait(false);
|
||||||
if (!(result is MethodResponseSubtitleSearch))
|
if (!(result is MethodResponseSubtitleSearch))
|
||||||
{
|
{
|
||||||
_logger.Error("Invalid response type");
|
_logger.LogError("Invalid response type");
|
||||||
return new List<RemoteSubtitleInfo>();
|
return new List<RemoteSubtitleInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using MediaBrowser.Model.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
@ -50,7 +50,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
{
|
{
|
||||||
// This occurs when subtitle text has an empty line as part of the text.
|
// This occurs when subtitle text has an empty line as part of the text.
|
||||||
// Need to adjust the break statement below to resolve this.
|
// Need to adjust the break statement below to resolve this.
|
||||||
_logger.Warn("Unrecognized line in srt: {0}", line);
|
_logger.LogWarning("Unrecognized line in srt: {0}", line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
subEvent.StartPositionTicks = GetTicks(time[0]);
|
subEvent.StartPositionTicks = GetTicks(time[0]);
|
||||||
|
@ -5,7 +5,7 @@ using MediaBrowser.Controller.Entities;
|
|||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using System;
|
using System;
|
||||||
@ -190,7 +190,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
var bytes = await GetBytes(path, protocol, cancellationToken).ConfigureAwait(false);
|
var bytes = await GetBytes(path, protocol, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, bytes.Length, language, true);
|
var charset = _textEncoding.GetDetectedEncodingName(bytes, bytes.Length, language, true);
|
||||||
_logger.Debug("charset {0} detected for {1}", charset ?? "null", path);
|
_logger.LogDebug("charset {0} detected for {1}", charset ?? "null", path);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(charset))
|
if (!string.IsNullOrEmpty(charset))
|
||||||
{
|
{
|
||||||
@ -423,7 +423,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
ErrorDialog = false
|
ErrorDialog = false
|
||||||
});
|
});
|
||||||
|
|
||||||
_logger.Info("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.LogInformation("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -431,7 +431,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error starting ffmpeg", ex);
|
_logger.LogError("Error starting ffmpeg", ex);
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@ -442,13 +442,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Info("Killing ffmpeg subtitle conversion process");
|
_logger.LogInformation("Killing ffmpeg subtitle conversion process");
|
||||||
|
|
||||||
process.Kill();
|
process.Kill();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error killing subtitle conversion process", ex);
|
_logger.LogError("Error killing subtitle conversion process", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,12 +466,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Info("Deleting converted subtitle due to failure: ", outputPath);
|
_logger.LogInformation("Deleting converted subtitle due to failure: ", outputPath);
|
||||||
_fileSystem.DeleteFile(outputPath);
|
_fileSystem.DeleteFile(outputPath);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error deleting converted subtitle {0}", ex, outputPath);
|
_logger.LogError("Error deleting converted subtitle {0}", ex, outputPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,13 +484,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
{
|
{
|
||||||
var msg = string.Format("ffmpeg subtitle conversion failed for {0}", inputPath);
|
var msg = string.Format("ffmpeg subtitle conversion failed for {0}", inputPath);
|
||||||
|
|
||||||
_logger.Error(msg);
|
_logger.LogError(msg);
|
||||||
|
|
||||||
throw new Exception(msg);
|
throw new Exception(msg);
|
||||||
}
|
}
|
||||||
await SetAssFont(outputPath).ConfigureAwait(false);
|
await SetAssFont(outputPath).ConfigureAwait(false);
|
||||||
|
|
||||||
_logger.Info("ffmpeg subtitle conversion succeeded for {0}", inputPath);
|
_logger.LogInformation("ffmpeg subtitle conversion succeeded for {0}", inputPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -553,7 +553,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
ErrorDialog = false
|
ErrorDialog = false
|
||||||
});
|
});
|
||||||
|
|
||||||
_logger.Info("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.LogInformation("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -561,7 +561,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error starting ffmpeg", ex);
|
_logger.LogError("Error starting ffmpeg", ex);
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@ -572,13 +572,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Info("Killing ffmpeg subtitle extraction process");
|
_logger.LogInformation("Killing ffmpeg subtitle extraction process");
|
||||||
|
|
||||||
process.Kill();
|
process.Kill();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error killing subtitle extraction process", ex);
|
_logger.LogError("Error killing subtitle extraction process", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Info("Deleting extracted subtitle due to failure: {0}", outputPath);
|
_logger.LogInformation("Deleting extracted subtitle due to failure: {0}", outputPath);
|
||||||
_fileSystem.DeleteFile(outputPath);
|
_fileSystem.DeleteFile(outputPath);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
@ -603,7 +603,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error deleting extracted subtitle {0}", ex, outputPath);
|
_logger.LogError("Error deleting extracted subtitle {0}", ex, outputPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!_fileSystem.FileExists(outputPath))
|
else if (!_fileSystem.FileExists(outputPath))
|
||||||
@ -615,7 +615,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
{
|
{
|
||||||
var msg = string.Format("ffmpeg subtitle extraction failed for {0} to {1}", inputPath, outputPath);
|
var msg = string.Format("ffmpeg subtitle extraction failed for {0} to {1}", inputPath, outputPath);
|
||||||
|
|
||||||
_logger.Error(msg);
|
_logger.LogError(msg);
|
||||||
|
|
||||||
throw new Exception(msg);
|
throw new Exception(msg);
|
||||||
}
|
}
|
||||||
@ -623,7 +623,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
{
|
{
|
||||||
var msg = string.Format("ffmpeg subtitle extraction completed for {0} to {1}", inputPath, outputPath);
|
var msg = string.Format("ffmpeg subtitle extraction completed for {0} to {1}", inputPath, outputPath);
|
||||||
|
|
||||||
_logger.Info(msg);
|
_logger.LogInformation(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(outputCodec, "ass", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(outputCodec, "ass", StringComparison.OrdinalIgnoreCase))
|
||||||
@ -639,7 +639,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task SetAssFont(string file)
|
private async Task SetAssFont(string file)
|
||||||
{
|
{
|
||||||
_logger.Info("Setting ass font within {0}", file);
|
_logger.LogInformation("Setting ass font within {0}", file);
|
||||||
|
|
||||||
string text;
|
string text;
|
||||||
Encoding encoding;
|
Encoding encoding;
|
||||||
@ -659,11 +659,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
if (!string.Equals(text, newText))
|
if (!string.Equals(text, newText))
|
||||||
{
|
{
|
||||||
using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||||
|
using (var writer = new StreamWriter(fileStream, encoding))
|
||||||
{
|
{
|
||||||
using (var writer = new StreamWriter(fileStream, encoding))
|
writer.Write(newText);
|
||||||
{
|
|
||||||
writer.Write(newText);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -698,7 +696,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
|
|
||||||
var charset = _textEncoding.GetDetectedEncodingName(bytes, bytes.Length, language, true);
|
var charset = _textEncoding.GetDetectedEncodingName(bytes, bytes.Length, language, true);
|
||||||
|
|
||||||
_logger.Debug("charset {0} detected for {1}", charset ?? "null", path);
|
_logger.LogDebug("charset {0} detected for {1}", charset ?? "null", path);
|
||||||
|
|
||||||
return charset;
|
return charset;
|
||||||
}
|
}
|
||||||
@ -730,4 +728,4 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user