Added a few more codecs, not even halfway.

This commit is contained in:
Taloth Saldono 2017-08-03 19:26:14 +02:00
parent 1b9ccc319f
commit 40e5626ddb
3 changed files with 24 additions and 1 deletions

View File

@ -30,6 +30,8 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
[TestCase("TrueHD, A_TRUEHD, , ", "", "TrueHD")] [TestCase("TrueHD, A_TRUEHD, , ", "", "TrueHD")]
[TestCase("WMA, 161, , ", "Droned.wmv", "WMA")] [TestCase("WMA, 161, , ", "Droned.wmv", "WMA")]
[TestCase("WMA, 162, Pro, ", "B.N.S04E18.720p.WEB-DL", "WMA")] [TestCase("WMA, 162, Pro, ", "B.N.S04E18.720p.WEB-DL", "WMA")]
[TestCase("Opus, A_OPUS, , ", "Roadkill Ep3x11 - YouTube.webm", "Opus")]
[TestCase("mp3 , 0, , ", "climbing.mp4", "MP3")]
public void should_format_audio_format(string audioFormatPack, string sceneName, string expectedFormat) public void should_format_audio_format(string audioFormatPack, string sceneName, string expectedFormat)
{ {
var split = audioFormatPack.Split(new string[] { ", " }, System.StringSplitOptions.None); var split = audioFormatPack.Split(new string[] { ", " }, System.StringSplitOptions.None);

View File

@ -34,6 +34,11 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
[TestCase("V.MPEG4/ISO/AVC, V.MPEG4/ISO/AVC, , ", "pd.2015.S03E08.720p.iP.WEBRip.AAC2.0.H264-BTW", "h264")] [TestCase("V.MPEG4/ISO/AVC, V.MPEG4/ISO/AVC, , ", "pd.2015.S03E08.720p.iP.WEBRip.AAC2.0.H264-BTW", "h264")]
[TestCase("WMV2, WMV2, , ", "Droned.wmv", "WMV")] [TestCase("WMV2, WMV2, , ", "Droned.wmv", "WMV")]
[TestCase("xvid, xvid, , ", "", "XviD")] [TestCase("xvid, xvid, , ", "", "XviD")]
[TestCase("div3, div3, , ", "spsm.dvdrip.divx.avi'.", "DivX")]
[TestCase("VP6, 4, , ", "Top Gear - S12E01 - Lorries - SD TV.flv", "VP6")]
[TestCase("VP7, VP70, General, ", "Sweet Seymour.avi", "VP7")]
[TestCase("VP8, V_VP8, , ", "Dick.mkv", "VP8")]
[TestCase("VP9, V_VP9, , ", "Roadkill Ep3x11 - YouTube.webm", "VP9")]
public void should_format_video_format(string videoFormatPack, string sceneName, string expectedFormat) public void should_format_video_format(string videoFormatPack, string sceneName, string expectedFormat)
{ {
var split = videoFormatPack.Split(new string[] { ", " }, System.StringSplitOptions.None); var split = videoFormatPack.Split(new string[] { ", " }, System.StringSplitOptions.None);

View File

@ -89,6 +89,11 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
return "FLAC"; return "FLAC";
} }
if (audioFormat.Trim().EqualsIgnoreCase("mp3"))
{
return "MP3";
}
if (audioFormat.EqualsIgnoreCase("MPEG Audio")) if (audioFormat.EqualsIgnoreCase("MPEG Audio"))
{ {
if (mediaInfo.AudioCodecID == "55" || mediaInfo.AudioCodecID == "A_MPEG/L3" || mediaInfo.AudioProfile == "Layer 3") if (mediaInfo.AudioCodecID == "55" || mediaInfo.AudioCodecID == "A_MPEG/L3" || mediaInfo.AudioProfile == "Layer 3")
@ -102,6 +107,11 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
} }
} }
if (audioFormat.EqualsIgnoreCase("Opus"))
{
return "Opus";
}
if (audioFormat.EqualsIgnoreCase("PCM")) if (audioFormat.EqualsIgnoreCase("PCM"))
{ {
return "PCM"; return "PCM";
@ -214,7 +224,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
return GetSceneNameMatch(sceneName, "AVC", "h264"); return GetSceneNameMatch(sceneName, "AVC", "h264");
} }
if (videoFormat.EqualsIgnoreCase("DivX")) if (videoFormat.EqualsIgnoreCase("DivX") || videoFormat.EqualsIgnoreCase("div3"))
{ {
return "DivX"; return "DivX";
} }
@ -267,6 +277,12 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
return "VC1"; return "VC1";
} }
if (videoFormat.EqualsIgnoreCase("VP6") || videoFormat.EqualsIgnoreCase("VP7") ||
videoFormat.EqualsIgnoreCase("VP8") || videoFormat.EqualsIgnoreCase("VP9"))
{
return videoFormat.ToUpperInvariant();
}
if (videoFormat == "WMV2") if (videoFormat == "WMV2")
{ {
return "WMV"; return "WMV";