1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Format Errors from AudioChannel formatter

This commit is contained in:
Qstick 2020-08-16 23:43:21 -04:00 committed by Mark McDowall
parent 8b8deb5646
commit 078898af91
2 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,5 @@
using System.Globalization;
using System.Threading;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.MediaFiles.MediaInfo; using NzbDrone.Core.MediaFiles.MediaInfo;
@ -126,6 +128,22 @@ public void should_format_8_channel_blank_as_71_if_dtsx()
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(7.1m); MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(7.1m);
} }
[Test]
public void should_ignore_culture_on_channel_summary()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
var mediaInfoModel = new MediaInfoModel
{
AudioChannelsContainer = 2,
AudioChannelPositions = "3/2/0.1",
AudioChannelPositionsTextContainer = null,
SchemaRevision = 3
};
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(5.1m);
}
[Test] [Test]
public void should_handle_AudioChannelPositions_three_digits() public void should_handle_AudioChannelPositions_three_digits()
{ {

View File

@ -480,11 +480,11 @@ public static string FormatVideoCodecLegacy(MediaInfoModel mediaInfo, string sce
if (channelSplit.Count() == 3) if (channelSplit.Count() == 3)
{ {
positions += decimal.Parse(string.Format("{0}.{1}", channelSplit[1], channelSplit[2])); positions += decimal.Parse(string.Format("{0}.{1}", channelSplit[1], channelSplit[2]), CultureInfo.InvariantCulture);
} }
else else
{ {
positions += decimal.Parse(channel); positions += decimal.Parse(channel, CultureInfo.InvariantCulture);
} }
} }