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

Fixed: Handle 3 digit audio channels

This commit is contained in:
Qstick 2019-12-24 01:24:47 -05:00 committed by Mark McDowall
parent 7b04e11c54
commit 314a12ffb5

View File

@ -458,13 +458,37 @@ public static string FormatVideoCodecLegacy(MediaInfoModel mediaInfo, string sce
if (audioChannelPositions.Contains("/"))
{
return Regex.Replace(audioChannelPositions, @"^\d+\sobjects", "",
var channelStringList = Regex.Replace(audioChannelPositions,
@"^\d+\sobjects",
"",
RegexOptions.Compiled | RegexOptions.IgnoreCase)
.Replace("Object Based / ", "")
.Split(new string[] {" / "}, StringSplitOptions.RemoveEmptyEntries)
.FirstOrDefault()
?.Split('/')
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
?.Split('/');
var positions = default(decimal);
if (channelStringList == null)
{
return 0;
}
foreach (var channel in channelStringList)
{
var channelSplit = channel.Split(new string[] { "." }, StringSplitOptions.None);
if (channelSplit.Count() == 3)
{
positions += decimal.Parse(string.Format("{0}.{1}", channelSplit[1], channelSplit[2]));
}
else
{
positions += decimal.Parse(channel);
}
}
return positions;
}
}
catch (Exception e)