From 025d8d6133e50d992e34474dfe8febdd0fe0740c Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Mon, 26 Mar 2007 20:26:41 +0000 Subject: [PATCH] Add support for the SONGWRITER cuesheet command, displayed as composer in the WPS. Also, use the album artist tag to store the disc artist defined in the cuesheet. Finally, only look for INDEX 01 commands instead of simply INDEX: we only care about INDEX 01. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12932 a1c6a512-1295-4272-9138-f99709370657 --- apps/cuesheet.c | 18 ++++++++++++++++-- apps/cuesheet.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/cuesheet.c b/apps/cuesheet.c index 2509ddecfb..ea9b4d2a7e 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c @@ -145,13 +145,26 @@ bool parse_cuesheet(char *file, struct cuesheet *cue) else strncpy(cue->tracks[cue->track_count-1].performer, start,MAX_NAME); } + else if (!strncmp(s, "SONGWRITER", 10)) + { + start = strchr(s,'"'); + if (!start) + break; + end = strchr(++start,'"'); + if (!end) + break; + *end = '\0'; + if (cue->track_count > 0) + strncpy(cue->tracks[cue->track_count-1].songwriter, + start, MAX_NAME); + } else if (!strncmp(s, "TRACK", 5)) { if (cue->track_count >= MAX_TRACKS) break; /* out of memeory! stop parsing */ cue->track_count++; } - else if (!strncmp(s, "INDEX", 5)) + else if (!strncmp(s, "INDEX 01", 8)) { s = strchr(s,' '); s = skip_whitespace(s); @@ -342,9 +355,10 @@ void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3) id3->title = cue->tracks[i].title; id3->artist = cue->tracks[i].performer; + id3->composer = cue->tracks[i].songwriter; + id3->albumartist = cue->performer; id3->tracknum = i+1; id3->album = cue->title; - id3->composer = cue->performer; if (id3->track_string) snprintf(id3->track_string, 10, "%d/%d", i+1, cue->track_count); } diff --git a/apps/cuesheet.h b/apps/cuesheet.h index 9dff370e09..564d80e5d6 100644 --- a/apps/cuesheet.h +++ b/apps/cuesheet.h @@ -29,6 +29,7 @@ struct cue_track_info { char title[MAX_NAME]; char performer[MAX_NAME]; + char songwriter[MAX_NAME]; unsigned long offset; /* ms from start of track */ };