Von
http://www.iamsmo.com/site/aspmp3lister/aspmp3lister.htm
<%@ Language=VBScript %>
<% Option Explicit %>
<%
'***********
'* ASP MP3 Lister By Smo *
'* (c) 2001 By Tim Smulders *
'* Version 1 *
'* http://www.iamsmo.com *
'***********
'Ignore this line below.
Dim strPhysicalAddressOfMP3Folder, strMP3IsALink, strVirtualAddressOfMP3Folder, strTableBackGroundColor, _
strTableBorderColor, strCreateAspPage, strPhysicalAddressOfFolderWithWritePermission, _
strAspPageName, arrGenre, objFSO, objMP3Directory, objMP3, strAspPage, MP3, strComment, _
strTag, intGenre, objAspPage
'Between the quotes in the line below enter the
'physical address of your mp3 folder.
strPhysicalAddressOfMP3Folder = "C:\Physical\Address\Of\MP3Folder"
'If you want the MP3 filename to be a link so users
'can download the file leave Yes between the quotes
'in the line below. If you do not want the filename
'to be a download link enter No between the quotes.
strMP3IsALink = "Yes"
'If strMP3IsALink above is set to Yes you must enter
'the virtual address of your mp3 folder between the
'quotes in the line below.
strVirtualAddressOfMP3Folder = "http://www.mywebsite.com/Virtual/Address/Of/MP3Folder"
'Enter the hexadecimal color for the table background.
strTableBackGroundColor = "#CCCCCC"
'Enter the hexadecimal color for the table border.
strTableBorderColor = "#000000"
'If you want to create an asp file from the list
'leave Yes between the quotes in the line below.
'You can use the created asp file as an include file.
'If you do not want to create an asp file from the
'list enter No between the quotes.
strCreateAspPage = "Yes"
'If strCreateAspPage above is set to Yes you must enter
'the physical address of the folder where you want the asp
'file to be created between the quotes in the line below.
'This folder must have write permission.
strPhysicalAddressOfFolderWithWritePermission = "C:\Physical\Address\Of\FolderWithWritePermission"
'If strCreateAspPage above is set to Yes you must enter
'a name for the asp file between the quotes in the line
'below. Its best to move the created asp file to a
'different directory before linking to it so your users
'do not know the location of your writable directory.
strAspPageName = "mymp3list.asp"
'You can ignore everything else below this line.
arrGenre = Split("Blues,Classic Rock,Country,Dance,Disco,Funk,Grunge,Hip-Hop,Jazz,Metal," & _
"New Age,Oldies,Other,Pop,R&B,Rap,Reggae,Rock,Techno,Industrial,Alternative,Ska," & _
"Death Metal,Pranks,Soundtrack,Euro-Techno,Ambient,Trip-Hop,Vocal,Jazz+Funk," & _
"Fusion,Trance,Classical,Instrumental,Acid,House,Game,Sound Clip,Gospel,Noise," & _
"Altern Rock,Bass,Soul,Punk,Space,Meditative,Instrumental Pop,Instrumental Rock," & _
"Ethnic,Gothic,Darkwave,Techno-Industrial,Electronic,Pop-Folk,Eurodance,Dream," & _
"Southern Rock,Comedy,Cult,Gangsta,Top 40,Christian Rap,Pop/Funk,Jungle," & _
"Native American,Cabaret,New Wave,Psychadelic,Rave,Showtunes,Trailer,Lo-Fi,Tribal," & _
"Acid Punk,Acid Jazz,Polka,Retro,Musical,Rock & Roll,Hard Rock,Folk,Folk/Rock," & _
"National Folk,Swing,Bebob,Latin,Revival,Celtic,Bluegrass,Avantgarde,Gothic Rock," & _
"Progressive Rock,Psychedelic Rock,Symphonic Rock,Slow Rock,Big Band,Chorus," & _
"Easy Listening,Acoustic,Humour,Speech,Chanson,Opera,Chamber Music,Sonata,Symphony," & _
"Booty Bass,Primus,Porn Groove,Satire,Slow Jam,Club,Tango,Samba,Folklore", ",")
Response.Write "<html><head><title>ASP MP3 Lister</title>" & _
"<meta http-equiv=""Content-Type"" content=""text/html;charset=iso-8859-1"">" & _
"</head><body bgcolor=""#FFFFFF"">"
Response.Write "<table width=""100%"" border=""0""><tr valign=""top"" align=""left"">" & _
"<td>ASP MP3 Lister Version beta 1 © <a href=""http://www.iamsmo.com"">" & _
"I Am Smo</a></td></tr></table><br><form name=""CreateMP3List"" method=""post"" " & _
"action=""aspmp3lister_v1.asp?aspmp3listerstep=createmp3list""><table width=""100%"" " & _
"border=""0""><tr valign=""top"" align=""left""><td><input type=""submit"" " & _
"name=""Submit"" value=""Create MP3 List""></td></tr></table><br>"
If Request.QueryString("aspmp3listerstep") = "createmp3list" Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objMP3Directory = objFSO.GetFolder(strPhysicalAddressOfMP3Folder)
Set objMP3 = Server.CreateObject("ADODB.Stream")
objMP3.Type = 1
strAspPage = "<table border=""1"" bgcolor=""" & _
strTableBackGroundColor & """ bordercolor=""" & strTableBorderColor & _
""" cellspacing=""0"" cellpadding=""0""><tr align=""center"" " & _
"valign=""middle""><td> File Size </td><td>" & _
" File Name </td><td> " & _
"Title </td><td> Artist " & _
"</td><td> Album </td><td> " & _
"Year </td><td> Comment </td><td>" & _
" Track </td><td> Genre </td>" & _
"<td> Tag </td></tr>"
For Each MP3 in objMP3Directory.Files
strAspPage = strAspPage & "<tr align=""center"" valign=""middle""><td> " & _
Round((MP3.Size * .000001), 2) & " meg </td>"
If strMP3IsALink = "Yes" Then
strAspPage = strAspPage & "<td> <a href=""" & _
strVirtualAddressOfMP3Folder & "/" & MP3.Name & """>" & _
MP3.Name & "</a> </td>"
Else
strAspPage = strAspPage & "<td> " & MP3.Name & _
" </td>"
End If
objMP3.Open
objMP3.LoadFromFile MP3.Path
objMP3.Position = objMP3.Size - 128
If UCase(ConvertTheBinary(objMP3.Read(3))) = "TAG" Then
strAspPage = strAspPage & "<td> " & _
ConvertTheBinary(objMP3.Read(30)) & " </td>"
strAspPage = strAspPage & "<td> " & _
ConvertTheBinary(objMP3.Read(30)) & " </td>"
strAspPage = strAspPage & "<td> " & _
ConvertTheBinary(objMP3.Read(30)) & " </td>"
strAspPage = strAspPage & "<td> " & _
ConvertTheBinary(objMP3.Read(4)) & " </td>"
strComment = objMP3.Read(30)
If AscB(MidB(strComment, 29, 1)) = 0 AND AscB(MidB(strComment, 30, 1)) > 0 _
AND AscB(MidB(strComment, 30, 1)) < 256 Then
strTag = "ID3v1.1"
strAspPage = strAspPage & "<td> " & _
ConvertTheBinary(LeftB(strComment, 28)) & " </td>"
strAspPage = strAspPage & "<td> " & _
AscB(MidB(strComment, 30,1)) & " </td>"
Else
strTag = "ID3v1"
strAspPage = strAspPage & "<td> " & _
ConvertTheBinary(strComment) & " </td>"
strAspPage = strAspPage & "<td> </td>"
End If
intGenre = AscB(objMP3.Read(1))
If intGenre <= 114 AND intGenre >= 0 Then
strAspPage = strAspPage & "<td> " & _
arrGenre(intGenre) & " </td>"
Else
strAspPage = strAspPage & "<td> </td>"
End If
strAspPage = strAspPage & "<td> " & strTag & _
" </td></tr>"
Else
strAspPage = strAspPage & "<td colspan=""8""> " & _
"NO ID3v1 or ID3v1.1 TAG found for this file </td></tr>"
End If
objMP3.Close
Next
strAspPage = strAspPage & "</table>"
Set objMP3 = Nothing
Set objMP3Directory = Nothing
Set objFSO = Nothing
End If
Response.Write strAspPage & "</body></html>"
If strCreateAspPage = "Yes" Then
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objAspPage = objFSO.CreateTextFile(strPhysicalAddressOfFolderWithWritePermission & _
"\" & strAspPageName)
objAspPage.WriteLine(strAspPage)
objAspPage.Close
Set objAspPage = Nothing
Set objFSO = Nothing
End If
Function ConvertTheBinary(thebytes)
Dim x
For x = 1 to LenB(thebytes)
If AscB(MidB(thebytes,x, 1))<> 0 Then
ConvertTheBinary = ConvertTheBinary & Chr(AscB(MidB(thebytes, x, 1)))
End If
Next
End function
%>