New: Log Sentry Warn if AudioChannelPositions Error

pull/2/head
Qstick 5 years ago
parent 923db77751
commit ae9c2dd830

@ -173,5 +173,21 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(5.1m); 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);
}
} }
} }

@ -461,9 +461,12 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture)); .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; return null;

Loading…
Cancel
Save