Fixed: Formatting of audio channels from media info for some files

pull/2119/merge
Mark McDowall 7 years ago
parent 19a4d3536b
commit de5d120aac
No known key found for this signature in database
GPG Key ID: D4CEFA9A718052E0

@ -104,6 +104,20 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(7.1m);
}
[Test]
public void should_skip_empty_groups_in_AudioChannelPositions()
{
var mediaInfoModel = new MediaInfoModel
{
AudioChannels = 2,
AudioChannelPositions = " / 2/0/0.0",
AudioChannelPositionsText = null,
SchemaRevision = 3
};
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(2);
}
[Test]
public void should_sum_first_series_of_numbers_from_AudioChannelPositions()
{

@ -36,7 +36,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
}
return audioChannelPositions.Replace("Object Based / ", "")
.Split(new string[] { " / " }, StringSplitOptions.None)
.Split(new string[] { " / " }, StringSplitOptions.RemoveEmptyEntries)
.First()
.Split('/')
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));

Loading…
Cancel
Save