1 <%@ Language=VBScript %>
2 <% Option Explicit %>
3
4
5 <%
6 '********************************************
7 '* ASP MP3 Lister By Smo *
8 '* (c) 2001 By Tim Smulders *
9 '* Version 1 *
10 '* http://www.iamsmo.com *
11 '********************************************
12
13
14 'Ignore this line below.
15 Dim strPhysicalAddressOfMP3Folder, strMP3IsALink, strVirtualAddressOfMP3Folder, strTableBackGroundColor, _
16 strTableBorderColor, strCreateAspPage, strPhysicalAddressOfFolderWithWritePermission, _
17 strAspPageName, arrGenre, objFSO, objMP3Directory, objMP3, strAspPage, MP3, strComment, _
18 strTag, intGenre, objAspPage
19
20
21 'Between the quotes in the line below enter the
22 'physical address of your mp3 folder.
23
24
25 strPhysicalAddressOfMP3Folder = "C:\Physical\Address\Of\MP3Folder"
26
27
28 'If you want the MP3 filename to be a link so users
29 'can download the file leave Yes between the quotes
30 'in the line below. If you do not want the filename
31 'to be a download link enter No between the quotes.
32
33
34 strMP3IsALink = "Yes"
35
36
37 'If strMP3IsALink above is set to Yes you must enter
38 'the virtual address of your mp3 folder between the
39 'quotes in the line below.
40
41
42 strVirtualAddressOfMP3Folder = "http://www.mywebsite.com/Virtual/Address/Of/MP3Folder"
43
44
45 'Enter the hexadecimal color for the table background.
46 strTableBackGroundColor = "#CCCCCC"
47
48
49 'Enter the hexadecimal color for the table border.
50 strTableBorderColor = "#000000"
51
52
53 'If you want to create an asp file from the list
54 'leave Yes between the quotes in the line below.
55 'You can use the created asp file as an include file.
56 'If you do not want to create an asp file from the
57 'list enter No between the quotes.
58
59
60 strCreateAspPage = "Yes"
61
62
63 'If strCreateAspPage above is set to Yes you must enter
64 'the physical address of the folder where you want the asp
65 'file to be created between the quotes in the line below.
66 'This folder must have write permission.
67
68
69 strPhysicalAddressOfFolderWithWritePermission = "C:\Physical\Address\Of\FolderWithWritePermission"
70
71
72 'If strCreateAspPage above is set to Yes you must enter
73 'a name for the asp file between the quotes in the line
74 'below. Its best to move the created asp file to a
75 'different directory before linking to it so your users
76 'do not know the location of your writable directory.
77
78
79 strAspPageName = "mymp3list.asp"
80
81
82 'You can ignore everything else below this line.
83
84
85 arrGenre = Split("Blues,Classic Rock,Country,Dance,Disco,Funk,Grunge,Hip-Hop,Jazz,Metal," & _
86 "New Age,Oldies,Other,Pop,R&B,Rap,Reggae,Rock,Techno,Industrial,Alternative,Ska," & _
87 "Death Metal,Pranks,Soundtrack,Euro-Techno,Ambient,Trip-Hop,Vocal,Jazz+Funk," & _
88 "Fusion,Trance,Classical,Instrumental,Acid,House,Game,Sound Clip,Gospel,Noise," & _
89 "Altern Rock,Bass,Soul,Punk,Space,Meditative,Instrumental Pop,Instrumental Rock," & _
90 "Ethnic,Gothic,Darkwave,Techno-Industrial,Electronic,Pop-Folk,Eurodance,Dream," & _
91 "Southern Rock,Comedy,Cult,Gangsta,Top 40,Christian Rap,Pop/Funk,Jungle," & _
92 "Native American,Cabaret,New Wave,Psychadelic,Rave,Showtunes,Trailer,Lo-Fi,Tribal," & _
93 "Acid Punk,Acid Jazz,Polka,Retro,Musical,Rock & Roll,Hard Rock,Folk,Folk/Rock," & _
94 "National Folk,Swing,Bebob,Latin,Revival,Celtic,Bluegrass,Avantgarde,Gothic Rock," & _
95 "Progressive Rock,Psychedelic Rock,Symphonic Rock,Slow Rock,Big Band,Chorus," & _
96 "Easy Listening,Acoustic,Humour,Speech,Chanson,Opera,Chamber Music,Sonata,Symphony," & _
97 "Booty Bass,Primus,Porn Groove,Satire,Slow Jam,Club,Tango,Samba,Folklore", ",")
98
99
100 Response.Write "<html><head><title>ASP MP3 Lister</title>" & _
101 "<meta http-equiv=""Content-Type"" content=""text/html;charset=iso-8859-1"">" & _
102 "</head><body bgcolor=""#FFFFFF"">"
103
104
105 Response.Write "<table width=""100%"" border=""0""><tr valign=""top"" align=""left"">" & _
106 "<td>ASP MP3 Lister Version beta 1 © <a href=""http://www.iamsmo.com"">" & _
107 "I Am Smo</a></td></tr></table><br><form name=""CreateMP3List"" method=""post"" " & _
108 "action=""aspmp3lister_v1.asp?aspmp3listerstep=createmp3list""><table width=""100%"" " & _
109 "border=""0""><tr valign=""top"" align=""left""><td><input type=""submit"" " & _
110 "name=""Submit"" value=""Create MP3 List""></td></tr></table><br>"
111
112
113 If Request.QueryString("aspmp3listerstep") = "createmp3list" Then
114
115
116 Set objFSO = CreateObject("Scripting.FileSystemObject")
117 Set objMP3Directory = objFSO.GetFolder(strPhysicalAddressOfMP3Folder)
118 Set objMP3 = Server.CreateObject("ADODB.Stream")
119 objMP3.Type = 1
120
121
122 strAspPage = "<table border=""1"" bgcolor=""" & _
123 strTableBackGroundColor & """ bordercolor=""" & strTableBorderColor & _
124 """ cellspacing=""0"" cellpadding=""0""><tr align=""center"" " & _
125 "valign=""middle""><td> File Size </td><td>" & _
126 " File Name </td><td> " & _
127 "Title </td><td> Artist " & _
128 "</td><td> Album </td><td> " & _
129 "Year </td><td> Comment </td><td>" & _
130 " Track </td><td> Genre </td>" & _
131 "<td> Tag </td></tr>"
132
133
134 For Each MP3 in objMP3Directory.Files
135 strAspPage = strAspPage & "<tr align=""center"" valign=""middle""><td> " & _
136 Round((MP3.Size * .000001), 2) & " meg </td>"
137 If strMP3IsALink = "Yes" Then
138 strAspPage = strAspPage & "<td> <a href=""" & _
139 strVirtualAddressOfMP3Folder & "/" & MP3.Name & """>" & _
140 MP3.Name & "</a> </td>"
141 Else
142 strAspPage = strAspPage & "<td> " & MP3.Name & _
143 " </td>"
144 End If
145
146
147 objMP3.Open
148 objMP3.LoadFromFile MP3.Path
149 objMP3.Position = objMP3.Size - 128
150
151
152 If UCase(ConvertTheBinary(objMP3.Read(3))) = "TAG" Then
153 strAspPage = strAspPage & "<td> " & _
154 ConvertTheBinary(objMP3.Read(30)) & " </td>"
155 strAspPage = strAspPage & "<td> " & _
156 ConvertTheBinary(objMP3.Read(30)) & " </td>"
157 strAspPage = strAspPage & "<td> " & _
158 ConvertTheBinary(objMP3.Read(30)) & " </td>"
159 strAspPage = strAspPage & "<td> " & _
160 ConvertTheBinary(objMP3.Read(4)) & " </td>"
161
162
163 strComment = objMP3.Read(30)
164
165
166 If AscB(MidB(strComment, 29, 1)) = 0 AND AscB(MidB(strComment, 30, 1)) > 0 _
167 AND AscB(MidB(strComment, 30, 1)) < 256 Then
168
169
170 strTag = "ID3v1.1"
171
172
173 strAspPage = strAspPage & "<td> " & _
174 ConvertTheBinary(LeftB(strComment, 28)) & " </td>"
175
176
177 strAspPage = strAspPage & "<td> " & _
178 AscB(MidB(strComment, 30,1)) & " </td>"
179
180
181 Else
182
183
184 strTag = "ID3v1"
185
186
187 strAspPage = strAspPage & "<td> " & _
188 ConvertTheBinary(strComment) & " </td>"
189
190
191 strAspPage = strAspPage & "<td> </td>"
192
193
194 End If
195
196
197 intGenre = AscB(objMP3.Read(1))
198
199
200 If intGenre <= 114 AND intGenre >= 0 Then
201 strAspPage = strAspPage & "<td> " & _
202 arrGenre(intGenre) & " </td>"
203
204
205 Else
206
207
208 strAspPage = strAspPage & "<td> </td>"
209
210
211 End If
212
213
214 strAspPage = strAspPage & "<td> " & strTag & _
215 " </td></tr>"
216 Else
217 strAspPage = strAspPage & "<td colspan=""8""> " & _
218 "NO ID3v1 or ID3v1.1 TAG found for this file </td></tr>"
219 End If
220
221
222 objMP3.Close
223 Next
224
225
226 strAspPage = strAspPage & "</table>"
227
228
229 Set objMP3 = Nothing
230 Set objMP3Directory = Nothing
231 Set objFSO = Nothing
232
233
234 End If
235
236
237 Response.Write strAspPage & "</body></html>"
238
239
240 If strCreateAspPage = "Yes" Then
241
242
243 Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
244 Set objAspPage = objFSO.CreateTextFile(strPhysicalAddressOfFolderWithWritePermission & _
245 "\" & strAspPageName)
246
247
248 objAspPage.WriteLine(strAspPage)
249
250
251 objAspPage.Close
252 Set objAspPage = Nothing
253 Set objFSO = Nothing
254
255
256 End If
257
258
259 Function ConvertTheBinary(thebytes)
260
261
262 Dim x
263
264
265 For x = 1 to LenB(thebytes)
266 If AscB(MidB(thebytes,x, 1))<> 0 Then
267 ConvertTheBinary = ConvertTheBinary & Chr(AscB(MidB(thebytes, x, 1)))
268 End If
269 Next
270
271
272 End function
273
274
275 %>