diff options
-rw-r--r-- | apps/wps.c | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/apps/wps.c b/apps/wps.c index 1d4a807be6..bc77ba41bc 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -40,31 +40,30 @@ | |||
40 | /* demonstrates showing different formats from playtune */ | 40 | /* demonstrates showing different formats from playtune */ |
41 | void wps_show_play(char* filename) | 41 | void wps_show_play(char* filename) |
42 | { | 42 | { |
43 | char buffer[256]; | 43 | mp3entry mp3; |
44 | mp3entry mp3; | 44 | mp3info(&mp3,filename); |
45 | mp3info(&mp3,filename); | ||
46 | 45 | ||
47 | snprintf(buffer,sizeof(buffer), "%s", mp3.path); | 46 | lcd_clear_display(); |
48 | 47 | ||
49 | lcd_clear_display(); | 48 | switch (global_settings.wps_display) |
50 | 49 | { | |
51 | switch (global_settings.wps_display) | 50 | case PLAY_DISPLAY_TRACK_TITLE: |
52 | { | 51 | { |
53 | case PLAY_DISPLAY_TRACK_TITLE: | 52 | int ch = '/'; |
54 | { | ||
55 | char ch = '/'; | ||
56 | char* end; | 53 | char* end; |
57 | char* szDelimit; | 54 | char szArtist[26]; |
58 | char szArtist[32]; | 55 | char szBuff[257]; |
56 | szBuff[sizeof(szBuff)-1] = 0; | ||
57 | |||
58 | strncpy(szBuff, filename, sizeof(szBuff)); | ||
59 | 59 | ||
60 | char* szTok = strtok_r(buffer, "/", &end); | 60 | char* szTok = strtok_r(szBuff, "/", &end); |
61 | szTok = strtok_r(NULL, "/", &end); | 61 | szTok = strtok_r(NULL, "/", &end); |
62 | 62 | ||
63 | /* Assume path format of: Genre/Artist/Album/Mp3_file */ | 63 | // Assume path format of: Genre/Artist/Album/Mp3_file |
64 | strncpy(szArtist,szTok,sizeof(szArtist)); | 64 | strncpy(szArtist,szTok,sizeof(szArtist)); |
65 | szArtist[sizeof(szArtist)-1] = 0; | 65 | szArtist[sizeof(szArtist)-1] = 0; |
66 | szDelimit = strrchr(buffer, ch); | 66 | char* szDelimit = strrchr(filename, ch); |
67 | |||
68 | #ifdef HAVE_LCD_BITMAP | 67 | #ifdef HAVE_LCD_BITMAP |
69 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); | 68 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); |
70 | lcd_puts_scroll(0,LINE_Y,(++szDelimit)); | 69 | lcd_puts_scroll(0,LINE_Y,(++szDelimit)); |
@@ -72,27 +71,27 @@ void wps_show_play(char* filename) | |||
72 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); | 71 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); |
73 | lcd_puts_scroll(0,1,(++szDelimit)); | 72 | lcd_puts_scroll(0,1,(++szDelimit)); |
74 | #endif | 73 | #endif |
75 | 74 | break; | |
76 | 75 | } | |
77 | break; | 76 | case PLAY_DISPLAY_FILENAME_SCROLL: |
78 | } | 77 | { |
79 | case PLAY_DISPLAY_FILENAME_SCROLL: | 78 | int ch = '/'; |
80 | { | 79 | char* szLast = strrchr(filename, ch); |
81 | int ch = '/'; | 80 | |
82 | char* szLast = strrchr(buffer, ch); | 81 | if (szLast) |
83 | 82 | { | |
84 | if (szLast) | 83 | lcd_puts_scroll(0,0, (++szLast)); |
85 | { | 84 | } else { |
86 | lcd_puts_scroll(0,0, (++szLast)); | 85 | lcd_puts_scroll(0,0, mp3.path); |
87 | } else { | 86 | } |
88 | lcd_puts_scroll(0,0, buffer); | 87 | |
89 | } | 88 | break; |
90 | 89 | } | |
91 | break; | 90 | case PLAY_DISPLAY_DEFAULT: |
92 | } | 91 | { |
93 | case PLAY_DISPLAY_DEFAULT: | ||
94 | { | ||
95 | #ifdef HAVE_LCD_BITMAP | 92 | #ifdef HAVE_LCD_BITMAP |
93 | char buffer[256]; | ||
94 | |||
96 | lcd_puts(0, 0, "[id3 info]"); | 95 | lcd_puts(0, 0, "[id3 info]"); |
97 | lcd_puts(0, LINE_Y, mp3.title?mp3.title:""); | 96 | lcd_puts(0, LINE_Y, mp3.title?mp3.title:""); |
98 | lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:""); | 97 | lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:""); |