2 require_once("always.php");
3 require_once("Session.php");
4 require_once("PlayTracks.php");
7 require_once("header.php");
9 function track_link( $trk, $link_title, $row_class = "" ) {
12 $track_link_url = sprintf( "?l=%s&a=%s&t=%s", urlencode($trk->album
), urlencode($trk->artist
)
13 , urlencode($trk->title
) );
14 $safe_title = htmlspecialchars($link_title);
15 $duration = preg_replace( "/^[0:]{1,4}/", "", $trk->duration
);
17 <tr class="track$row_class">
18 <td class="track$row_class">
19 <a class="track$row_class" href="artist.php$track_link_url$letter_get" title="$trk->path_na
22 <td class="track$row_class">$duration</td>
23 <th class="track$row_class">
24 <a class="alphabetica" href="edit_track.php$track_link_url" title="Edit Track Info">E</a>
33 function current_queue() {
34 if ( ! file_exists( "/var/run/adorno/queue.txt" ) ) return;
35 $fd = fopen( "/var/run/adorno/queue.txt", "r" );
38 * Build an array of the tracks
41 $track = fgets( $fd, 300 ); // Skip the "now playing" - it showed at the top.
42 $track = fgets( $fd, 300 ); // Skip the start time...
46 while( !feof( $fd ) ) {
47 $track = fgets( $fd, 300 );
48 $track = rtrim( $track, "\r\n");
49 $in_list .= ($position == 0 ?
"" : ", ") . qpg($track);
50 $queue_pos[$track] = $position++
;
56 * Select the track information from the database
58 $sql = sprintf("SELECT * FROM tracks WHERE path_name IN ( %s );", $in_list );
59 $qry = new PgQuery( $sql );
61 if ( $qry->Exec("current_queue",__LINE__
,__FILE__
) && $qry->rows
) {
62 while( $track = $qry->Fetch() ) {
63 $position = $queue_pos[$track->path_name
];
64 $queue[$position] = $track;
72 $tracks = current_queue();
73 echo '<table id="queue">';
74 foreach( $tracks AS $k => $v ) {
79 <span class="track_title">$track->title</span>
80 <span class="album_title">$track->album</span>
81 <span class="artist_name">$track->artist</span>