close databases all create database c:\temp\musiclib create table c:\temp\band ( iBand i autoinc, cBand c(60) ) create table c:\temp\album ( iAlbum i autoinc, iBand i, cTitle c(60), dAdded d, cGuid c(38), iYear i ) create table c:\temp\songs ( iSong i autoinc, iAlbum i, cTitle c(128), iLength i ) set safety off lcRootPath = "C:\Documents and Settings\David\My Documents\My Music\" lnBands = adir( laBands, lcRootPath + "*.*", "D", 1 ) *set step on for i = 3 to lnBands if ( ! "D" $ laBands[i,5] ) loop endif if ( "My Playlists" $ laBands[i,1] ) loop endif if ( "License Backup" $ laBands[i,1] ) loop endif lcBand = alltrim( laBands[i,1] ) @0,0 say lcBand + " " insert into band ( cBand ) values ( laBands[i,1] ) lnAlbums = adir( laAlbums, lcRootPath + lcBand + "\*.*", "D", 1 ) for j = 3 to lnAlbums lcAlbumPath = lcBand + "\" + alltrim( laAlbums[j,1] ) @1,0 say lcAlbumPath + " " insert into album ( iBand, cTitle, dAdded, cGUID, iYear ) values ( band.iBand, ; laAlbums[j,1], ; {}, ; "", 0 ) lnSongs = adir( laSongs, lcRootPath + lcAlbumPath + "\*.*", "HS", 1 ) ldAdded = date() + 1000 for k = 3 to lnSongs l = at( "{", laSongs[k,1] ) if ( ( l > 0 ) and empty( album.cGUID ) ) lcStr = substr( laSongs[k,1], l, 38 ) replace album.cGUID with lcStr, dAdded with laSongs[k,3] in album ldAdded = min( ldAdded, laSongs[k,3] ) else if ( ( "custom.jpg" $ lower( laSongs[k,1] ) ) and empty( album.cGUID ) ) replace cGUID with "custom.jpg" in album endif if ( ".wma" $ lower( laSongs[k,1] ) ) insert into songs ( iAlbum, cTitle, iLength ) values ; ( album.iAlbum, laSongs[k,1], 0 ) ldAdded = min( ldAdded, laSongs[k,3] ) endif endif if ( empty( album.dAdded ) ) replace album.dAdded with ldAdded in album endif endfor endfor endfor create cursor randart ( cPath c(254), iRand i ) rand(-1) set textmerge to c:\temp\musiclib.html set textmerge on noshow \\<html> \<body> \<table cellpadding=0 border=1> select band scan lnBand = band.iBand lcBand = alltrim( band.cBand ) \<tr valign=top> \<td> \\<<alltrim( cBand )>> \\</td> select * ; from album ; into cursor thisband readwrite ; where iBand = lnBand ; order by cTitle count for "Disc 2" $ cTitle to lnDisc2s for i = 1 to lnDisc2s locate for "Disc 2" $ cTitle if ( found() ) lcStart = left( cTitle, at( "Disc", cTitle ) - 1 ) skip -1 if ( ( lcStart $ cTitle ) and ( "Disc 1" $ cTitle ) ) replace cTitle with alltrim( cTitle ) + " & Disc Two" skip delete endif endif endfor \<td> \\<table width=100%> select thisband scan lcAlbum = alltrim( cTitle ) lcPath = strtran( lcAlbum, " & Disc Two", "" ) lcAlbum = strtran( lcAlbum, " & Disc Two", " & Disc 2" ) \<tr valign=top> \\<td> \\<<lcAlbum>> \\<br> \\<<>> \\</td> \\<td align=right> if ( ! empty( cGUID ) ) if ( "custom" $ cGUID ) lcImage = [<img src="] + lcRootPath + lcBand + "\" + lcPath + "\" + cGUID + [">] else lcImage = [<img src="] + lcRootPath + lcBand + "\" + lcPath + "\AlbumArt_" + cGUID + [_Large.jpg">] endif \\<<lcImage>> insert into randart values ( lcImage, int( rand() * 1000000 ) ) else \\no pic found yet endif \\</td></tr> endscan \\</table> \\</td> \\</tr> endscan \</table> \</body> \</html> set textmerge off set textmerge to set textmerge to c:\temp\randart.html set textmerge on noshow \\<html> \<body> select randart index on iRand tag iRand scan \\<<randart.cPath>> endscan \</body> \</html> set textmerge off set textmerge to