1
0
Fork 0
forked from len0rd/rockbox

fixed up a parsing issue for the parsed mode of wps_show_play

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1174 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jerome Kuptz 2002-06-25 09:20:23 +00:00
parent 47d46e37f5
commit b44dd04c60

View file

@ -40,31 +40,30 @@
/* demonstrates showing different formats from playtune */ /* demonstrates showing different formats from playtune */
void wps_show_play(char* filename) void wps_show_play(char* filename)
{ {
char buffer[256];
mp3entry mp3; mp3entry mp3;
mp3info(&mp3,filename); mp3info(&mp3,filename);
snprintf(buffer,sizeof(buffer), "%s", mp3.path);
lcd_clear_display(); lcd_clear_display();
switch (global_settings.wps_display) switch (global_settings.wps_display)
{ {
case PLAY_DISPLAY_TRACK_TITLE: case PLAY_DISPLAY_TRACK_TITLE:
{ {
char ch = '/'; int ch = '/';
char* end; char* end;
char* szDelimit; char szArtist[26];
char szArtist[32]; char szBuff[257];
szBuff[sizeof(szBuff)-1] = 0;
char* szTok = strtok_r(buffer, "/", &end); strncpy(szBuff, filename, sizeof(szBuff));
char* szTok = strtok_r(szBuff, "/", &end);
szTok = strtok_r(NULL, "/", &end); szTok = strtok_r(NULL, "/", &end);
/* Assume path format of: Genre/Artist/Album/Mp3_file */ // Assume path format of: Genre/Artist/Album/Mp3_file
strncpy(szArtist,szTok,sizeof(szArtist)); strncpy(szArtist,szTok,sizeof(szArtist));
szArtist[sizeof(szArtist)-1] = 0; szArtist[sizeof(szArtist)-1] = 0;
szDelimit = strrchr(buffer, ch); char* szDelimit = strrchr(filename, ch);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_puts(0,0, szArtist?szArtist:"<nothing>"); lcd_puts(0,0, szArtist?szArtist:"<nothing>");
lcd_puts_scroll(0,LINE_Y,(++szDelimit)); lcd_puts_scroll(0,LINE_Y,(++szDelimit));
@ -72,20 +71,18 @@ void wps_show_play(char* filename)
lcd_puts(0,0, szArtist?szArtist:"<nothing>"); lcd_puts(0,0, szArtist?szArtist:"<nothing>");
lcd_puts_scroll(0,1,(++szDelimit)); lcd_puts_scroll(0,1,(++szDelimit));
#endif #endif
break; break;
} }
case PLAY_DISPLAY_FILENAME_SCROLL: case PLAY_DISPLAY_FILENAME_SCROLL:
{ {
int ch = '/'; int ch = '/';
char* szLast = strrchr(buffer, ch); char* szLast = strrchr(filename, ch);
if (szLast) if (szLast)
{ {
lcd_puts_scroll(0,0, (++szLast)); lcd_puts_scroll(0,0, (++szLast));
} else { } else {
lcd_puts_scroll(0,0, buffer); lcd_puts_scroll(0,0, mp3.path);
} }
break; break;
@ -93,6 +90,8 @@ void wps_show_play(char* filename)
case PLAY_DISPLAY_DEFAULT: case PLAY_DISPLAY_DEFAULT:
{ {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
char buffer[256];
lcd_puts(0, 0, "[id3 info]"); lcd_puts(0, 0, "[id3 info]");
lcd_puts(0, LINE_Y, mp3.title?mp3.title:""); lcd_puts(0, LINE_Y, mp3.title?mp3.title:"");
lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:""); lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:"");