Cuesheet tweaks:

* Max length for the info strings is now 80, according to the cue spec.
* Don't display the album artist if it's the same as the track artist.
* If the cue has composer info but not the tracks, the cue composer info is displayed for all the tracks.
* Slightly change the display in the cue viewer.
* A few cosmetic changes in the code.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12964 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2007-03-29 18:39:04 +00:00
parent f2fd443596
commit d77274aeb9
2 changed files with 17 additions and 12 deletions

View file

@ -175,7 +175,7 @@ bool parse_cuesheet(char *file, struct cuesheet *cue)
break;
case 'S': /* SONGWRITER */
dest = (cue->track_count <= 0) ? NULL :
dest = (cue->track_count <= 0) ? cue->songwriter :
cue->tracks[cue->track_count-1].songwriter;
break;
}
@ -192,6 +192,9 @@ bool parse_cuesheet(char *file, struct cuesheet *cue)
{
if (*(cue->tracks[i].performer) == '\0')
strncpy(cue->tracks[i].performer, cue->performer, MAX_NAME);
if (*(cue->tracks[i].songwriter) == '\0')
strncpy(cue->tracks[i].songwriter, cue->songwriter, MAX_NAME);
}
return true;
@ -225,9 +228,8 @@ int cue_find_current_track(struct cuesheet *cue, unsigned long curpos)
{
int i=0;
while (i < cue->track_count-1 && cue->tracks[i+1].offset < curpos)
{
i++;
}
cue->curr_track_idx = i;
cue->curr_track = cue->tracks + i;
return i;
@ -241,16 +243,12 @@ static char *list_get_name_cb(int selected_item,
struct cuesheet *cue = (struct cuesheet *)data;
if (selected_item & 1)
{
snprintf(buffer, MAX_PATH,
(selected_item+1)/2 > 9 ? " %s" : " %s",
snprintf(buffer, MAX_PATH, "%s",
cue->tracks[selected_item/2].title);
}
else
{
snprintf(buffer, MAX_PATH, "%d %s", selected_item/2+1,
snprintf(buffer, MAX_PATH, "%02d. %s", selected_item/2+1,
cue->tracks[selected_item/2].performer);
}
return buffer;
}
@ -361,7 +359,13 @@ 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;
/* if the album artist is the same as the track artist, we hide it. */
if (strcmp(cue->performer, cue->tracks[i].performer))
id3->albumartist = cue->performer;
else
id3->albumartist = "\0";
id3->tracknum = i+1;
id3->album = cue->title;
if (id3->track_string)

View file

@ -23,7 +23,7 @@
#include <stdbool.h>
#include "screens.h"
#define MAX_NAME 64 /* Max length of information strings */
#define MAX_NAME 80 /* Max length of information strings */
#define MAX_TRACKS 99 /* Max number of tracks in a cuesheet */
struct cue_track_info {
@ -39,6 +39,7 @@ struct cuesheet {
char title[MAX_NAME];
char performer[MAX_NAME];
char songwriter[MAX_NAME];
int track_count;
struct cue_track_info tracks[MAX_TRACKS];