diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-11-19 17:02:37 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-11-19 17:02:37 +0000 |
commit | 0bd925f488affe2f2a82a8be5e1e461d2f1ebae3 (patch) | |
tree | e6701669a2f6a80fc6e4530e28382a18819afe32 /lib/class/xmldata.class.php | |
parent | 0d0f8c23f44af61211c40087cfeda80dbf254e71 (diff) | |
download | ampache-0bd925f488affe2f2a82a8be5e1e461d2f1ebae3.tar.gz ampache-0bd925f488affe2f2a82a8be5e1e461d2f1ebae3.tar.bz2 ampache-0bd925f488affe2f2a82a8be5e1e461d2f1ebae3.zip |
add the ratings to the album and artist xml results, fixed a logic error on the api session extending
Diffstat (limited to 'lib/class/xmldata.class.php')
-rw-r--r-- | lib/class/xmldata.class.php | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index 807a9a5d..a22805c8 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -131,15 +131,21 @@ class xmlData { } $string = ''; + + Rating::build_cache('artist',$artists); foreach ($artists as $artist_id) { $artist = new Artist($artist_id); $artist->format(); + $rating = new Rating($artist_id,'artist'); + $string .= "<artist id=\"$artist->id\">\n" . "\t<name><![CDATA[$artist->f_full_name]]></name>\n" . "\t<albums>$artist->albums</albums>\n" . "\t<songs>$artist->songs</songs>\n" . + "\t<preciserating>" . $rating->preciserating . "</preciserating>\n" . + "\t<rating>" . $rating->rating . "</rating>\n" . "</artist>\n"; } // end foreach artists @@ -158,11 +164,15 @@ class xmlData { if (count($albums) > self::$limit) { $albums = array_splice($albums,self::$offset,self::$limit); } + + Rating::build_cache('album',$albums); foreach ($albums as $album_id) { $album = new Album($album_id); $album->format(); + $rating = new Rating($album_id,'album'); + // Build the Art URL, include session $art_url = Config::get('web_path') . '/image.php?id=' . $album->id . '&auth=' . scrub_out($_REQUEST['auth']); @@ -181,6 +191,8 @@ class xmlData { "\t<tracks>$album->song_count</tracks>\n" . "\t<disk>$album->disk</disk>\n" . "\t<art><![CDATA[$art_url]]></art>\n" . + "\t<preciserating>" . $rating->preciserating . "</preciserating>\n" . + "\t<rating>" . $rating->rating . "</rating>\n" . "</album>\n"; } // end foreach @@ -191,39 +203,6 @@ class xmlData { } // albums /** - * genres - * This takes an array of genre ids and returns a nice little pretty xml doc - */ - public static function genres($genres) { - - if (count($genres) > self::$limit) { - $genres = array_slice($genres,self::$offset,self::$limit); - } - - // Foreach the ids - foreach ($genres as $genre_id) { - $genre = new Genre($genre_id); - $genre->format(); - $song_count = $genre->get_song_count(); - $album_count = $genre->get_album_count(); - $artist_count = $genre->get_artist_count(); - - $string .= "<genre id=\"$genre->id\">\n" . - "\t<name><![CDATA[$genre->name]]></name>\n" . - "\t<songs>$song_count</songs>\n" . - "\t<albums>$album_count</albums>\n" . - "\t<artists>$artist_count</artists>\n" . - "</genre>\n"; - - } // end foreach - - $final = self::_header() . $string . self::_footer(); - - return $final; - - } // genres - - /** * playlists * This takes an array of playlist ids and then returns a nice pretty XML document */ @@ -269,6 +248,8 @@ class xmlData { $songs = array_slice($songs,self::$offset,self::$limit); } + Rating::build_cache('song',$songs); + // Foreach the ids! foreach ($songs as $song_id) { $song = new Song($song_id); |