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

This commit is contained in:
Mark McDowall 2017-08-25 23:47:52 -07:00
parent 19a4d3536b
commit de5d120aac
No known key found for this signature in database
GPG Key ID: D4CEFA9A718052E0
2 changed files with 15 additions and 1 deletions

View File

@ -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()
{

View File

@ -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));