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

Source: Internet
Author: User
Tags id3 id3 tag

Let's just say a little bit about MP3 's ID3 mark, because it's mainly about manipulating this thing.
MP3 at the beginning of the time we saw today, there are singers, times, albums and so on information
Only some simple parameters such as yes/no to indicate is not privated or copyrighted and other information, so MP3 related work brought a lot of inconvenience, 1996 when a foreigner proposed to add a piece of data after each MP3, to store the above information, Later on to become ID3 v1 as far as I know now is 1.1, specific or to check it yourself
Shanghai Cheng Kai Men's Hospital procedures: or old habits, with metadata to introduce DLLs, I have articles posted before, do not know please yourself to check
Look at the code
!--METADATA type= "TypeLib"
Uuid= "00000205-0000-0010-8000-00AA006D2EA4"
Name= "ADODB Type Library"
--〉
〈%
Function Convertbin (Binary)
' This function converts a binary byte to 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 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 ...
%〉
Try it yourself.
I hope I can be of some help to you

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

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.