Add a dequeue image.
[adorno.git] / www / action.php
bloba1748ce59857cec69c3d94b2e8d4c2233bd3a660
1 <?php
2 include('always.php');
4 header('Content-type: text/plain');
6 // echo "Action=" . $action, "\n";
7 switch( $action ) {
8 case 'enqueue':
9 if ( isset($url) ) {
10 PlayTrack( $url, md5($url) );
12 // Attempt to update the database with the stream details
13 $sql = "SELECT 1 FROM streams WHERE stream_url = ?";
14 $qry = new AwlQuery( $sql, $url );
15 if ( $qry->rows() == 0 ) {
16 $sql = "INSERT INTO streams ( stream_url ) VALUES( ? )";
17 $qry = new AwlQuery( $sql, $url );
19 // echo "Playing $url\n";
21 else {
22 $sql = 'SELECT path_name, hash_key FROM tracks WHERE album = :album ';
23 $params = array( ':album' => $l );
24 if ( isset($a) && $a != '' ) {
25 $sql .= 'AND artist = :artist ';
26 $params[':artist'] = $a;
28 if ( isset($t) && $t != '' ) {
29 $sql .= 'AND title = :title ';
30 $params[':title'] = $t;
32 $sql .= 'ORDER BY setpart, tracknum';
33 echo $sql;
34 print_r( $params );
36 $qry = new AwlQuery( $sql, $params );
37 if ( $qry->Exec("PlayTracks") && $qry->rows() > 0 ) {
38 while( $track = $qry->Fetch() ) {
39 PlayTrack( $track->path_name, $track->hash_key );
40 // echo "Playing $track->path_name\n";
44 break;
47 case 'move':
48 param_to_global( 'i', 'int' );
49 param_to_global( 'd', '{^[ud]}' );
50 daemon_move( $i, (substr($d,0,1) == 'd' ? 1 : -1) );
51 break;
54 default:
55 daemon_other_command($action,null);
56 break;