3 function PlayTrack( $path, $hash ) {
4 $fifo = fopen( "/var/run/adorno/fifo", "w" );
5 fputs( $fifo, "queue $path\n" );
7 error_log( sprintf("DBG: PlayTrack: Queueing '%s' for playing", $path) );
9 $qry = new PgQuery( "SELECT track_played(?) ", $hash );
10 $qry->Exec("PlayTrack");
13 if ( isset($l) && isset($a) && isset($t) ) {
14 $qry = new PgQuery( "SELECT path_name, hash_key FROM tracks WHERE album = ? AND artist = ? AND title = ? ", $l, $a, $t );
15 if ( $qry->Exec("PlayTracks") && $qry->rows
== 1 ) {
16 $track = $qry->Fetch();
17 PlayTrack( $track->path_name
, $track->hash_key
);
20 else if ( ( isset($a) ||
(isset($play) && $play > 0) ) && isset($l) ) {
21 // Play all of the tracks for this alum
23 $qry = new PgQuery( "SELECT path_name, hash_key FROM tracks WHERE album = ? AND artist = ? ORDER BY setpart, tracknum;", $l, $a );
25 $qry = new PgQuery( "SELECT path_name, hash_key FROM tracks WHERE album = ? ORDER BY setpart, tracknum;", $l );
26 if ( $qry->Exec("PlayTracks") && $qry->rows
> 0 ) {
27 while( $track = $qry->Fetch() ) {
28 PlayTrack( $track->path_name
, $track->hash_key
);