diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-03-21 04:43:48 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-03-21 04:43:48 +0000 |
commit | 260b62361e031b3a0d4261e892170f294825ed61 (patch) | |
tree | 9ba79b0c5ac498c4cfd1caf896baa1d1caab7a84 | |
parent | 06652fe0406b45732ad80a3ab08c7d97bae4b47c (diff) | |
download | ampache-260b62361e031b3a0d4261e892170f294825ed61.tar.gz ampache-260b62361e031b3a0d4261e892170f294825ed61.tar.bz2 ampache-260b62361e031b3a0d4261e892170f294825ed61.zip |
fixed recently played, removed a bunch of useless files, added new methods to api as requested by dev, fixed some minor issues with enabling of localplay methods
-rw-r--r-- | admin/modules.php | 2 | ||||
-rwxr-xr-x | docs/CHANGELOG | 5 | ||||
-rw-r--r-- | lib/class/localplay.class.php | 2 | ||||
-rw-r--r-- | lib/class/preference.class.php | 2 | ||||
-rw-r--r-- | lib/class/song.class.php | 34 | ||||
-rw-r--r-- | lib/init.php | 2 | ||||
-rw-r--r-- | lib/rss.php | 2 | ||||
-rw-r--r-- | lib/song.php | 77 | ||||
-rw-r--r-- | modules/catalog.php | 238 | ||||
-rw-r--r-- | modules/localplay/xbmc.controller.php | 382 | ||||
-rw-r--r-- | server/ajax.server.php | 2 | ||||
-rw-r--r-- | server/xml.server.php | 13 | ||||
-rw-r--r-- | templates/show_index.inc.php | 2 | ||||
-rw-r--r-- | templates/show_user.inc.php | 2 |
14 files changed, 58 insertions, 707 deletions
diff --git a/admin/modules.php b/admin/modules.php index 498a1032..bc13eb22 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -45,6 +45,8 @@ switch ($_REQUEST['action']) { // Go ahead and enable Localplay (Admin->System) as we assume they want to do that // if they are enabling this Preference::update('allow_localplay_playback','-1','1'); + Preference::update('localplay_level',$GLOBALS['user']->id,'100'); + Preference::update('localplay_controller',$GLOBALS['user']->id,$localplay->type); header("Location:" . Config::get('web_path') . '/admin/modules.php?action=show_localplay'); break; diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 653b5b4f..90ae3879 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,11 @@ -------------------------------------------------------------------------- v.3.4-Beta3 + - Fixed recently played, only shows distinct songs + - Fixed enabling of localplay modules, now correctly enables + localplay for the activating user + - Added single genre and playlist XML methods + - Changed erorr message on XML api, now based of HTTP error codes - Split out ACL and Session Expire errors on XML API - Made Alpha Match box on browse "find as you type" (Thx Spocky) - Modified Shoutbox Styles (Thx Spocky) diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index 7d793fa1..f11f8089 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or diff --git a/lib/class/preference.class.php b/lib/class/preference.class.php index a844d1b0..1c299a35 100644 --- a/lib/class/preference.class.php +++ b/lib/class/preference.class.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All Rights Reserved This program is free software; you can redistribute it and/or diff --git a/lib/class/song.class.php b/lib/class/song.class.php index f53e39f6..454db4a2 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -831,7 +831,7 @@ class Song { * a stream URL taking into account the downsampling mojo and everything * else, this is used or will be used by _EVERYTHING_ */ - function get_url($session_id='',$force_http='') { + public function get_url($session_id='',$force_http='') { /* Define Variables we are going to need */ $user_id = $GLOBALS['user']->id ? scrub_out($GLOBALS['user']->id) : '-1'; @@ -873,6 +873,38 @@ class Song { } // get_url /** + * get_recently_played + * This function returns the last X songs that have been played + * it uses the popular threshold to figure out how many to pull + * it will only return unique object + */ + public static function get_recently_played($user_id='') { + + if ($user_id) { + $user_limit = " AND `object_count`.`user`='" . Dba::escape($user_id) . "'"; + } + + + $sql = "SELECT `object_count`.`object_id`,`object_count`.`user`,`object_count`.`object_type`, " . + "`object_count`.`date` " . + "FROM `object_count` " . + "WHERE `object_type`='song'$userlimit " . + "GROUP BY `object_count`.`object_id` " . + "ORDER BY `object_count`.`date` DESC " . + "LIMIT " . intval(Config::get('popular_threshold')); + $db_results = Dba::query($sql); + + $results = array(); + + while ($row = Dba::fetch_assoc($db_results)) { + $results[] = $row; + } + + return $results; + + } // get_recently_played + + /** * native_stream * This returns true/false if this can be nativly streamed */ diff --git a/lib/init.php b/lib/init.php index fb0f1d9e..58d846db 100644 --- a/lib/init.php +++ b/lib/init.php @@ -119,7 +119,6 @@ define('INIT_LOADED','1'); // Library and module includes we can't do with the autoloader require_once $prefix . '/lib/album.lib.php'; require_once $prefix . '/lib/artist.lib.php'; -require_once $prefix . '/lib/song.php'; require_once $prefix . '/lib/search.php'; require_once $prefix . '/lib/preferences.php'; require_once $prefix . '/lib/rss.php'; @@ -132,7 +131,6 @@ require_once $prefix . '/lib/stream.lib.php'; require_once $prefix . '/lib/xmlrpc.php'; require_once $prefix . '/lib/class/localplay.abstract.php'; require_once $prefix . '/modules/xmlrpc/xmlrpc.inc'; -require_once $prefix . '/modules/catalog.php'; require_once $prefix . '/modules/getid3/getid3.php'; require_once $prefix . '/modules/infotools/Snoopy.class.php'; require_once $prefix . '/modules/infotools/AmazonSearchEngine.class.php'; diff --git a/lib/rss.php b/lib/rss.php index 99c7ebaf..fb72022f 100644 --- a/lib/rss.php +++ b/lib/rss.php @@ -178,7 +178,7 @@ switch ($type) { case "recentlyplayed": $time_unit = array('',_('seconds ago'),_('minutes ago'),_('hours ago'),_('days ago'),_('weeks ago'),_('months ago'),_('years ago')); - $recent = get_recently_played(); + $recent = Song::get_recently_played(); echo " <channel>\n <title>$rss_recentlyplayed_title</title>\n"; echo " <link>$web_path</link>\n <description>$rss_main_description</description>\n"; diff --git a/lib/song.php b/lib/song.php deleted file mode 100644 index c9262e56..00000000 --- a/lib/song.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/* - - Copyright (c) 2001 - 2006 Ampache.org - 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 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 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/** - * Song Library - * This is for functions that don't make sense in the class because we aren't looking - * at a specific song... these should be general function that return arrays of songs - * and the like - */ - -/** - * 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($user_id='') { - - if ($user_id) { - $user_limit = " AND object_count.user='" . Dba::escape($user_id) . "'"; - } - - $sql = "SELECT object_count.object_id, object_count.user, object_count.object_type, object_count.date " . - "FROM object_count " . - "WHERE object_type='song'$user_limit " . - "ORDER by object_count.date DESC " . - "LIMIT " . Config::get('popular_threshold'); - $db_results = Dba::query($sql); - - $results = array(); - - while ($r = Dba::fetch_assoc($db_results)) { - $results[] = $r; - } - - return $results; - -} // get_recently_played - - -/** - * get_song_id_from_file - * This function takes a filename and returns it's best guess for a song id - * It is used by some of the localplay methods to go from filename to ampache - * song record for items that are manualy entered into the clients - */ -function get_song_id_from_file($filename) { - - $filename = Dba::escape($filename); - - $sql = "SELECT `id` FROM `song` WHERE `file` LIKE '%$filename'"; - $db_results = Dba::query($sql); - - $results = Dba::fetch_assoc($db_results); - - return $results['id']; - -} // get_song_id_from_file - -?> diff --git a/modules/catalog.php b/modules/catalog.php deleted file mode 100644 index 9b9c089a..00000000 --- a/modules/catalog.php +++ /dev/null @@ -1,238 +0,0 @@ -<?php -/* - Copyright (c) 2001 - 2007 Ampache.org - 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 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 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - Contains all of the catalog (local & remote) functions. - - DEAD FILE (Old Crap) - -*/ - -/* - * get_catalogs() - * - * return an array of catalog objects - * - */ - -function get_catalogs () { - global $dbh, $settings; - - $sql = "SELECT * FROM catalog"; - $db_result = mysql_query($sql, $dbh); - - $catalogs = array(); - while ( $catalog = mysql_fetch_object($db_result) ) { - $catalogs[] = $catalog; - } - - return ($catalogs); -} // get_catalogs() - - -/* - * update_artist_info() - * - * this will update the song and album counters for the artist - */ - -function update_artist_info($artist_id) { - GLOBAL $dbh, $settings; - - // get the count of songs - $query = "SELECT count(id) FROM song WHERE artist='$artist_id'"; - $db_result = mysql_query($query, $dbh); - - $r = mysql_fetch_row($db_result); - $artist->songs = $r[0]; - - // get the count of albums - $query = "SELECT count(DISTINCT album) FROM song WHERE artist='$artist_id'"; - $db_result = mysql_query($query, $dbh); - - $r = mysql_fetch_row($db_result); - $artist->albums = $r[0]; - - // now update the artist table - $query = "UPDATE artist SET songs='$artist->songs',albums='$artist->albums' WHERE id='$artist_id'"; - $db_result = mysql_query($query, $dbh); -} // update_artist_info() - - -/* - * select_artist() - * - * given an artist name (string) it will return: - * false: if the artist name doesn't exist - * true : if the artist name does exist - * in the database - * - */ - -function select_artist($artist) { - GLOBAL $dbh, $settings; - - $artist = sql_escape($artist); - - $sql = "SELECT id FROM artist WHERE name = '$artist'"; - $db_result = mysql_query( $sql, $dbh ); - $r = mysql_fetch_row( $db_result ); - - if ( $r[0] ) { - return ($r[0]); - } - else { - return 0; - } -} // select_artist() - - -/* - * insert_artist() - * - * given an artist name (string) it will insert an entry - * into the database, defaulting the catalog to 0 - * - */ - -/* -function insert_artist($artist, $catalog = 0) { - GLOBAL $dbh, $settings; - - $artist = sql_escape($artist); - - $sql = "INSERT INTO artist (name,catalog) VALUES ('$artist', $catalog)"; - $db_result = mysql_query($sql, $dbh); - - return (mysql_insert_id($dbh)); -} // insert_artist() -*/ - -/* - * update_artist_name() - * - * let's change the album name - * - */ - -function update_artist_name ($artist, $new_name) { - global $dbh, $settings; - - $query = "UPDATE artist SET name='$new_name' WHERE id='$artist'"; - $db_result = mysql_query($query, $dbh); -} // update_artist_name() - - -/* - * delete_artist() - * - * given an artist id (int) this will delete the associated - * entry from the database - * - */ - -function delete_artist($artist) { - GLOBAL $dbh, $settings; - - $sql = "DELETE FROM artist WHERE id = $artist"; - $db_result = mysql_query($sql, $dbh); -} // delete_artist() - - -/* - * select_album() - * - * given an album name and artist id, this will return: - * false: if the album name and artist id don't match - * id : of the album name and artist id match - */ - -function select_album($album, $artist) { - GLOBAL $dbh, $settings; - - $album = sql_escape($album); - - $sql = "SELECT id FROM album - WHERE name = '$album' AND artist = $artist"; - $db_result = mysql_query($sql, $dbh); - - $r = mysql_fetch_row($db_result); - - if ( $r[0] ) { - return ($r[0]); - } - else { - return 0; - } -} // select_album() - - -/* - * update_album_name() - * - * let's change the album name - * - */ - -function update_album_name ($album, $new_name) { - global $dbh, $settings; - - $sql = "UPDATE album SET name='$new_name' WHERE id='$album'"; - $db_result = mysql_query($sql, $dbh); -} // update_album_name() - - -/* - * update_local_mp3($name, $type, $songs) - * - * This will update all of the $songs with a new name of type $type. Used - * mostly for updating artist/album names for your _local_ mp3s. This - * will write out new ID3 tags. - */ - -function update_local_mp3($name, $type, $songs) { - // THIS IS DEAD!!! - //FIXME: I'm dead Jim! -} // update_local_mp3 - - - -/* - * get_check_array() - * - * returns a single dimension array of the md5 hashes - * for all songs in local catalogs - * - */ - -function get_check_array ( ) { - global $settings, $dbh; - - $check_array = array(); - - $sql = "SELECT md5 FROM song"; - $db_result = mysql_query($sql, $dbh ); - - while ( $md5 = mysql_fetch_object( $db_result ) ) - { - $check_array[] = $md5->md5; - } - - return $check_array; -} // get_check_array() - -?> diff --git a/modules/localplay/xbmc.controller.php b/modules/localplay/xbmc.controller.php deleted file mode 100644 index 213f9027..00000000 --- a/modules/localplay/xbmc.controller.php +++ /dev/null @@ -1,382 +0,0 @@ -<?php -/* - - Copyright 2001 - 2006 Ampache.org - 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. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/** - * AmpacheXBMC Class - * the Ampache XBMC Controller, this is the glue between - * the XBMC HTTPapi and the Ampahce Localplay class - */ -class AmpacheXBMC { - - /** - * Constructor - * This returns the array map for the localplay object - * REQUIRED for Localplay - */ - function AmpacheXBMC() { - - } // AmpacheXBMC - - - /** - * function_map - * This function returns a named array of the functions - * that this player supports and their names in this local - * class. This is a REQUIRED function - */ - function function_map() { - - $map = array(); - - /* Required Functions */ - $map['add'] = 'add_songs'; - $map['delete'] = 'delete_songs'; - $map['play'] = 'play'; - $map['stop'] = 'stop'; - $map['get'] = 'get_songs'; - $map['status'] = 'get_status'; - $map['connect'] = 'connect'; - - - /* Recommended Functions */ - $map['next'] = 'next'; - $map['prev'] = 'prev'; - $map['pause'] = 'pause'; - $map['volume_set'] = 'volume_set'; - - /* Optional Functions */ - $map['delete_all'] = 'clear_playlist'; - $map['shutdown'] = 'xbmc_shutdown'; - - return $map; - - } // function_map - - // - function aXBMCCmd($cmd, $param=''){ - - if($param == ''){ - $fs = fopen("http://" . conf('localplay_xbmc_hostname') . "/xbmcCmds/xbmcHttp?command=" . $cmd,"r"); - }else{ - $fs = fopen("http://" . conf('localplay_xbmc_hostname') . "/xbmcCmds/xbmcHttp?command=" . $cmd . "¶meter=" . $param,"r"); - } - - if($fs){ - stream_set_timeout($fs,2); - $ret = ""; - while (!feof($fs)) { - $ret = $ret . fgets($fs, 128); - } - fclose($fs); - - $ret = strip_tags($ret,"<li>"); - - $aret = explode("<li>",$ret); - $aret = array_slice($aret,1); - return $aret; - } - - return ""; - - } //aXBMCCmd - - function XBMCCmd($cmd, $param=''){ - - - if($param == ''){ - $fs = fopen("http://" . conf('localplay_xbmc_hostname') . "/xbmcCmds/xbmcHttp?command=" . $cmd,"r"); - }else{ - $fs = fopen("http://" . conf('localplay_xbmc_hostname') . "/xbmcCmds/xbmcHttp?command=" . $cmd . "¶meter=" . $param,"r"); - } - if($fs){ - stream_set_timeout($fs,1); - $ret = ""; - while (!feof($fs)) { - $ret = $ret . fgets($fs, 128); - } - fclose($fs); - - $ret = strip_tags($ret); - return trim($ret); - } - return ""; - - }//XBMCCmd - // - - /** - * preference - * This function returns an array of the preferences and their - * information for Ampache to use All preferences will get a - * localplay_xbmc_ appended to their name to avoid conflicts - * however this controller does not need to take that into acount - * REQUIRE for Locaplay - */ - function preferences() { - - $preferences = array(); - - $preferences[] = array('name'=>'hostname','default'=>'xbox','type'=>'string','description'=>'XBOX Hostname'); - $preferences[] = array('name'=>'smbpath','default'=>'smb://hostname/mp3/','type'=>'string','description'=>'Samba share path to mp3s'); - - //needed to add basic authentication support later - //$preferences[] = array('name'=>'username','default'=>'xbox','type'=>'string','description'=>'XBMC Username'); - //$preferences[] = array('name'=>'password','default'=>'','type'=>'string','description'=>'XBMC Password'); - - return $preferences; - - } // preferences - - - /** - * add_songs - * This must take an array of URL's from Ampache - * and then add them to XBMC - */ - function add_songs($songs) { - - //set playlist to music, playlist 0 - $ret = $this->XBMCCmd("SetCurrentPlaylist","0"); - - if ($ret != "OK") { - debug_event('xbmc_add','Error: Unable to set playlist on xbmc ' . $ret,'1'); - } - - - foreach ($songs as $song_id) { - $song = new Song($song_id); - - //print($song->get_rel_path()); - - $url = conf('localplay_xbmc_smbpath') . $song->get_rel_path(); - - //add song to playlist 0, note the ;0 after the url... - $ret = $this->XBMCCmd("AddToPlayList",urlencode($url . ";0")); - //print(urlencode($url).";0"); - - if ($ret != "OK") { - debug_event('xbmc_add','Error: Unable to add $url to xbmc ' . $ret,'1'); - } - - } // end foreach - - return true; - - } // add_songs - - - /** - * delete_songs - * This must take an array of ID's (as passed by get function) from Ampache - * and delete them from MPD - */ - function delete_songs($songs) { - - /* Default to true */ - $return = true; - - /* This should be an array of UID's as returned by - * the get function so that we can just call the class based - * functions to remove them or if there isn't a uid for - * the songs, then however ya'll have stored them - * in this controller - */ - - //RemoveFromPlaylist - foreach ($songs as $song_id) { - - $song = new Song($song_id); - - $url = conf('localplay_xbmc_smbpath') . $song->get_rel_path(); - - $ret = $this->XBMCCmd("RemoveFromPlaylist",urlencode($url . ";0")); - - if ($ret != "OK") { - $return = false; - debug_event('xbmc_del','Error: Unable to del $url from xbmc ' . $ret,'1'); - } - - - } // foreach of songs - - return $return; - - } // delete_songs - - - /** - * play - * This just tells XBMC to start playing, it does not - * take any arguments, it plays the NEXT track on the - * playlist or the first one if it is the first time... - */ - function play() { - - if ($this->XBMCCmd("PlayNext")!="OK") { return false; } - return true; - - } // play - - /** - * stop - * This just tells XBMC to stop playing, it does not take - * any arguments - */ - function stop() { - - if ($this->XBMCCmd("Stop")!="OK") { return false; } - return true; - - } // stop - - - /** - * next - * This just tells XBMC to skip to the next song - */ - function next() { - - if ($this->XBMCCmd("PlayNext")!="OK") { return false; } - return true; - - } // next - - /** - * prev - * This just tells XBMC to skip to the prev song - */ - function prev() { - - if ($this->XBMCCmd("PlayPrev")!="OK") { return false; } - return true; - - } // prev - - /** - * pause - * This tells XBMC to pause the current song - */ - function pause() { - - if ($this->XBMCCmd("Pause")!="OK") { return false; } - return true; - - } // pause - - - /** - * volume - * This tells XBMC to set the volume to the parameter - */ - function volume_set($volume) { - - if ($this->XBMCCmd("SetVolume",$volume)!="OK") { return false; } - return true; - - } // volume - - /** - * xbmc_shutdown - * This tells XBMC to turn off - */ - function xbmc_shutdown() { - - if ($this->XBMCCmd("shutdown")!="OK") { return false; } - return true; - - } // xbmc_shutdown - - /** - * clear_playlist - * This tells XBMC to clear the playlist - */ - function clear_playlist() { - - if ($this->XBMCCmd("clearplaylist","0")!="OK") { return false; } - return true; - - } // clear_playlist - - /** - * get_songs - * This functions returns an array containing information about - * The songs that XBMC currently has in it's playlist. This must be - * done in a standardized fashion - */ - function get_songs() { - - /* Get the Current Playlist */ - //echo $this->XBMCCmd("getcurrentplaylist"); - $playlist = $this->aXBMCCmd("getplaylistcontents","0"); - - foreach ($playlist as $entry) { - $data = array(); - - /* Required Elements */ - $data['id'] = get_song_id_from_file(trim(substr($entry,strrpos($entry,"/")+1))); - $data['raw'] = ''; - - - /* Optional Elements */ - $song = new Song($data['id']); - $song->format_song(); - $data['name'] = $song->f_artist . " - " . $song->f_title; - - $results[] = $data; - - } // foreach playlist items - - return $results; - - } // get_songs - - /** - * get_status - * This returns bool/int values for features, loop, repeat and any other features - * That this localplay method support - */ - function get_status() { - - /* Construct the Array */ - $array['state'] = false; //$this->_mpd->state; - $array['volume'] = $this->XBMCCmd("GetVolume"); - - return $array; - - } // get_status - - /** - * connect - * This functions tests the connection to XBMC and returns - * a boolean value for the status - */ - function connect() { - - if (is_null($this->XBMCCmd("help"))) { return false; } - - return true; - - } // connect - -} //end of AmpacheXBMC - -?> diff --git a/server/ajax.server.php b/server/ajax.server.php index bda613c5..2cca5c5a 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -289,7 +289,7 @@ switch ($_REQUEST['action']) { show_now_playing(); $results['now_playing'] = ob_get_contents(); ob_clean(); - $data = get_recently_played(); + $data = Song::get_recently_played(); if (count($data)) { show_box_top(_('Recently Played')); require_once Config::get('prefix') . '/templates/show_recently_played.inc.php'; diff --git a/server/xml.server.php b/server/xml.server.php index 5bb3ead3..b6deeec1 100644 --- a/server/xml.server.php +++ b/server/xml.server.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2008 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -174,6 +174,11 @@ switch ($_REQUEST['action']) { ob_end_clean(); echo xmlData::genres($genres); break; + case 'genre': + $uid = scrub_in($_REQUEST['filter']); + ob_end_clean(); + echo xmlData::genres(array($uid)); + break; case 'genre_artists': $genre = new Genre($_REQUEST['filter']); $artists = $genre->get_artists(); @@ -244,6 +249,12 @@ switch ($_REQUEST['action']) { ob_end_clean(); echo xmlData::playlists($playlist_ids); break; + case 'playlist': + $uid = scrub_in($_REQUEST['filter']); + + ob_end_clean(); + echo xmlData::playlists(array($uid)); + break; case 'playlist_songs': $playlist = new Playlist($_REQUEST['filter']); $items = $playlist->get_items(); diff --git a/templates/show_index.inc.php b/templates/show_index.inc.php index 3f56d73e..938313c8 100644 --- a/templates/show_index.inc.php +++ b/templates/show_index.inc.php @@ -40,7 +40,7 @@ <!-- Recently Played --> <div id="recently_played"> <?php - $data = get_recently_played(); + $data = Song::get_recently_played(); show_box_top(_('Recently Played')); if (count($data)) { require_once Config::get('prefix') . '/templates/show_recently_played.inc.php'; } show_box_bottom(); diff --git a/templates/show_user.inc.php b/templates/show_user.inc.php index 1765fb6b..96ca8773 100644 --- a/templates/show_user.inc.php +++ b/templates/show_user.inc.php @@ -66,7 +66,7 @@ $client->format(); <td> <?php echo "<h2>" . _('Recently Played') . "</h2>\n"; - $data = get_recently_played($client->id); + $data = Song::get_recently_played($client->id); require Config::get('prefix') . '/templates/show_recently_played.inc.php'; ?> </td> |