Fix media info parsing of multiple audio channels. Fixes #315 Fixes #294

Leonardo Galli 8 years ago
parent 1fa736c6d8
commit 7c251157ed

@ -1,6 +1,7 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using Newtonsoft.Json; using Newtonsoft.Json;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
@ -48,11 +49,14 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
return AudioChannelPositionsText.ContainsIgnoreCase("LFE") ? AudioChannels - 1 + 0.1m : AudioChannels; return AudioChannelPositionsText.ContainsIgnoreCase("LFE") ? AudioChannels - 1 + 0.1m : AudioChannels;
} }
decimal channels = 0; return
AudioChannelPositions.Replace(" / ", "$")
.Split('$')
.First()
.Split('/')
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
decimal.TryParse(AudioChannelPositions.Split('/').First(), out channels);
return channels;
} }
} }
} }

Loading…
Cancel
Save