1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 20:42:37 +01:00

Updated MediaInfo code for syno/linux.

This commit is contained in:
Taloth Saldono 2015-05-11 23:22:04 +02:00
parent e98a174884
commit af060d73cc
2 changed files with 32 additions and 0 deletions

View File

@ -39,6 +39,36 @@ public void get_info()
var info = Subject.GetMediaInfo(path); var info = Subject.GetMediaInfo(path);
info.AudioBitrate.Should().Be(128000);
info.AudioChannels.Should().Be(2);
info.AudioFormat.Should().Be("AAC");
info.AudioLanguages.Should().Be("English");
info.AudioProfile.Should().Be("LC");
info.Height.Should().Be(320);
info.RunTime.Seconds.Should().Be(10);
info.ScanType.Should().Be("Progressive");
info.Subtitles.Should().Be("");
info.VideoBitrate.Should().Be(193329);
info.VideoCodec.Should().Be("AVC");
info.VideoFps.Should().Be(24);
info.Width.Should().Be(480);
}
[Test]
public void get_info_unicode()
{
var srcPath = Path.Combine(Directory.GetCurrentDirectory(), "Files", "Media", "H264_sample.mp4");
var tempPath = GetTempFilePath();
Directory.CreateDirectory(tempPath);
var path = Path.Combine(tempPath, "H264_Pokémon.mkv");
File.Copy(srcPath, path);
var info = Subject.GetMediaInfo(path);
info.AudioBitrate.Should().Be(128000); info.AudioBitrate.Should().Be(128000);
info.AudioChannels.Should().Be(2); info.AudioChannels.Should().Be(2);
info.AudioFormat.Should().Be("AAC"); info.AudioFormat.Should().Be("AAC");

View File

@ -49,6 +49,8 @@ public MediaInfoModel GetMediaInfo(string filename)
} }
else else
{ {
mediaInfo.Option("CharSet", "UTF-8");
// On non-Windows the wrapper uses the ansi library methods, which libmediainfo converts internally to unicode from multibyte (utf8). // On non-Windows the wrapper uses the ansi library methods, which libmediainfo converts internally to unicode from multibyte (utf8).
// To avoid building MediaInfoDotNet ourselves we simply trick the wrapper to send utf8 strings instead of ansi. // To avoid building MediaInfoDotNet ourselves we simply trick the wrapper to send utf8 strings instead of ansi.
var utf8filename = Encoding.Default.GetString(Encoding.UTF8.GetBytes(filename)); var utf8filename = Encoding.Default.GetString(Encoding.UTF8.GetBytes(filename));