From e4ad47579a65dadf9da009b525bf28c42bc7623a Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 9 Mar 2009 21:38:27 +0000 Subject: implement tag information on song xml document for the api, and put back genre (first tag) for backwards compatiblity --- lib/class/song.class.php | 8 ++++++++ lib/class/xmldata.class.php | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/class') diff --git a/lib/class/song.class.php b/lib/class/song.class.php index 029d45a4..9ce008b4 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -688,6 +688,14 @@ class Song extends database_object implements media { // Get the top tags $tags = Tag::get_top_tags('song',$this->id); + $this->tags = $tags; + + $tag = new Tag($tags['0']); + + // Emulate the genre information for legacy crap (API) + $this->f_genre = $tag->name; + $this->genre = $tag->id; + $this->f_tags = Tag::get_display($tags,$this->id,'song'); // Format the size diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index 01eb98cb..bdc1f5f6 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -288,6 +288,14 @@ class xmlData { $song = new Song($song_id); $song->format(); + $tag_string = ''; + + // Build up the tag's text + foreach ($song->tags as $tag_id) { + $tag = new Tag($tag_id); + $tag_string .= "\tid\">name]]>\n"; + } + $rating = new Rating($song_id,'song'); $art_url = Config::get('web_path') . '/image.php?id=' . $song->album . '&auth=' . scrub_out($_REQUEST['auth']); @@ -296,7 +304,8 @@ class xmlData { "\t<![CDATA[$song->title]]>\n" . "\tartist\">f_artist_full]]>\n" . "\talbum\">f_album_full]]>\n" . - "\tgenre\">genre]]>\n" . + "\tgenre\">f_genre]]>\n" . + $tag_string . "\t$song->track\n" . "\t\n" . "\t$song->mime\n" . -- cgit