Fixed: Formatting of audio channels from media info for some files
This commit is contained in:
parent
19a4d3536b
commit
de5d120aac
|
@ -104,6 +104,20 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
|
||||||
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(7.1m);
|
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]
|
[Test]
|
||||||
public void should_sum_first_series_of_numbers_from_AudioChannelPositions()
|
public void should_sum_first_series_of_numbers_from_AudioChannelPositions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
return audioChannelPositions.Replace("Object Based / ", "")
|
return audioChannelPositions.Replace("Object Based / ", "")
|
||||||
.Split(new string[] { " / " }, StringSplitOptions.None)
|
.Split(new string[] { " / " }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
.First()
|
.First()
|
||||||
.Split('/')
|
.Split('/')
|
||||||
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
|
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
|
||||||
|
|
Loading…
Reference in New Issue