Current live config.
[adorno.git] / inc / PlayTracks.php
bloba2e77dc6ef8ac2db1114e6196c70819063316d71
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 PgQuery( "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 alum
14 if ( isset($a) )
15 $qry = new PgQuery( "SELECT path_name, hash_key FROM tracks WHERE album = ? AND artist = ? ORDER BY setpart, tracknum;", $l, $a );
16 else
17 $qry = new PgQuery( "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 if ( $c->daemon_type == 'vlc' ) {
28 PlayTrack( $url, md5($url) );
30 // Attempt to update the database with the stream details
31 $sql = "SELECT 1 FROM streams WHERE stream_url = ?";
32 $qry = new PgQuery( $sql, $url );
33 if ( $qry->rows == 0 ) {
34 $sql = "INSERT INTO streams ( stream_url ) VALUES( ? )";
35 $qry = new PgQuery( $sql, $url );