mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Fixed: MediaInfo.AudioChannels for some eac3 and mp3 files
This commit is contained in:
parent
222ed1eb4b
commit
5fcd65ef57
@ -20,6 +20,7 @@ public class MediaInfoModel : IEmbeddedDocument
|
|||||||
public int AudioStreamCount { get; set; }
|
public int AudioStreamCount { get; set; }
|
||||||
public int AudioChannels { get; set; }
|
public int AudioChannels { get; set; }
|
||||||
public string AudioChannelPositions { get; set; }
|
public string AudioChannelPositions { get; set; }
|
||||||
|
public string AudioChannelPositionsText { get; set; }
|
||||||
public string AudioProfile { get; set; }
|
public string AudioProfile { get; set; }
|
||||||
public decimal VideoFps { get; set; }
|
public decimal VideoFps { get; set; }
|
||||||
public string AudioLanguages { get; set; }
|
public string AudioLanguages { get; set; }
|
||||||
@ -34,9 +35,19 @@ public decimal FormattedAudioChannels
|
|||||||
{
|
{
|
||||||
if (AudioChannelPositions.IsNullOrWhiteSpace())
|
if (AudioChannelPositions.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
|
if (AudioChannelPositionsText.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
if (SchemaRevision >= 3)
|
||||||
|
{
|
||||||
|
return AudioChannels;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return AudioChannelPositionsText.ContainsIgnoreCase("LFE") ? AudioChannels - 1 + 0.1m : AudioChannels;
|
||||||
|
}
|
||||||
|
|
||||||
return AudioChannelPositions.Split('/').Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
|
return AudioChannelPositions.Split('/').Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class UpdateMediaInfoService : IHandle<SeriesScannedEvent>
|
|||||||
private readonly IConfigService _configService;
|
private readonly IConfigService _configService;
|
||||||
private readonly Logger _logger;
|
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,
|
public UpdateMediaInfoService(IDiskProvider diskProvider,
|
||||||
IMediaFileService mediaFileService,
|
IMediaFileService mediaFileService,
|
||||||
|
@ -30,7 +30,9 @@ public VideoFileInfoReader(IDiskProvider diskProvider, Logger logger)
|
|||||||
public MediaInfoModel GetMediaInfo(string filename)
|
public MediaInfoModel GetMediaInfo(string filename)
|
||||||
{
|
{
|
||||||
if (!_diskProvider.FileExists(filename))
|
if (!_diskProvider.FileExists(filename))
|
||||||
|
{
|
||||||
throw new FileNotFoundException("Media file does not exist: " + filename);
|
throw new FileNotFoundException("Media file does not exist: " + filename);
|
||||||
|
}
|
||||||
|
|
||||||
MediaInfo mediaInfo = null;
|
MediaInfo mediaInfo = null;
|
||||||
|
|
||||||
@ -124,6 +126,7 @@ public MediaInfoModel GetMediaInfo(string filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var audioChannelPositions = mediaInfo.Get(StreamKind.Audio, 0, "ChannelPositions/String2");
|
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 audioLanguages = mediaInfo.Get(StreamKind.General, 0, "Audio_Language_List");
|
||||||
string audioProfile = mediaInfo.Get(StreamKind.Audio, 0, "Format_Profile");
|
string audioProfile = mediaInfo.Get(StreamKind.Audio, 0, "Format_Profile");
|
||||||
@ -149,6 +152,7 @@ public MediaInfoModel GetMediaInfo(string filename)
|
|||||||
AudioStreamCount = streamCount,
|
AudioStreamCount = streamCount,
|
||||||
AudioChannels = audioChannels,
|
AudioChannels = audioChannels,
|
||||||
AudioChannelPositions = audioChannelPositions,
|
AudioChannelPositions = audioChannelPositions,
|
||||||
|
AudioChannelPositionsText = audioChannelPositionsText,
|
||||||
AudioProfile = audioProfile.Trim(),
|
AudioProfile = audioProfile.Trim(),
|
||||||
VideoFps = videoFrameRate,
|
VideoFps = videoFrameRate,
|
||||||
AudioLanguages = audioLanguages,
|
AudioLanguages = audioLanguages,
|
||||||
|
Loading…
Reference in New Issue
Block a user