From 598db0d296a8c16e181b488040a324f9ae20cc33 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Tue, 9 Nov 2004 22:07:01 +0000 Subject: work in progress git-svn-id: https://svn.musicpd.org/mpd/branches/r2562-metadata-handling-rewrite@2566 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/metadataChunk.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/metadataChunk.c') 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); } -- cgit v1.2.3