Add more debug logging

This commit is contained in:
ConfusedPolarBear 2022-07-25 00:27:24 -05:00
parent 790117bc37
commit c20864e954
3 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
@ -14,6 +13,8 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper;
/// </summary>
public static class Chromaprint
{
private static bool _loggedVersionInformation;
/// <summary>
/// Gets or sets the logger.
/// </summary>
@ -27,6 +28,14 @@ public static class Chromaprint
{
try
{
// Log the output of "ffmpeg -version" at the first call to this function
if (!_loggedVersionInformation)
{
_loggedVersionInformation = true;
var version = Encoding.UTF8.GetString(GetOutput("-version", 2000));
Logger?.LogDebug("ffmpeg version information: {Version}", version);
}
// First, validate that the installed version of ffmpeg supports chromaprint at all.
var muxers = Encoding.UTF8.GetString(GetOutput("-muxers", 2000));
Logger?.LogTrace("ffmpeg muxers: {Muxers}", muxers);
@ -71,7 +80,7 @@ public static class Chromaprint
// Try to load this episode from cache before running ffmpeg.
if (LoadCachedFingerprint(episode, out uint[] cachedFingerprint))
{
Logger?.LogDebug("Fingerprint cache hit on {File}", episode.Path);
Logger?.LogTrace("Fingerprint cache hit on {File}", episode.Path);
return cachedFingerprint;
}

View File

@ -67,7 +67,10 @@ public class Entrypoint : IServerEntryPoint
_logger.LogError("Unable to run startup enqueue: {Exception}", ex);
}
_logger.LogDebug("Total enqueued seasons: {Count}", Plugin.Instance!.AnalysisQueue.Count);
_logger.LogDebug(
"Total enqueued seasons: {Count} ({Episodes} episodes)",
Plugin.Instance!.AnalysisQueue.Count,
Plugin.Instance!.TotalQueued);
return Task.CompletedTask;
}

View File

@ -56,13 +56,14 @@ public class QueueManager
{
if (folder.CollectionType != CollectionTypeOptions.TvShows)
{
_logger.LogDebug("Not analyzing library \"{Name}\": not a TV show library", folder.Name);
continue;
}
// If libraries have been selected for analysis, ensure this library was selected.
if (selectedLibraries.Count > 0 && !selectedLibraries.Contains(folder.Name))
{
_logger.LogDebug("Not analyzing library \"{Name}\"", folder.Name);
_logger.LogDebug("Not analyzing library \"{Name}\": not selected by user", folder.Name);
continue;
}