aboutsummaryrefslogtreecommitdiffstats
path: root/src/metadataChunk.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-09 22:07:01 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-09 22:07:01 +0000
commit598db0d296a8c16e181b488040a324f9ae20cc33 (patch)
treef42184b12895cd9fad298f0db6808fa262c1e5c9 /src/metadataChunk.c
parent4abf1b7d56425be009c8d6826a753b8682bc7c22 (diff)
downloadmpd-598db0d296a8c16e181b488040a324f9ae20cc33.tar.gz
mpd-598db0d296a8c16e181b488040a324f9ae20cc33.tar.xz
mpd-598db0d296a8c16e181b488040a324f9ae20cc33.zip
work in progress
git-svn-id: https://svn.musicpd.org/mpd/branches/r2562-metadata-handling-rewrite@2566 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/metadataChunk.c')
-rw-r--r--src/metadataChunk.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/metadataChunk.c b/src/metadataChunk.c
index 84817eb0e..40da4c512 100644
--- a/src/metadataChunk.c
+++ b/src/metadataChunk.c
@@ -29,9 +29,9 @@ void initMetadataChunk(MetadataChunk * chunk) {
chunk->title = -1;
}
-#define dupElementToTag(string, element) { \
+#define dupElementToTag(item, element) { \
if(element >= 0 && element < METADATA_BUFFER_LENGTH) { \
- string = strdup(chunk->buffer+element); \
+ addItemToMpdTag(ret, item, chunk->buffer+element); \
} \
}
@@ -40,10 +40,10 @@ MpdTag * metadataChunkToMpdTagDup(MetadataChunk * chunk) {
chunk->buffer[METADATA_BUFFER_LENGTH-1] = '\0';
- dupElementToTag(ret->name, chunk->name);
- dupElementToTag(ret->title, chunk->title);
- dupElementToTag(ret->artist, chunk->artist);
- dupElementToTag(ret->album, chunk->album);
+ dupElementToTag(TAG_ITEM_NAME, chunk->name);
+ dupElementToTag(TAG_ITEM_TITLE, chunk->title);
+ dupElementToTag(TAG_ITEM_ARTIST, chunk->artist);
+ dupElementToTag(TAG_ITEM_ALBUM, chunk->album);
return ret;
}
@@ -67,8 +67,16 @@ void copyMpdTagToMetadataChunk(MpdTag * tag, MetadataChunk * chunk) {
if(!tag) return;
- copyStringToChunk(tag->name, chunk->name);
- copyStringToChunk(tag->title, chunk->title);
- copyStringToChunk(tag->artist, chunk->artist);
- copyStringToChunk(tag->album, chunk->album);
+ copyStringToChunk(
+ getNextItemFromMpdTag(tag, TAG_ITEM_NAME, NULL),
+ chunk->name);
+ copyStringToChunk(
+ getNextItemFromMpdTag(tag, TAG_ITEM_TITLE, NULL),
+ chunk->title);
+ copyStringToChunk(
+ getNextItemFromMpdTag(tag, TAG_ITEM_ARTIST, NULL),
+ chunk->title);
+ copyStringToChunk(
+ getNextItemFromMpdTag(tag, TAG_ITEM_ALBUM, NULL),
+ chunk->album);
}