类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:










页面导航:
正文内容:〈!--metadata type="typelib"
uuid="00000205-0000-0010-8000-00aa006d2ea4"
name="adodb type library"
--〉
〈%
function convertbin(binary)
this function converts a binary byte into an ascii byte.
for i = 1 to lenb(binary)
strchar = chr(ascb(midb(binary,i,1)))
convertbin = convertbin & strchar
next
end function
dim objstream
dim strtag, strsongname, strartist, stralbum, stryear, _
strcomment, strgenre, strfile
specify the folder to iterate through, displaying all the mp3s
const folder = "c:\mp3s\"
grab the folder information
dim objfso, objfolder, objfile
set objfso = server.createobject("scripting.filesystemobject")
set objfolder = objfso.getfolder(folder)
create the stream object
set objstream = server.createobject("adodb.stream")
objstream.type = adtypebinary
loop through the files in the folder
for each objfile in objfolder.files
open the stream
objstream.open
objstream.loadfromfile objfile.path
read the last 128 bytes
objstream.position = objstream.size - 128
read the id3 v1 tag info
strtag = convertbin(objstream.read(3))
if ucase(strtag) = "tag" then
strsongname = convertbin(objstream.read(30))
strartist = convertbin(objstream.read(30))
stralbum = convertbin(objstream.read(30))
stryear = convertbin(objstream.read(4))
strcomment = convertbin(objstream.read(30))
end if
display the results
response.write "〈table〉〈tr〉〈td colspan=2〉〈h3〉" & _
"id3 tag info for:〈/td〉〈/tr〉〈tr〉" & _
"〈td colspan=2〉" & objfile.name & "〈/td〉〈/tr〉"
response.write "〈tr〉〈td〉〈b〉artist: 〈/b〉〈/td〉" & _
"〈td〉" & strartist & "〈/td〉〈/tr〉"
response.write "〈tr〉〈td〉〈b〉track: 〈/b〉〈/td〉" & _
"〈td〉" & strsongname & "〈/td〉〈/tr〉"
response.write "〈tr〉〈td〉〈b〉album: 〈/b〉〈/td〉" & _
〈td〉" & stralbum & "〈/td〉〈/tr〉"
response.write "〈tr〉〈td〉〈b〉year: 〈/b〉〈/td〉" & _
"〈td〉" & stryear & "〈/td〉〈/tr〉"
response.write "〈tr〉〈td〉〈b〉comment: 〈/b〉" & _
"〈/td〉〈td〉" & strcomment & "〈/td〉〈/tr〉"
response.write "〈/table〉"
objstream.close
response.write "〈p〉〈hr〉〈p〉"
next
set objstream = nothing clean up...
%〉
自己试试吧