aboutsummaryrefslogtreecommitdiffstats
path: root/src/DespotifyUtils.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-03 11:31:55 +0100
committerMax Kellermann <max@duempel.org>2013-12-03 11:46:31 +0100
commit69867015e97183fb36e5bb85ea190583f7f60082 (patch)
tree035c226fa16b60415d3f4a429510d53301834f40 /src/DespotifyUtils.cxx
parent923f18ef76a2a15d1451e97a9437b70bb38eefb3 (diff)
downloadmpd-69867015e97183fb36e5bb85ea190583f7f60082.tar.gz
mpd-69867015e97183fb36e5bb85ea190583f7f60082.tar.xz
mpd-69867015e97183fb36e5bb85ea190583f7f60082.zip
DespotifyUtils: use class TagBuilder
Diffstat (limited to '')
-rw-r--r--src/DespotifyUtils.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/DespotifyUtils.cxx b/src/DespotifyUtils.cxx
index e91587a7f..5bfcfd6a4 100644
--- a/src/DespotifyUtils.cxx
+++ b/src/DespotifyUtils.cxx
@@ -19,6 +19,7 @@
#include "DespotifyUtils.hxx"
#include "tag/Tag.hxx"
+#include "tag/TagBuilder.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "util/Domain.hxx"
@@ -90,25 +91,24 @@ mpd_despotify_tag_from_track(struct ds_track *track)
char comment[80];
char date[20];
- Tag *tag = new Tag();
-
if (!track->has_meta_data)
- return tag;
+ return new Tag();
+ TagBuilder tag;
snprintf(tracknum, sizeof(tracknum), "%d", track->tracknumber);
snprintf(date, sizeof(date), "%d", track->year);
snprintf(comment, sizeof(comment), "Bitrate %d Kbps, %sgeo restricted",
track->file_bitrate / 1000,
track->geo_restricted ? "" : "not ");
- tag->AddItem(TAG_TITLE, track->title);
- tag->AddItem(TAG_ARTIST, track->artist->name);
- tag->AddItem(TAG_TRACK, tracknum);
- tag->AddItem(TAG_ALBUM, track->album);
- tag->AddItem(TAG_DATE, date);
- tag->AddItem(TAG_COMMENT, comment);
- tag->time = track->length / 1000;
-
- return tag;
+ tag.AddItem(TAG_TITLE, track->title);
+ tag.AddItem(TAG_ARTIST, track->artist->name);
+ tag.AddItem(TAG_TRACK, tracknum);
+ tag.AddItem(TAG_ALBUM, track->album);
+ tag.AddItem(TAG_DATE, date);
+ tag.AddItem(TAG_COMMENT, comment);
+ tag.SetTime(track->length / 1000);
+
+ return tag.Commit();
}
struct despotify_session *mpd_despotify_get_session(void)