From df348122a7092a24a4ae5c04cf0b5b85bd750ae0 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Wed, 22 Aug 2007 05:36:07 +0000 Subject: added the initial playlist view page, fixed the artist name on albums of the moment --- docs/CHANGELOG | 2 ++ lib/class/album.class.php | 6 ++-- lib/class/playlist.class.php | 4 +-- lib/class/user.class.php | 2 +- templates/show_album_row.inc.php | 2 +- templates/show_playlist.inc.php | 6 ++++ templates/show_playlist_song_row.inc.php | 35 +++++++++++++++++++ templates/show_playlist_songs.inc.php | 59 ++++++++++++++++++++++++++++++++ templates/show_random_albums.inc.php | 2 +- 9 files changed, 111 insertions(+), 7 deletions(-) create mode 100644 templates/show_playlist_song_row.inc.php create mode 100644 templates/show_playlist_songs.inc.php diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 4b099eca..6faed6db 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.4-Alpha2 + - Fixed missing artist name on Albums of the Moment + - Added simple Playlist element view, non-editable - Fixed double posting of songs on a single stream with some clients - Updated LastFM protocol to v1.2 diff --git a/lib/class/album.class.php b/lib/class/album.class.php index dc42aa2d..f19d26cc 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -215,10 +215,12 @@ class Album { $this->f_title = $name; if ($this->artist_count == '1') { $artist = scrub_out(truncate_with_ellipsis(trim($this->artist_prefix . ' ' . $this->artist_name),Config::get('ellipsis_threshold_album'))); - $this->f_artist = "artist_id . "\">" . $artist . ""; + $this->f_artist_link = "artist_id . "\">" . $artist . ""; + $this->f_artist = $artist; } else { - $this->f_artist = "
artist_count " . _('Artists') . "\">" . _('Various') . "
"; + $this->f_artist_link = "
artist_count " . _('Artists') . "\">" . _('Various') . "
"; + $this->f_artist = _('Various'); } if ($this->year == '0') { diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php index 493e335a..fcc7f028 100644 --- a/lib/class/playlist.class.php +++ b/lib/class/playlist.class.php @@ -108,7 +108,7 @@ class Playlist { $results = array(); - $sql = "SELECT `object_id`,`object_type`,`dynamic_song` FROM `playlist_data` WHERE `playlist`='" . Dba::escape($this->id) . "' ORDER BY `track`"; + $sql = "SELECT `object_id`,`object_type`,`dynamic_song`,`track` FROM `playlist_data` WHERE `playlist`='" . Dba::escape($this->id) . "' ORDER BY `track`"; $db_results = Dba::query($sql); while ($row = Dba::fetch_assoc($db_results)) { @@ -117,7 +117,7 @@ class Playlist { // Do something here FIXME! } - $results[] = array('type'=>$row['object_type'],'object_id'=>$row['object_id']); + $results[] = array('type'=>$row['object_type'],'object_id'=>$row['object_id'],'track'=>$row['track']); } // end while return $results; diff --git a/lib/class/user.class.php b/lib/class/user.class.php index ca74badf..9ecc247a 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -568,7 +568,7 @@ class User { $last_song = new Song($data['object_id']); if ($data['date']+($song_info->time/2) >= time()) { debug_event('Stats','Not collecting stats less then 50% of song has elapsed','3'); - return false; + return false; } // Check if lastfm is loaded, if so run the update diff --git a/templates/show_album_row.inc.php b/templates/show_album_row.inc.php index 649888e6..7753816e 100644 --- a/templates/show_album_row.inc.php +++ b/templates/show_album_row.inc.php @@ -30,7 +30,7 @@ f_name_link; ?> -f_artist; ?> +f_artist_link; ?> song_count; ?> year; ?> diff --git a/templates/show_playlist.inc.php b/templates/show_playlist.inc.php index 5e99b8a9..6c14210d 100644 --- a/templates/show_playlist.inc.php +++ b/templates/show_playlist.inc.php @@ -31,5 +31,11 @@ $web_path = Config::get('web_path');
  • +
    +get_items(); + require_once Config::get('prefix') . '/templates/show_playlist_songs.inc.php'; +?>
    + diff --git a/templates/show_playlist_song_row.inc.php b/templates/show_playlist_song_row.inc.php new file mode 100644 index 00000000..354f8419 --- /dev/null +++ b/templates/show_playlist_song_row.inc.php @@ -0,0 +1,35 @@ + + +f_link; ?> +f_artist_link; ?> +f_album_link; ?> +f_genre_link; ?> +f_track; ?> +f_time; ?> + + prefs['download']) { ?> + + + + + diff --git a/templates/show_playlist_songs.inc.php b/templates/show_playlist_songs.inc.php new file mode 100644 index 00000000..d1479a90 --- /dev/null +++ b/templates/show_playlist_songs.inc.php @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + +format(); + $playlist_track = $object['track']; +?> + + + + + + + +
    + +
    + +
    + +
    diff --git a/templates/show_random_albums.inc.php b/templates/show_random_albums.inc.php index e8e4749d..6a15e58a 100644 --- a/templates/show_random_albums.inc.php +++ b/templates/show_random_albums.inc.php @@ -26,7 +26,7 @@ $web_path = Config::get('web_path'); foreach ($albums as $album_id) { $album = new Album($album_id); $album->format(); - $name = scrub_out('[' . $album->artist . '] ' . $album->name); + $name = scrub_out('[' . $album->f_artist . '] ' . $album->name); ?>
    -- cgit