diff options
-rw-r--r-- | lib/class/album.class.php | 2 | ||||
-rw-r--r-- | lib/class/artist.class.php | 5 | ||||
-rw-r--r-- | lib/class/song.class.php | 6 | ||||
-rw-r--r-- | lib/class/xmldata.class.php | 24 |
4 files changed, 29 insertions, 8 deletions
diff --git a/lib/class/album.class.php b/lib/class/album.class.php index 91ea480a..c68fa587 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -262,6 +262,8 @@ class Album extends database_object { } $tags = Tag::get_top_tags('album',$this->id); + $this->tags = $tags; + $this->f_tags = Tag::get_display($tags,$this->id,'album'); diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index 75a415ca..a5261b10 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -239,8 +239,9 @@ class Artist extends database_object { $this->f_time = ltrim($hours . ':' . $min . ':' . $sec,'0:'); - $tags = Tag::get_top_tags('artist',$this->id); - $this->f_tags = Tag::get_display($tags,$this->id,'artist'); + $this->tags = Tag::get_top_tags('artist',$this->id); + + $this->f_tags = Tag::get_display($this->tags,$this->id,'artist'); return true; diff --git a/lib/class/song.class.php b/lib/class/song.class.php index 9ce008b4..ab255a48 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -690,12 +690,6 @@ class Song extends database_object implements media { $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 bdc1f5f6..e2a4ef2e 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -123,6 +123,23 @@ class xmlData { } // header /** + * tags_string + * This returns the formated 'tags' string for an xml document + */ + private static function tags_string($tags) { + + $string = ''; + + foreach ($tags as $tag_id) { + $tag = new Tag($tag_id); + $string .= "\t<tag id=\"$tag->id\"><![CDATA[$tag->name]]></tag>\n"; + } + + return $string; + + } // tags_string + + /** * keyed_array * This will build an xml document from a key'd array, */ @@ -171,9 +188,11 @@ class xmlData { $artist->format(); $rating = new Rating($artist_id,'artist'); + $tag_string = self::tags_string($artist->tags); $string .= "<artist id=\"$artist->id\">\n" . "\t<name><![CDATA[$artist->f_full_name]]></name>\n" . + $tag_string . "\t<albums>$artist->albums</albums>\n" . "\t<songs>$artist->songs</songs>\n" . "\t<preciserating>" . $rating->preciserating . "</preciserating>\n" . @@ -222,6 +241,7 @@ class xmlData { $string .= "\t<year>$album->year</year>\n" . "\t<tracks>$album->song_count</tracks>\n" . "\t<disk>$album->disk</disk>\n" . + self::tags_string($album->tags) . "\t<art><![CDATA[$art_url]]></art>\n" . "\t<preciserating>" . $rating->preciserating . "</preciserating>\n" . "\t<rating>" . $rating->rating . "</rating>\n" . @@ -290,6 +310,10 @@ class xmlData { $tag_string = ''; + $tag = new Tag($song->tags['0']); + $song->genre = $tag->id; + $song->f_genre = $tag->name; + // Build up the tag's text foreach ($song->tags as $tag_id) { $tag = new Tag($tag_id); |