5 function GetAlbumArt ($path) {
6 if ($handle = opendir ("$path")) {
7 while (false !== ($element = readdir ($handle))) {
8 if (strpos ($element, "AlbumArt") == 0 &&
9 strpos ($element, "Large") != 0) {
18 function Banner ($path) {
25 while ($component = substr ($path, 0, strpos ($path, "/"))) {
26 $component_path = isset ($component_path)
27 ? $component_path . "/" . $component : $component;
28 print "<a href=\"$http_base/index.php?path=$component_path\">$component</a>: ";
29 $path = substr ($path, strpos ($path, "/") + 1);
33 if ($albumart = GetAlbumArt ("$base/$orig_path")) {
34 print "<img src=\"$orig_path/$albumart\">\n";
38 function DisplayItem ($path, $element) {
39 if ($element == "." || $element == "..") {
41 } elseif (is_dir ($path . "/" . $element)) {
42 if ($element == "My Playlists") {
47 } elseif (strpos ($element, ".wma") ||
48 strpos ($element, ".mp3")) {
55 function DisplayFolders ($path) {
65 $folder_array = array ();
66 $song_array = array ();
68 if ($handle = opendir ("$base/$path")) {
69 while (false !== ($element = readdir ($handle))) {
70 if (!DisplayItem ("$base/$path", $element)) {
73 if (is_dir ("$base/$path/$element")) {
74 array_push ($folder_array, $element);
76 array_push ($song_array, $element);
86 print "<table border=1 width=100% cellspacing=0 cellpadding=5>\n";
89 print " <th bgcolor=blue><font color=white>Folders<font></th>\n";
90 print " <th bgcolor=blue><font color=white>Songs at this level</font></th>\n";
96 while (isset ($song_array [$song_index]) ||
97 isset ($folder_array [$folder_index])) {
98 $song = $song_array [$song_index];
99 $folder = $folder_array [$folder_index];
101 if (isset ($folder)) {
102 print "<td><a href=\"$http_base/index.php?path=$path" . $folder . "\">$folder</a></td>\n";
105 print "<td> </td>\n";
108 print "<td><a href=\"$http_base/$path";
111 if (strpos ($song, ".wma") != 0) {
112 $song_name = substr ($song, 0, strpos ($song, ".wma"));
113 } elseif (strpos ($song, ".mp3") != 0) {
114 $song_name = substr ($song, 0, strpos ($song, ".mp3"));
117 print $song . "\">$song_name</a></td>\n";
120 print "<td> </td>\n";