• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

10.8. Exhibit B: display.asp

<%
	Sub DisplayArtists()
	  Dim objFSO       'File system object
	  Dim objArtist    'Artist folder object
	  Dim strScriptName  'Name of parent script

	  Dim intAlbumCount    ' Placeholder for number of album subfolders for each artist

	  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
	  
	  strScriptName = Request.ServerVariables("SCRIPT_NAME")

	  For Each objArtist in objFSO.GetFolder(MEDIA_LIBRARY_PATH).Subfolders
	    intAlbumCount = objArtist.SubFolders.Count %>

		<a href='<%= strScriptName %>?action=artist&artist=<%= objArtist.Name %>'
		<% If intAlbumCount = 1 Then %>
		  title='Click to see the <%= intAlbumCount %> album.'>
		<% Else %>
		  title='Click to see all <%= intAlbumCount %> albums.'>
		<% End If %>
		  <%= objArtist.Name %> (<%= intAlbumCount %>)<br>
		</a>

	  <% Next

	  'Clean up
	  Set objFSO = Nothing
	  Set objArtist = Nothing
	End Sub

	Sub DisplayAlbums(strArtist)
	  Dim objFSO     'File system object
	  Dim objAlbum    'Artist folder object
	  Dim objSong    'Song file object
	  Dim strScriptName ' Name of parent script

	  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

	  strScriptName = Request.ServerVariables("SCRIPT_NAME")
%>
	  <h3>
	    <a href='<%= strScriptName %>?action=play&type=artist&artist=<%= strArtist
%>'
		  title='Click here to play all the songs by this artist.'>
		  <%= strArtist %>
		</a>
	  </h3>
<%
	  For Each objAlbum in objFSO.GetFolder(MEDIA_LIBRARY_PATH & "\" &
strArtist).SubFOlders %>
		<h4>
			<a href='<%=strScriptName %>?action=play&type=album&artist=<%=
strArtist %>&album=<%= objAlbum.Name %>'
			  title='Click here to play whole album.'>
			    <%= objAlbum.Name %>
			</a>
		</h4>
<%    For Each objSong in objAlbum.Files
		If objFSO.GetExtensionName(objSong) = "mp3" then %>
		   <a href='<%= strScriptName %>?action=play&type=song&artist=<%=
strArtist %>&album=<%= objAlbum.Name %>&song=<%= objSong.Name %>'
			title='Click here to play this song.'>
			<%= objSong.Name %>
		</a><br>

<%    End If
	  Next
	Next

	'Clean up
	set objFSO = Nothing
	Set objAlbum = Nothing
	Set objSong = Nothing
  End Sub
%>


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint