WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sound and Media

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

CD Audio Information

 Keywords: .CDA .MP3 CDROM DATA FILE INFO 

Here is some code that utilizes the Windows Media Player OLE Object Model:

http://msdn.microsoft.com/en-us/library/bb249672(VS.85).aspx

oWMP = CreateObject("WMPlayer.OCX")
colCDROM = oWMP.CdromCollection
count1 = colCDROM.count
For xx = 0 to count1-1
   oCDROM = colCDROM.Item(xx)
   drivespecifier = oCDROM.DriveSpecifier
   colPlaylist = oCDROM.Playlist
   count2 = colPlaylist.count
   For yy = 0 to count2-1
      objSong = colPlaylist.Item(yy) ;Returns Media Object
      sourceurl = objSong.GetItemInfo("SourceUrl")
      duration = objSong.GetItemInfo("Duration")
      artist = objSong.GetItemInfo("Artist")
      title = objSong.GetItemInfo("Title")
      album = objSong.GetItemInfo("Album")
      bitrate = objSong.GetItemInfo("Bitrate")
      dafilesize = objSong.GetItemInfo("FileSize")
      dafiletype = objSong.GetItemInfo("FileType")
      mediatype = objSong.GetItemInfo("MediaType") 
      category = objSong.GetItemInfo("WM/Category") 
      genre = objSong.GetItemInfo("WM/Genre")
      tracknumber = objSong.GetItemInfo("WM/TrackNumber")
      year = objSong.GetItemInfo("WM/Year") 

      data = StrCat("SourceUrl = ",sourceurl,@lf,"Title = ", title, @lf, "Duration (in seconds)= ", duration, @lf,"Artist = ", artist, @lf,"Album = ", album,@lf,"Bitrate (bits per second)= ", bitrate,@lf)
      data = StrCat(data, "FileSize (in bytes)= ", dafilesize, @lf, "FileType = ", dafiletype, @lf,"MediaType = ", mediatype, @lf,"WM/Category = ", category,@lf,"WM/Genre = ", genre,@lf)
      data = StrCat(data, "WM/TrackNumber = ", tracknumber , @lf, "WM/Year = ", year)
      Message(StrCat(drivespecifier," - Song Info"),data)
      objSong = 0
   Next
   colPlaylist = 0
   oCDROM = 0
Next
colCDROM = 0
oWMP = 0
exit

Article ID:   W16717
File Created: 2009:03:13:09:45:46
Last Updated: 2009:03:13:09:45:46