/
albums.php
50 lines (40 loc) · 1.39 KB
/
albums.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<div id="albums">
<?php
echo "<h2><a name=\"albums\"></a>Albums";
$letters_albums = array();
$tmp = do_mpd_command ($connection, "list album".(array_key_exists ("artist", $configuration) ? " \"".$configuration["artist"]."\"" : ""), null, true);
if (array_key_exists ("Album", $tmp)) {
if (!is_array ($tmp["Album"]))
$albums = array ($tmp["Album"]);
else
$albums = $tmp["Album"];
natcasesort ($albums);
$albums = array_merge (array("Any album" => ""), array_values ($albums));
foreach ($albums as $key => $val) {
if (!isset ($letters_albums[strtoupper (mbFirstChar ($val))]))
$letters_albums[strtoupper (mbFirstChar ($val))] = true;
}
$songinfo = null;
$counte = 0;
echo " <small>";
make_index_table($letters_albums, "albums_", false);
echo "</small></h2>\n";
echo "<table cellspacing=\"0\">\n";
foreach($albums as $key => $val) {
if ($letters_albums[strtoupper (mbFirstChar ($val))] == true) {
echo "<a name=\"albums_".strtoupper (mbFirstChar ($val))."\"></a>";
$letters_albums[strtoupper (mbFirstChar ($val))] = false;
}
echo "<tr".($counte % 2 != 1 ? " class=\"alt\"" : "").">";
echo "<td>";
make_link("", "tagfiles", (is_string ($key) ? $key : $val), $arguments = array("album" => htmlentities(rawurlencode($val))), false, null, "tagfiles");
echo "</td>";
echo "</tr>\n";
$counte++;
}
echo "</table>\n";
} else {
echo "</h2>\nNo albums found.<br />\n";
}
?>
</div>