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:
parent
7b04e11c54
commit
314a12ffb5
@ -458,13 +458,37 @@ public static string FormatVideoCodecLegacy(MediaInfoModel mediaInfo, string sce
|
|||||||
|
|
||||||
if (audioChannelPositions.Contains("/"))
|
if (audioChannelPositions.Contains("/"))
|
||||||
{
|
{
|
||||||
return Regex.Replace(audioChannelPositions, @"^\d+\sobjects", "",
|
var channelStringList = Regex.Replace(audioChannelPositions,
|
||||||
|
@"^\d+\sobjects",
|
||||||
|
"",
|
||||||
RegexOptions.Compiled | RegexOptions.IgnoreCase)
|
RegexOptions.Compiled | RegexOptions.IgnoreCase)
|
||||||
.Replace("Object Based / ", "")
|
.Replace("Object Based / ", "")
|
||||||
.Split(new string[] {" / "}, StringSplitOptions.RemoveEmptyEntries)
|
.Split(new string[] {" / "}, StringSplitOptions.RemoveEmptyEntries)
|
||||||
.FirstOrDefault()
|
.FirstOrDefault()
|
||||||
?.Split('/')
|
?.Split('/');
|
||||||
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
|
|
||||||
|
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)
|
catch (Exception e)
|
||||||
|
Loading…
Reference in New Issue
Block a user