summaryrefslogtreecommitdiffstats
path: root/artists.php
blob: 3511c1f94d9d0683c5d5bb9a126f8b4c33ee827c (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/*

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

/*

 Do most of the dirty work of displaying the mp3 catalog

*/

require_once("modules/init.php");

if (!isset($_REQUEST['match'])) { $_REQUEST['match'] = "Browse"; }
if (!isset($_REQUEST['action'])) { $_REQUEST['action'] = "match"; }
$action = scrub_in($_REQUEST['action']);

show_template('header');
show_menu_items('Artists'); 
show_clear();


switch($action) {
    case 'show':
    case 'Show':
	show_alphabet_list('artists','artists.php');
	$artist = new Artist(scrub_in($_REQUEST['artist']));
	$artist->show_albums();
	break;

    case 'show_all_songs':
        $artist = get_artist_name(scrub_in($_REQUEST['artist']));
        echo "<h2>" . _("All songs by") . " $artist</h2>";
        $song_ids = get_song_ids_from_artist($_REQUEST['artist']);
        show_songs($song_ids);
        break;

    case 'update_from_tags':

        $artist = new Artist($_REQUEST['artist']);

        echo "<br /><b>" . _("Starting Update from Tags") . ". . .</b><br />\n";

        $catalog = new Catalog();
        $catalog->update_single_item('artist',$_REQUEST['artist']);

        echo "<br /><b>" . _("Update From Tags Complete") . "</b> &nbsp;&nbsp;";
        echo "<a href=\"" . conf('web_path') . "/artists.php?action=show&amp;artist=" . $_REQUEST['artist'] . "\">[" . _("Return") . "]</a>";

	break;
    case 'match':
    case 'Match':
	$match = scrub_in($_REQUEST['match']);
	preg_match("/^(\w*)/", $match, $matches);
	show_alphabet_list('artists','artists.php',$match);
	if ($match === "Browse") {
		echo "<form name=\"f\" method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n";
		echo "<label for=\"match\" accesskey=\"S\">";
		echo _("<u>S</u>how artists starting with") . "</label> \n";
		echo "<input type=\"text\" size=\"3\" id=\"match\" name=\"match\" value=\"\" />\n";
		echo "<input type=\"hidden\" name=\"action\" value=\"match\" />\n";
		echo "</form>\n";
		show_artists();
	}
	elseif ($match === "Show_all") {
		echo "<form name=\"f\" method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n";
		echo "<label for=\"match\" accesskey=\"S\">";
		echo _("<u>S</u>how artists starting with") . "</label> ";
		echo "<input type=\"text\" size=\"3\" id=\"match\" name=\"match\" value=\"\" />\n";
		echo "<input type=\"hidden\" name=\"action\" value=\"match\" />\n";
		echo "</form>\n";
		$_SESSION['view_offset_limit'] = 999999;
		show_artists();
	}		
        else {
		$chr = preg_replace("/[^a-zA-Z0-9]/", "", $matches[1]);

		echo "<form name=\"f\" method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n";
		echo "<label for=\"match\" accesskey=\"S\">";
		echo _("<u>S</u>how artists starting with") . "</label> \n";
		echo "<input type=\"text\" size=\"3\" id=\"match\" name=\"match\" value=\"$chr\" />\n";
		echo "<input type=\"hidden\" name=\"action\" value=\"match\" />\n";
		echo "</p></form>\n";

		if ($chr == '') {
			show_artists('A');
		}
		else {
			show_artists($chr);
		}
	}
	break;

    default:
	echo "<form name=\"f\" method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n";
	echo "<label for=\"match\" accesskey=\"S\">";
	echo _("<u>S</u>how artists starting with") . "</label> \n";
	echo "<input type=\"text\" size=\"3\" id=\"match\" name=\"match\" value=\"\" />\n";
	echo "<input type=\"hidden\" name=\"action\" value=\"match\" />\n";
	echo "</p></form>\n";
	show_alphabet_list('artists','artists.php');
	show_artists('A');
	break;

}
echo "<br /><br />";
show_page_footer ('Artists', '',$user->prefs['display_menu']);
?>