ASP Programming Example: Using ASP to realize the operation of MP3 track information

Source: Internet
Author: User
Programming

Let's say a little bit about MP3 's ID3, because it's mainly about manipulating this thing.
MP3 at the very beginning without what we see today, there are singers, times, albums and so on.
Only a few simple parameters such as yes/no to express is not privated or copyrighted information, so that MP3 related to the work caused a lot of inconvenience, 1996 when a foreigner proposed to each of the MP3 appended a piece of data to store the above information, And then it developed into a id3v1. As far as I know, now it's 1.1, the specific to check it yourself
Or the old habit, with metadata to introduce the DLL, I used to have articles posted, do not know please check yourself
Look at the code
<!--metadatatype= "TypeLib"
Uuid= "00000205-0000-0010-8000-00AA006D2EA4"
Name= "Adodbtypelibrary"
-->
<%
Functionconvertbin (Binary)
' Thisfunctionconvertsabinarybyteintoanasciibyte.
Fori=1tolenb (Binary)
STRCHAR=CHR (AscB (MidB (binary,i,1))
Convertbin=convertbin&strchar
Next
Endfunction
Dimobjstream
Dimstrtag,strsongname,strartist,stralbum,stryear,_
Strcomment,strgenre,strfile
' Specifythefoldertoiteratethrough,displayingallthemp3s
Constfolder= "C:\mp3s\"
' Grabthefolderinformation
Dimobjfso,objfolder,objfile
Setobjfso=server.createobject ("Scripting.FileSystemObject")
Setobjfolder=objfso.getfolder (folder)
' Createthestreamobject
Setobjstream=server.createobject ("ADODB.") Stream ")
Objstream.type=adtypebinary
' Loopthroughthefilesinthefolder
Foreachobjfileinobjfolder.files
' Openthestream
objStream.Open
ObjStream.LoadFromFileobjFile.Path
' Readthelast128bytes
objstream.position=objstream.size-128
' Readtheid3v1taginfo
Strtag=convertbin (Objstream.read (3))
Ifucase (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))
endif
' Displaytheresults
Response.Write "<table><tr><tdcolspan=2>"Id3taginfofor:</td></tr><tr>" &_
"<tdcolspan=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>Next
Setobjstream=nothing ' Cleanup ...
%>
Try it yourself.
I wish I could be of some help to you.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.