summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/cuesheet.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index 2b876be77f..fd7c7d34f1 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -351,23 +351,24 @@ bool curr_cuesheet_skip(int direction, unsigned long curr_pos)
351 351
352void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3) 352void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3)
353{ 353{
354 if (!cue) 354 if (!cue || !cue->curr_track)
355 return; 355 return;
356 356
357 int i = cue->curr_track_idx; 357 struct cue_track_info *track = cue->curr_track;
358 358
359 id3->title = cue->tracks[i].title; 359 id3->title = *track->title ? track->title : NULL;
360 id3->artist = cue->tracks[i].performer; 360 id3->artist = *track->performer ? track->performer : NULL;
361 id3->composer = cue->tracks[i].songwriter; 361 id3->composer = *track->songwriter ? track->songwriter : NULL;
362 id3->album = *cue->title ? cue->title : NULL;
362 363
363 /* if the album artist is the same as the track artist, we hide it. */ 364 /* if the album artist is the same as the track artist, we hide it. */
364 if (strcmp(cue->performer, cue->tracks[i].performer)) 365 if (strcmp(cue->performer, track->performer))
365 id3->albumartist = cue->performer; 366 id3->albumartist = *cue->performer ? cue->performer : NULL;
366 else 367 else
367 id3->albumartist = "\0"; 368 id3->albumartist = NULL;
368 369
370 int i = cue->curr_track_idx;
369 id3->tracknum = i+1; 371 id3->tracknum = i+1;
370 id3->album = cue->title;
371 if (id3->track_string) 372 if (id3->track_string)
372 snprintf(id3->track_string, 10, "%d/%d", i+1, cue->track_count); 373 snprintf(id3->track_string, 10, "%d/%d", i+1, cue->track_count);
373} 374}