mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-01-06 13:31:19 -06:00
FF-1679: Fixed issue reading metadata in WAV files
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user