diff --git a/AudioNodes/AudioInfoHelper.cs b/AudioNodes/AudioInfoHelper.cs index af89524c..9fd367e7 100644 --- a/AudioNodes/AudioInfoHelper.cs +++ b/AudioNodes/AudioInfoHelper.cs @@ -32,7 +32,16 @@ public class AudioInfoHelper if (result.IsFailed == false) mi = result.Value; else - mi = ReadMetaData(filename); + { + try + { + mi = ReadMetaData(filename); + } + catch (Exception) + { + mi = new AudioInfo(); + } + } try { @@ -363,9 +372,10 @@ public class AudioInfoHelper public void ParseFileNameInfo(string filename, AudioInfo mi) { - using var tfile = TagLib.File.Create(filename); try { + using var tfile = TagLib.File.Create(filename); + var fileInfo = new System.IO.FileInfo(filename); bool dirty = false; @@ -458,10 +468,6 @@ public class AudioInfoHelper { Logger?.WLog("Failed parsing Audio info from filename: " + ex.Message + Environment.NewLine + ex.StackTrace); } - finally - { - tfile.Dispose(); - } } } \ No newline at end of file diff --git a/AudioNodes/Tests/AudioInfoTests.cs b/AudioNodes/Tests/AudioInfoTests.cs index 0ed5a35c..13d42efc 100644 --- a/AudioNodes/Tests/AudioInfoTests.cs +++ b/AudioNodes/Tests/AudioInfoTests.cs @@ -32,19 +32,25 @@ public class AudioInfoTests: AudioTestBase [TestMethod] public void AudioInfo_NormalTrack() { - const string file = @"\\oracle\Audio\Taylor Swift\Speak Now\Taylor Swift - Speak Now - 08 - Never Grow Up.mp3"; - const string ffmpegExe = @"C:\utils\ffmpeg\ffmpeg.exe"; - var args = new FileFlows.Plugin.NodeParameters(file, new TestLogger(), false, string.Empty, null);; - args.GetToolPathActual = (string tool) => ffmpegExe; - args.TempPath = @"D:\music\temp"; - - var AudioInfo = new AudioInfoHelper(ffmpegExe, ffprobe, args.Logger).Read(args.WorkingFile); + var args = GetNodeParameters(file, false); + var AudioInfo = new AudioInfoHelper(ffmpeg, ffprobe, args.Logger).Read(args.WorkingFile); Assert.AreEqual(8, AudioInfo.Value.Track); } + [TestMethod] + public void AudioInfo_LargeWav() + { + string file = Path.Combine(TestPath, "large-wav.wav"); + + var args = GetNodeParameters(file, false); + var AudioInfo = new AudioInfoHelper(ffmpeg, ffprobe, args.Logger).Read(args.WorkingFile); + + Assert.AreEqual(96000, AudioInfo.Value.Frequency); + } + [TestMethod] public void AudioInfo_GetMetaData() { diff --git a/FileFlows.Plugin.dll b/FileFlows.Plugin.dll index 0dcd8840..1a27a608 100644 Binary files a/FileFlows.Plugin.dll and b/FileFlows.Plugin.dll differ diff --git a/FileFlows.Plugin.pdb b/FileFlows.Plugin.pdb index 65888748..6d383c6d 100644 Binary files a/FileFlows.Plugin.pdb and b/FileFlows.Plugin.pdb differ