Honor x264 tag in filename if mediainfo does not conclusively indicate h264.

Closes #2500
This commit is contained in:
Taloth Saldono 2018-04-18 22:31:56 +02:00
parent 1b0647423d
commit 2b3956cb60
2 changed files with 22 additions and 2 deletions

View File

@ -58,6 +58,26 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
MediaInfoFormatter.FormatVideoCodec(mediaInfoModel, sceneName).Should().Be(expectedFormat);
}
[TestCase("AVC, AVC, , x264", "Some.Video.S01E01.h264", "x264")] // Force mediainfo tag
[TestCase("HEVC, HEVC, , x265", "Some.Video.S01E01.h265", "x265")] // Force mediainfo tag
[TestCase("AVC, AVC, , ", "Some.Video.S01E01.x264", "x264")] // Not seen in practice, but honor tag if otherwise unknown
[TestCase("HEVC, HEVC, , ", "Some.Video.S01E01.x265", "x265")] // Not seen in practice, but honor tag if otherwise unknown
[TestCase("AVC, AVC, , ", "Some.Video.S01E01", "h264")] // Default value
[TestCase("HEVC, HEVC, , ", "Some.Video.S01E01", "h265")] // Default value
public void should_format_video_format_fallbacks(string videoFormatPack, string sceneName, string expectedFormat)
{
var split = videoFormatPack.Split(new string[] { ", " }, System.StringSplitOptions.None);
var mediaInfoModel = new MediaInfoModel
{
VideoFormat = split[0],
VideoCodecID = split[1],
VideoProfile = split[2],
VideoCodecLibrary = split[3]
};
MediaInfoFormatter.FormatVideoCodec(mediaInfoModel, sceneName).Should().Be(expectedFormat);
}
[TestCase("MPEG-4 Visual, 20, , Intel(R) MPEG-4 encoder based on Intel(R) IPP 6.1 build 137.20[6.1.137.763]", "", "")]
public void should_warn_on_unknown_video_format(string videoFormatPack, string sceneName, string expectedFormat)
{

View File

@ -218,7 +218,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
return "x264";
}
return GetSceneNameMatch(sceneName, "AVC", "h264");
return GetSceneNameMatch(sceneName, "AVC", "x264", "h264");
}
if (videoFormat == "HEVC" || videoFormat == "V_MPEGH/ISO/HEVC")
@ -228,7 +228,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
return "x265";
}
return GetSceneNameMatch(sceneName, "HEVC", "h265");
return GetSceneNameMatch(sceneName, "HEVC", "x265", "h265");
}
if (videoFormat == "MPEG Video")