From ffd91b653bef249d38d9ecde18a5d993fc8a081d Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 22 Oct 2012 22:15:00 +0200 Subject: [PATCH 8/8] Using himd_set_track_label in himd_writemp3 of himdcli --- himdcli/himdcli.c | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/himdcli/himdcli.c b/himdcli/himdcli.c index d3ea350..a8eba15 100644 --- a/himdcli/himdcli.c +++ b/himdcli/himdcli.c @@ -649,46 +649,15 @@ void himd_writemp3(struct himd *h, const char *filepath) idx_frag = himd_add_fragment_info(h, &fragment, &status); // END: Add fragment - // Add strings for title, album and artist. Retrieve string index numbers. - gint idx_title=0, idx_album=0, idx_artist=0; - - if(title != NULL) { - idx_title = himd_add_string(h, title, STRING_TYPE_TITLE, &status); - if(idx_title < 0) - { - printf("Failed to add title string\n"); - idx_title = 0; - } - } - - if(album != NULL) { - idx_album = himd_add_string(h, album, STRING_TYPE_ALBUM, &status); - if(idx_album < 0) - { - printf("Failed to add album string\n"); - idx_album = 0; - } - } - - if(artist != NULL) { - idx_artist = himd_add_string(h, artist, STRING_TYPE_ARTIST, &status); - if(idx_artist < 0) - { - printf("Failed to add artist string\n"); - idx_artist = 0; - } - } - // END: Add strings - // // Add track descriptor, get trackno back. // struct trackinfo track; memset(&track.key, 0, 8); /* use zero key on mp3 files */ - track.title = idx_title; - track.artist = idx_artist; - track.album = idx_album; + track.title = 0; /* We'll set title, artist and album later */ + track.artist = 0; + track.album = 0; track.firstfrag = idx_frag; track.tracknum = 1; track.ekbnum = 0; @@ -718,6 +687,13 @@ void himd_writemp3(struct himd *h, const char *filepath) idx_track = himd_add_track_info(h, &track, &status); // END: Add track descriptor + + // + // Set track labels + // + himd_set_track_label(h, idx_track, title, LABEL_TYPE_TITLE, &status); + himd_set_track_label(h, idx_track, artist, LABEL_TYPE_ARTIST, &status); + himd_set_track_label(h, idx_track, album, LABEL_TYPE_ALBUM, &status); // // Update TRACK-INDEX file with track strings, fragment descriptor and track-descriptor. -- 1.7.12.4