diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-06-25 09:09:45 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-06-25 09:09:45 +0000 |
commit | 7f084628214926f1489ddf6a54b62601e9eb80cf (patch) | |
tree | e75a2ebaac3599b783cdd5503b4b56a86b14a933 /apps/wps.c | |
parent | caebbcd77f133e3dbe4d9a0cafe6fadeaf699b49 (diff) | |
download | rockbox-7f084628214926f1489ddf6a54b62601e9eb80cf.tar.gz rockbox-7f084628214926f1489ddf6a54b62601e9eb80cf.zip |
Made the code compile. Added header. Fixed spacing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1172 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/wps.c')
-rw-r--r-- | apps/wps.c | 142 |
1 files changed, 80 insertions, 62 deletions
diff --git a/apps/wps.c b/apps/wps.c index eb9b4ba3af..1d4a807be6 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -1,3 +1,21 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Jerome Kuptz | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
1 | #include <stdio.h> | 19 | #include <stdio.h> |
2 | #include <string.h> | 20 | #include <string.h> |
3 | #include <stdlib.h> | 21 | #include <stdlib.h> |
@@ -22,81 +40,82 @@ | |||
22 | /* demonstrates showing different formats from playtune */ | 40 | /* demonstrates showing different formats from playtune */ |
23 | void wps_show_play(char* filename) | 41 | void wps_show_play(char* filename) |
24 | { | 42 | { |
25 | mp3entry mp3; | 43 | char buffer[256]; |
26 | mp3info(&mp3,filename); | 44 | mp3entry mp3; |
45 | mp3info(&mp3,filename); | ||
27 | 46 | ||
28 | char buffer[256]; | 47 | snprintf(buffer,sizeof(buffer), "%s", mp3.path); |
29 | snprintf(buffer,sizeof(buffer), "%s", mp3.path); | ||
30 | 48 | ||
31 | lcd_clear_display(); | 49 | lcd_clear_display(); |
32 | 50 | ||
33 | switch (global_settings.wps_display) | 51 | switch (global_settings.wps_display) |
34 | { | 52 | { |
35 | case PLAY_DISPLAY_TRACK_TITLE: | 53 | case PLAY_DISPLAY_TRACK_TITLE: |
36 | { | 54 | { |
37 | int ch = '/'; | 55 | char ch = '/'; |
38 | char* end; | 56 | char* end; |
39 | char szArtist[26]; | 57 | char* szDelimit; |
58 | char szArtist[32]; | ||
40 | 59 | ||
41 | char* szTok = strtok_r(buffer, "/", &end); | 60 | char* szTok = strtok_r(buffer, "/", &end); |
42 | szTok = strtok_r(NULL, "/", &end); | 61 | szTok = strtok_r(NULL, "/", &end); |
43 | 62 | ||
44 | // Assume path format of: Genre/Artist/Album/Mp3_file | 63 | /* Assume path format of: Genre/Artist/Album/Mp3_file */ |
45 | strncpy(szArtist,szTok,sizeof(szArtist)); | 64 | strncpy(szArtist,szTok,sizeof(szArtist)); |
46 | szArtist[sizeof(szArtist)-1] = 0; | 65 | szArtist[sizeof(szArtist)-1] = 0; |
47 | char* szDelimit = strrchr(buffer, ch); | 66 | szDelimit = strrchr(buffer, ch); |
48 | 67 | ||
49 | #ifdef HAVE_LCD_BITMAP | 68 | #ifdef HAVE_LCD_BITMAP |
50 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); | 69 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); |
51 | lcd_puts_scroll(0,LINE_Y,(++szDelimit)); | 70 | lcd_puts_scroll(0,LINE_Y,(++szDelimit)); |
52 | #else | 71 | #else |
53 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); | 72 | lcd_puts(0,0, szArtist?szArtist:"<nothing>"); |
54 | lcd_puts_scroll(0,1,(++szDelimit)); | 73 | lcd_puts_scroll(0,1,(++szDelimit)); |
55 | #endif | 74 | #endif |
56 | 75 | ||
57 | 76 | ||
58 | break; | 77 | break; |
59 | } | 78 | } |
60 | case PLAY_DISPLAY_FILENAME_SCROLL: | 79 | case PLAY_DISPLAY_FILENAME_SCROLL: |
61 | { | 80 | { |
62 | int ch = '/'; | 81 | int ch = '/'; |
63 | char* szLast = strrchr(buffer, ch); | 82 | char* szLast = strrchr(buffer, ch); |
64 | 83 | ||
65 | if (szLast) | 84 | if (szLast) |
66 | { | 85 | { |
67 | lcd_puts_scroll(0,0, (++szLast)); | 86 | lcd_puts_scroll(0,0, (++szLast)); |
68 | } else { | 87 | } else { |
69 | lcd_puts_scroll(0,0, buffer); | 88 | lcd_puts_scroll(0,0, buffer); |
70 | } | 89 | } |
71 | 90 | ||
72 | break; | 91 | break; |
73 | } | 92 | } |
74 | case PLAY_DISPLAY_DEFAULT: | 93 | case PLAY_DISPLAY_DEFAULT: |
75 | { | 94 | { |
76 | #ifdef HAVE_LCD_BITMAP | 95 | #ifdef HAVE_LCD_BITMAP |
77 | lcd_puts(0, 0, "[id3 info]"); | 96 | lcd_puts(0, 0, "[id3 info]"); |
78 | lcd_puts(0, LINE_Y, mp3.title?mp3.title:""); | 97 | lcd_puts(0, LINE_Y, mp3.title?mp3.title:""); |
79 | lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:""); | 98 | lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:""); |
80 | lcd_puts(0, LINE_Y+2, mp3.artist?mp3.artist:""); | 99 | lcd_puts(0, LINE_Y+2, mp3.artist?mp3.artist:""); |
81 | 100 | ||
82 | snprintf(buffer,sizeof(buffer), "%d ms", mp3.length); | 101 | snprintf(buffer,sizeof(buffer), "%d ms", mp3.length); |
83 | lcd_puts(0, LINE_Y+3, buffer); | 102 | lcd_puts(0, LINE_Y+3, buffer); |
84 | 103 | ||
85 | snprintf(buffer,sizeof(buffer), "%d kbits", mp3.bitrate); | 104 | snprintf(buffer,sizeof(buffer), "%d kbits", mp3.bitrate); |
86 | 105 | ||
87 | lcd_puts(0, LINE_Y+4, buffer); | 106 | lcd_puts(0, LINE_Y+4, buffer); |
88 | 107 | ||
89 | snprintf(buffer,sizeof(buffer), "%d Hz", mp3.frequency); | 108 | snprintf(buffer,sizeof(buffer), "%d Hz", mp3.frequency); |
90 | lcd_puts(0, LINE_Y+5, buffer); | 109 | lcd_puts(0, LINE_Y+5, buffer); |
91 | #else | 110 | #else |
92 | 111 | ||
93 | lcd_puts(0, 0, mp3.artist?mp3.artist:"<no artist>"); | 112 | lcd_puts(0, 0, mp3.artist?mp3.artist:"<no artist>"); |
94 | lcd_puts(0, 1, mp3.title?mp3.title:"<no title>"); | 113 | lcd_puts(0, 1, mp3.title?mp3.title:"<no title>"); |
95 | #endif | 114 | #endif |
96 | break; | 115 | break; |
97 | } | 116 | } |
98 | 117 | ||
99 | } | 118 | } |
100 | 119 | ||
101 | lcd_update(); | 120 | lcd_update(); |
102 | } | 121 | } |
@@ -105,7 +124,6 @@ void wps_show_play(char* filename) | |||
105 | #if 0 | 124 | #if 0 |
106 | void wps_show_playlist(char* current, playlist_info_t *list) | 125 | void wps_show_playlist(char* current, playlist_info_t *list) |
107 | { | 126 | { |
108 | |||
109 | int ch = '/'; | 127 | int ch = '/'; |
110 | char* szLast = strrchr(current, ch); | 128 | char* szLast = strrchr(current, ch); |
111 | char buf[16]; | 129 | char buf[16]; |
@@ -117,15 +135,15 @@ void wps_show_playlist(char* current, playlist_info_t *list) | |||
117 | lcd_clear_display(); | 135 | lcd_clear_display(); |
118 | 136 | ||
119 | #ifdef HAVE_LCD_BITMAP | 137 | #ifdef HAVE_LCD_BITMAP |
120 | lcd_puts(0, 0, "[Playlist Mode]"); | 138 | lcd_puts(0, 0, "[Playlist Mode]"); |
121 | lcd_puts_scroll(0,LINE_Y, (++szLast)); | 139 | lcd_puts_scroll(0,LINE_Y, (++szLast)); |
122 | lcd_puts(0, LINE_Y+1, buf); | 140 | lcd_puts(0, LINE_Y+1, buf); |
123 | #else | 141 | #else |
124 | lcd_puts_scroll(0,0, (++szLast)); | 142 | lcd_puts_scroll(0,0, (++szLast)); |
125 | lcd_puts(0,1,buf); | 143 | lcd_puts(0,1,buf); |
126 | #endif | 144 | #endif |
127 | 145 | ||
128 | 146 | ||
129 | lcd_update(); | 147 | lcd_update(); |
130 | } | 148 | } |
131 | #endif | 149 | #endif |