I found that, when I convert files using VB, and signify an errorfile, that the errorfile is created regardless of whether the conversion (from MP3 to MP3, any codec to Lame, any bitrate to 128) succeeds or not.
Initially, I tried having my app check for the existence of an error log to indicate if the conversion succeeded or not... which, of course, failed, because the file is always created.
So, I tried making a fake MP3 file - which should, logically, generate an actual error, since it does using the dMC GUI - and yes, the log was created... but there was nothing inside it.
This is the code I use:
Is there any other way to determine if a conversion succeeded or not, perhaps using return codes? The program is supposed to batch-process any number of music files between 1 and 500, and I'd like to find the most reliable way to verify a conversion... after all, checking for error logs is quite a moot point if said logs do not provide a clue about whether or not a conversion worked.
Thanks.
Initially, I tried having my app check for the existence of an error log to indicate if the conversion succeeded or not... which, of course, failed, because the file is always created.
So, I tried making a fake MP3 file - which should, logically, generate an actual error, since it does using the dMC GUI - and yes, the log was created... but there was nothing inside it.
This is the code I use:
Code:
Function Convertit(source, target) As Boolean Dim errorFile As String, dMC, fl As File Set fso = CreateObject("Scripting.FileSystemObject") errorFile = appPath & "converr.txt" If fso.FileExists(errorFile) Then fso.DeleteFile (errorFile) Set dMC = CreateObject("dMCScripting.Converter") dMC.Convert source, target, "mp3 (Lame)", "-b 128 -encoding=""SLOW"" -freq=""44100"" -channels=""joint stereo"" -crc=""1""", errorFile Set dMC = Nothing If fso.FileExists(errorFile) Then Set fl = fso.GetFile(errorFile) If fl.Size > 0 Then Convertit = False Else Convertit = True End If Set fl = nothing Else Convertit = True End If Set fso = Nothing End Function
Thanks.
Comment