From a41697ea25a58ea5db5ed46a251fb62364626b1b Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 26 Nov 2006 04:04:24 +0000 Subject: tweaked icons to use built in functions and removed them from where there were not icons for every optin, added recently played --- albums.php | 9 +++---- docs/CHANGELOG | 4 +++ index.php | 35 ++++++-------------------- lib/class/view.class.php | 11 ++++++-- lib/song.php | 26 ++++++++++++++++++- templates/show_album.inc | 7 +++--- templates/show_albums.inc | 2 +- templates/show_recently_played.inc.php | 46 ++++++++++++++++++++++++++++++++++ templates/show_songs.inc | 24 +++++++++++++----- 9 files changed, 118 insertions(+), 46 deletions(-) create mode 100644 templates/show_recently_played.inc.php diff --git a/albums.php b/albums.php index e679eafb..d7e21e5f 100644 --- a/albums.php +++ b/albums.php @@ -132,7 +132,7 @@ elseif ($_REQUEST['action'] === 'find_art') { fclose($handle); if (!empty($art)){ $album->insert_art($art,$mime); - show_confirmation(_("Album Art Inserted"),"","/albums.php?action=show&album=$album_id"); + show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=$album_id"); } else { show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to write acces error, or the file is not received corectly.'),"/albums.php?action=show&album=" . $album->id); @@ -160,7 +160,7 @@ elseif ($_REQUEST['action'] === 'select_art') { $album = new Album($album_id); $album->insert_art($image_data,$mime); - show_confirmation(_("Album Art Inserted"),"","/albums.php?action=show&album=$album_id"); + show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=$album_id"); } // end select art @@ -232,8 +232,7 @@ else { if ($match != 'Browse' && $match != 'Show_missing_art' && $match != 'Show_all') { $match_string = " AND album.name LIKE '$match%'"; } -// unset($_REQUEST['keep_view']); - $sql = "SELECT album.id, IF(COUNT(DISTINCT(song.artist)) > 1,'Various', artist.name) AS artist_name " . + $sort_sql = "SELECT album.id, IF(COUNT(DISTINCT(song.artist)) > 1,'Various', artist.name) AS artist_name " . "FROM song,artist,album WHERE song.album=album.id AND song.artist=artist.id $match_string" . "GROUP BY album.name,album.year ". "HAVING COUNT(song.id) > $min_album_size "; @@ -246,7 +245,7 @@ else { // if we are returning if ($_REQUEST['keep_view']) { - $view->initialize(); + $view->initialize($sort_sql); } // If we aren't keeping the view then initlize it diff --git a/docs/CHANGELOG b/docs/CHANGELOG index b220d77d..e8561612 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,10 @@ -------------------------------------------------------------------------- v.3.3.3-Beta1 + - Tweaked home page a little, remove pop songs and recent artists + - Added Recently Played to Main Page + - Fixed an issue on Browse by Albums and sorting by Artist after + sorting by something else - Added initial Tag writting script (Thx Jirwin) - Updated flag class to make it easier to create a tag writer - Fixed some potential issues with sort_files.php.inc diff --git a/index.php b/index.php index 0b06892d..5db87f4c 100644 --- a/index.php +++ b/index.php @@ -46,13 +46,16 @@ if (conf('refresh_limit') > 5) {
- + +
+ +
- - - - -
- +
- - - - - - -
@@ -65,8 +68,6 @@ if (conf('refresh_limit') > 5) { ?>
 
 
5) { ?> - -
 
- - 5) {
-
diff --git a/lib/class/view.class.php b/lib/class/view.class.php index afc81b22..4f58677a 100644 --- a/lib/class/view.class.php +++ b/lib/class/view.class.php @@ -167,8 +167,15 @@ class View { @discussion initializes the view object, checks $_REQUEST for changes to the view object */ - function initialize() { - + function initialize($sql='') { + + /* From time to time we need to change the SQL statement while + * maintaining the paging + */ + if ($sql) { + $this->change_sql($sql); + } + if ($_REQUEST['sort_type']) { $this->change_sort_type($_REQUEST['sort_type']); } diff --git a/lib/song.php b/lib/song.php index 5156ca88..b1d3579d 100644 --- a/lib/song.php +++ b/lib/song.php @@ -42,7 +42,31 @@ function get_songs($sql, $action=0) { return $results; -} // get_albums +} // get_songs + +/** + * get_recently_played + * This function returns the last X songs that have been played + * It uses the 'popular' threshold to determine how many to pull + */ +function get_recently_played() { + + $sql = "SELECT object_count.object_id, object_count.user, object_count.object_type, object_count.date " . + "FROM object_count " . + "WHERE object_type='song' " . + "ORDER by object_count.date DESC " . + "LIMIT " . conf('popular_threshold'); + $db_results = mysql_query($sql, dbh()); + + $results = array(); + + while ($r = mysql_fetch_assoc($db_results)) { + $results[] = $r; + } + + return $results; + +} // get_recently_played /*! @function format_song diff --git a/templates/show_album.inc b/templates/show_album.inc index 2768cc3b..d1251407 100644 --- a/templates/show_album.inc +++ b/templates/show_album.inc @@ -5,9 +5,8 @@ All rights reserved. This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -63,7 +62,7 @@ $title = scrub_out($album->name) . ' -- ' . $album->f_artist;   
-    
+   
diff --git a/templates/show_albums.inc b/templates/show_albums.inc index e9fb597d..e76d2b1a 100644 --- a/templates/show_albums.inc +++ b/templates/show_albums.inc @@ -61,7 +61,7 @@ foreach ($albums as $album) { | - | <?php echo _('Download'); ?> + | diff --git a/templates/show_recently_played.inc.php b/templates/show_recently_played.inc.php new file mode 100644 index 00000000..eeae6186 --- /dev/null +++ b/templates/show_recently_played.inc.php @@ -0,0 +1,46 @@ + + + + + + + + +format_song(); + /* Prepare the variables */ + $title = scrub_out(truncate_with_ellipse($song->title,'25')); + $album = scrub_out(truncate_with_ellipse($song->f_album_full,'25')); + $artist = scrub_out(truncate_with_ellipse($song->f_artist_full,'25')); + $song_name = $title . ' - ' . $album . '/' . $artist; +?> + + + + + + +
fullname); ?>
+ diff --git a/templates/show_songs.inc b/templates/show_songs.inc index 300749ef..0aca4c17 100644 --- a/templates/show_songs.inc +++ b/templates/show_songs.inc @@ -130,20 +130,32 @@ foreach ($song_ids as $song_id) { - <?php echo _('Flag'); ?> + + + has_access('100')) { ?> - | <?php echo _('Edit'); ?> | + | + + | enabled) { ?> - <?php echo _('Disable'); ?> + + + - <?php echo _('Enable'); ?> + + + prefs['download']) { ?> - | title . "." . $song->type); ?>"><?php echo _('Download'); ?> + | title . "." . $song->type); ?>"> + + prefs['direct_link']) { ?> - | <?php echo _('Direct Link'); ?> + | + + -- cgit