New: Log Sentry Warn if AudioChannelPositions Error

This commit is contained in:
Qstick 2019-09-26 21:31:46 -04:00
parent 923db77751
commit ae9c2dd830
2 changed files with 21 additions and 2 deletions

View File

@ -173,5 +173,21 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(5.1m);
}
[Test]
public void should_warn_unknown_AudioChannelPostions()
{
var mediaInfoModel = new MediaInfoModel
{
AudioChannels = 2,
AudioChannelPositions = "3/2/0.2.1",
AudioChannelPositionsText = null,
SchemaRevision = 3
};
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(2m);
ExceptionVerification.ExpectedWarns(1);
}
}
}

View File

@ -461,9 +461,12 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
}
}
catch (Exception e)
catch (Exception)
{
Logger.Warn(e, "Unable to format audio channels using 'AudioChannelPositions', with a value of: '{0}'", audioChannelPositions);
Logger.Warn()
.Message("Unable to format audio channels using 'AudioChannelPositions', with a value of: '{0}'", audioChannelPositions)
.WriteSentryWarn("UnknownAudioChannelFormat", mediaInfo.AudioChannels.ToString(), mediaInfo.AudioFormat, audioChannelPositions, mediaInfo.AudioChannelPositionsText)
.Write();
}
return null;