From 0a69091a93aef8c367e0383c262cdac11624c882 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 24 Dec 2006 22:48:37 +1300 Subject: [PATCH] Add display of most recent play date. --- www/artist.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/www/artist.php b/www/artist.php index 508dd82..82c7f47 100644 --- a/www/artist.php +++ b/www/artist.php @@ -15,12 +15,14 @@ function track_link( $trk, $link_title, $row_class = "" ) { $track_link_url = sprintf( "?l=%s&a=%s&t=%s", urlencode($trk->album), urlencode($trk->artist), urlencode($trk->title) ); $safe_title = htmlspecialchars($link_title); $duration = preg_replace( "/^[0:]{1,4}/", "", $trk->duration ); + $last_played = ($trk->last_played == '-infinity'?"-":substr($trk->last_played,0,10)); $link = << $safe_title - $duration + $last_played + $duration E @@ -34,10 +36,10 @@ EOHTML; echo "\n"; - echo "
\n"; + echo "\n"; if ( isset($a) ) { $qa = "SELECT artist, album, title, tracknum, path_name, duration::interval(0), "; - $qa .= "extract( EPOCH FROM duration)::int AS secs, quality "; + $qa .= "extract( EPOCH FROM duration)::int AS secs, quality, get_last_played(hash_key) AS last_played "; $qa .= "FROM tracks WHERE lower(artist) = lower('" . addslashes($a) . "') "; $qa .= "ORDER BY lower(album), setpart, tracknum; "; $res = awm_pgexec( $dbconn, $qa, "db"); @@ -48,8 +50,9 @@ EOHTML; $track = pg_Fetch_Object( $res, $i ); if ( $track->album != "" && $track->album != $last_album ) { if ( $i > 1 ) echo "
"; - echo "
"; + echo "
\n"; + echo ""; echo ""; echo ""; $last_album = $track->album; @@ -66,7 +69,7 @@ EOHTML; } else if ( isset( $l ) ) { $qa = "SELECT artist, album, title, tracknum, path_name, duration::interval(0), "; - $qa .= "extract( EPOCH FROM duration)::int AS secs, quality "; + $qa .= "extract( EPOCH FROM duration)::int AS secs, quality, get_last_played(hash_key) AS last_played "; $qa .= "FROM tracks WHERE album = '" . addslashes($l) . "' "; $qa .= "ORDER BY album, setpart, tracknum; "; $res = awm_pgexec( $dbconn, $qa, "db"); @@ -76,8 +79,9 @@ EOHTML; for ( $i = 0; $i < pg_NumRows($res); $i++ ) { $track = pg_Fetch_Object( $res, $i ); if ( $track->artist != "" && $track->artist != $last_artist ) { - echo "
"; echo "artist) . "&l=" . urlencode($track->album) . "$letter_get\">".htmlspecialchars($track->album)."  album) . "&a=" . urlencode($track->artist) . "\" title=\"Edit Album Info\">E
"; + echo "
\n"; + echo ""; echo ""; echo ""; $last_artist = $track->artist; @@ -96,7 +100,7 @@ EOHTML; } echo ""; - echo "
"; echo "artist) . "&l=" . urlencode($track->album) . "$letter_get\">$track->artist  album) . "&a=" . urlencode($track->artist) . "\" title=\"Edit Album Info\">E
\n"; + echo "\n"; echo "

Artists

\n

"; if ( isset($altr) || isset($search) ) { $altr = trim("$altr"); @@ -123,4 +127,4 @@ EOHTML; } include("footers.php"); -?> \ No newline at end of file +?> -- 2.11.4.GIT