Home » Blog
date 22.Sep.2013

■ Which of my converted music folders lack CD cover art?

I am using CDEX to convert music CDs to MP3. This ripper is great but it doesn't automatically fetch album art. Over the years I amassed a large music collection, where some folders have and some don't have the CD cover pictures accompanying the music tracks. I needed a way to find which folders didn't have album art and download the missing pictures.

xplorer² has a great search engine but this task is just too complex for a file manager. What needs to be done is:

This search is easily dealt with a windows script written in VBS language. We can take the recursive script we saw earlier as a starting point, which examines all files under a folder hierarchy. We check file types using either the Type or Extension column to see if they are music or pictures. Instead of printing folder names, I put them in a text file called REPORT.TXT. Here is the complete script:

REM FINDCDART.VBS: scan music folders and print those without "album art"
Set oFSO = CreateObject("Scripting.FileSystemObject")
set oFile = oFSO.CreateTextFile("report.txt", True)

' examine all folders starting from where we are located
Set oShell = WScript.CreateObject("WScript.Shell")
call listdir(oShell.CurrentDirectory) 
oShell.Run "report.txt"

Sub listDir(what)
Set oDir = oFSO.GetFolder(what)
bHasMP3 = false
bHasJPG = false

' there isn't an easy way to do wildcards, so just check file types
For Each f in oDir.Files
   strType = lcase(f.Type)
   if Instr(strType, "audio") > 0 OR Instr(strType, "sound") > 0 then bHasMP3 = true

   ' image files don't have convenient types for detection, check extension
   strExt = oFSO.GetExtensionName(lcase(f.name))
   if strExt="jpg" OR strExt="gif" OR strExt="png" OR strExt="jpeg" OR strExt="bmp" then bHasJPG = true

   if bHasJPG AND bHasMP3 then exit for

if bHasMP3 AND NOT bHasJPG then 
' we must find album art for this one!
end if

' recursively enter subfolders
For Each f in oDir.subfolders
   call listdir(what & "\" & f.name)
end sub

You can download this script and place it in your My Music folder and execute it. In the end you will see a list of music folders without pictures. Try to get your head round it too, it isn't that hard!

Post a comment on this topic »

Share |

©2002-2013 ZABKAT, all rights reserved | Privacy policy | Sitemap