Fixed: MediaInfo.AudioChannels for some eac3 and mp3 files
This commit is contained in:
parent
222ed1eb4b
commit
5fcd65ef57
|
@ -20,6 +20,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
|||
public int AudioStreamCount { get; set; }
|
||||
public int AudioChannels { get; set; }
|
||||
public string AudioChannelPositions { get; set; }
|
||||
public string AudioChannelPositionsText { get; set; }
|
||||
public string AudioProfile { get; set; }
|
||||
public decimal VideoFps { get; set; }
|
||||
public string AudioLanguages { get; set; }
|
||||
|
@ -34,9 +35,19 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
|||
{
|
||||
if (AudioChannelPositions.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (AudioChannelPositionsText.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (SchemaRevision >= 3)
|
||||
{
|
||||
return AudioChannels;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return AudioChannelPositionsText.ContainsIgnoreCase("LFE") ? AudioChannels - 1 + 0.1m : AudioChannels;
|
||||
}
|
||||
|
||||
return AudioChannelPositions.Split('/').Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
|||
private readonly IConfigService _configService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
private const int CURRENT_MEDIA_INFO_SCHEMA_REVISION = 2;
|
||||
private const int CURRENT_MEDIA_INFO_SCHEMA_REVISION = 3;
|
||||
|
||||
public UpdateMediaInfoService(IDiskProvider diskProvider,
|
||||
IMediaFileService mediaFileService,
|
||||
|
|
|
@ -30,7 +30,9 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
|||
public MediaInfoModel GetMediaInfo(string filename)
|
||||
{
|
||||
if (!_diskProvider.FileExists(filename))
|
||||
{
|
||||
throw new FileNotFoundException("Media file does not exist: " + filename);
|
||||
}
|
||||
|
||||
MediaInfo mediaInfo = null;
|
||||
|
||||
|
@ -124,6 +126,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
|||
}
|
||||
|
||||
var audioChannelPositions = mediaInfo.Get(StreamKind.Audio, 0, "ChannelPositions/String2");
|
||||
var audioChannelPositionsText = mediaInfo.Get(StreamKind.Audio, 0, "ChannelPositions");
|
||||
|
||||
string audioLanguages = mediaInfo.Get(StreamKind.General, 0, "Audio_Language_List");
|
||||
string audioProfile = mediaInfo.Get(StreamKind.Audio, 0, "Format_Profile");
|
||||
|
@ -149,6 +152,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
|||
AudioStreamCount = streamCount,
|
||||
AudioChannels = audioChannels,
|
||||
AudioChannelPositions = audioChannelPositions,
|
||||
AudioChannelPositionsText = audioChannelPositionsText,
|
||||
AudioProfile = audioProfile.Trim(),
|
||||
VideoFps = videoFrameRate,
|
||||
AudioLanguages = audioLanguages,
|
||||
|
|
Loading…
Reference in New Issue