Add a dequeue image.
[adorno.git] / inc / PlayTracks.php
blob7f3dd1cf2b5d1056e4f88414c7e285f1ad9cab0b
1 <?php
3 if ( isset($_GET['act']) && $_GET['act'] == 'no' && ( !isset($_POST['act']) || $_POST['act'] == 'no') ) return;
5 if ( isset($l) && isset($a) && isset($t) ) {
6 $qry = new AwlQuery( "SELECT path_name, hash_key FROM tracks WHERE album = ? AND artist = ? AND title = ? ", $l, $a, $t );
7 if ( $qry->Exec("PlayTracks") && $qry->rows() == 1 ) {
8 $track = $qry->Fetch();
9 PlayTrack( $track->path_name, $track->hash_key );
12 else if ( ( isset($a) || (isset($play) && $play > 0) ) && isset($l) ) {
13 // Play all of the tracks for this album
14 if ( isset($a) )
15 $qry = new AwlQuery( "SELECT path_name, hash_key FROM tracks WHERE album = ? AND artist = ? ORDER BY setpart, tracknum;", $l, $a );
16 else
17 $qry = new AwlQuery( "SELECT path_name, hash_key FROM tracks WHERE album = ? ORDER BY setpart, tracknum;", $l );
18 if ( $qry->Exec("PlayTracks") && $qry->rows() > 0 ) {
19 while( $track = $qry->Fetch() ) {
20 PlayTrack( $track->path_name, $track->hash_key );
24 else if ( ( isset($_POST['url']) && $_POST['act'] == 'Play URL' )
25 || ( isset($_GET['url']) && $_GET['act'] == 'Play URL' ) ) {
26 $url = ( isset($_POST['url']) ? $_POST['url'] : $_GET['url'] );
27 PlayTrack( $url, md5($url) );
29 // Attempt to update the database with the stream details
30 $sql = "SELECT 1 FROM streams WHERE stream_url = ?";
31 $qry = new AwlQuery( $sql, $url );
32 if ( $qry->rows() == 0 ) {
33 $sql = "INSERT INTO streams ( stream_url ) VALUES( ? )";
34 $qry = new AwlQuery( $sql, $url );
37 else if ( isset($_GET['i']) && isset($_GET['d']) ) {
38 daemon_move( intval($_GET['i']), (substr($_GET['d'],0,1) == 'd' ? 1 : -1) );