summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/wps.c65
-rw-r--r--docs/CUSTOM_WPS_FORMAT101
2 files changed, 125 insertions, 41 deletions
diff --git a/apps/wps.c b/apps/wps.c
index 571b35675d..55aa531ea7 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -73,7 +73,6 @@ static char custom_wps[64];
73 73
74static void draw_screen(struct mp3entry* id3) 74static void draw_screen(struct mp3entry* id3)
75{ 75{
76
77 int font_height; 76 int font_height;
78#ifdef LOADABLE_FONTS 77#ifdef LOADABLE_FONTS
79 unsigned char *font = lcd_getcurrentldfont(); 78 unsigned char *font = lcd_getcurrentldfont();
@@ -96,13 +95,16 @@ static void draw_screen(struct mp3entry* id3)
96 else 95 else
97 { 96 {
98#ifdef CUSTOM_WPS 97#ifdef CUSTOM_WPS
98#ifdef HAVE_LCD_CHARCELLS
99 static int last_wps = -1; 99 static int last_wps = -1;
100 if ( last_wps != global_settings.wps_display && 100 if ((last_wps != global_settings.wps_display
101 global_settings.wps_display == PLAY_DISPLAY_CUSTOM_WPS ) { 101 && global_settings.wps_display == PLAY_DISPLAY_CUSTOM_WPS))
102 {
102 load_custom_wps(); 103 load_custom_wps();
103 last_wps = global_settings.wps_display; 104 last_wps = global_settings.wps_display;
104 } 105 }
105#endif 106#endif
107#endif
106 switch ( global_settings.wps_display ) { 108 switch ( global_settings.wps_display ) {
107 case PLAY_DISPLAY_TRACK_TITLE: 109 case PLAY_DISPLAY_TRACK_TITLE:
108 { 110 {
@@ -266,6 +268,11 @@ bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string)
266{ 268{
267 char buffer[128]; 269 char buffer[128];
268 char tmpbuf[64]; 270 char tmpbuf[64];
271 int con_flag = 0; /* (0)Not inside of if/else
272 (1)Inside of If
273 (2)Inside of Else */
274 char con_if[64];
275 char con_else[64];
269 char cchr1; 276 char cchr1;
270 char cchr2; 277 char cchr2;
271 char cchr3; 278 char cchr3;
@@ -384,11 +391,53 @@ bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string)
384 case '%': /* Displays % */ 391 case '%': /* Displays % */
385 snprintf(tmpbuf, sizeof(tmpbuf), "%%"); 392 snprintf(tmpbuf, sizeof(tmpbuf), "%%");
386 break; 393 break;
394 case '?': /* Conditional Display of ID3/File */
395 switch(con_flag)
396 {
397 case 0:
398 con_if[0] = 0;
399 con_else[0] = 0;
400 con_flag = 1;
401 break;
402 default:
403 if(id3->artist && id3->title)
404 snprintf(tmpbuf, sizeof(tmpbuf), "%s", con_if);
405 else
406 snprintf(tmpbuf, sizeof(tmpbuf), "%s", con_else);
407 con_flag = 0;
408 break;
409 }
410 break;
411 case ':': /* Seperator for Conditional ID3/File Display */
412 con_flag = 2;
413 break;
414 }
415 switch(con_flag)
416 {
417 case 0:
418 snprintf(buffer, sizeof(buffer), "%s%s", buffer, tmpbuf);
419 break;
420 case 1:
421 snprintf(con_if, sizeof(con_if), "%s%s", con_if, tmpbuf);
422 break;
423 case 2:
424 snprintf(con_else, sizeof(con_else), "%s%s", con_else, tmpbuf);
425 break;
387 } 426 }
388 snprintf(buffer, sizeof(buffer), "%s%s", buffer, tmpbuf);
389 break; 427 break;
390 default: 428 default:
391 snprintf(buffer, sizeof(buffer), "%s%c", buffer, cchr1); 429 switch(con_flag)
430 {
431 case 0:
432 snprintf(buffer, sizeof(buffer), "%s%c", buffer, cchr1);
433 break;
434 case 1:
435 snprintf(con_if, sizeof(con_if), "%s%c", con_if, cchr1);
436 break;
437 case 2:
438 snprintf(con_else, sizeof(con_else), "%s%c", con_else, cchr1);
439 break;
440 }
392 break; 441 break;
393 } 442 }
394 if(seek >= strlen(wps_string)) 443 if(seek >= strlen(wps_string))
@@ -474,17 +523,17 @@ int player_id3_show(void)
474 case 0: 523 case 0:
475 lcd_puts(0, 0, "Title"); 524 lcd_puts(0, 0, "Title");
476 snprintf(scroll_text,sizeof(scroll_text), "%s", 525 snprintf(scroll_text,sizeof(scroll_text), "%s",
477 id3->title); 526 id3->title?id3->title:"<no title>");
478 break; 527 break;
479 case 1: 528 case 1:
480 lcd_puts(0, 0, "Artist"); 529 lcd_puts(0, 0, "Artist");
481 snprintf(scroll_text,sizeof(scroll_text), "%s", 530 snprintf(scroll_text,sizeof(scroll_text), "%s",
482 id3->artist); 531 id3->artist?id3->artist:"<no artist>");
483 break; 532 break;
484 case 2: 533 case 2:
485 lcd_puts(0, 0, "Album"); 534 lcd_puts(0, 0, "Album");
486 snprintf(scroll_text,sizeof(scroll_text), "%s", 535 snprintf(scroll_text,sizeof(scroll_text), "%s",
487 id3->album); 536 id3->album?id3->album:"<no album>");
488 break; 537 break;
489 case 3: 538 case 3:
490 lcd_puts(0, 0, "Length"); 539 lcd_puts(0, 0, "Length");
diff --git a/docs/CUSTOM_WPS_FORMAT b/docs/CUSTOM_WPS_FORMAT
index d9461f969e..916c9887b1 100644
--- a/docs/CUSTOM_WPS_FORMAT
+++ b/docs/CUSTOM_WPS_FORMAT
@@ -1,46 +1,78 @@
1Custom WPS Display 1Custom WPS Display
2wps.config File Format Specifications 2wps.config File Format Specifications
3 3
4Description 4
5----------- 5Description / General Info
6The Custom WPS Display is used on the Rockbox Player ONLY as a means 6--------------------------
7to customize the WPS to the user's likings. 7* The Custom WPS Display is used on the Rockbox Player ONLY, as a means
8The first line of the 2 line display is the customized line (scrolling). 8 to customize the WPS to the user's likings.
9The second line is always the time display. (Elapsed & Total Time). 9* Plans to implement this feature into the recorder are in progress.
10The second line is not able to be customized. 10* The first line of the 2 line display is the customized line (scrolling).
11All characters not preceded by % are displayed as typed. 11* The second line is always the time display. (Elapsed & Total Time).
12* The second line is not able to be customized.
13* Any CR's, LF's, or CR/LF's (Commonly known as Newline/Return/Enter) in
14 the wps.config file will be treated as spaces. IE: Don't use them.
15* After editing the wps.config file, you may need to reboot your Rockbox.
16* All tags except for %%, %?, and %: contain 3 characters (%xx). Remember
17 to type the tags correctly, or you will get unexpected output, or even
18 possibly no output at all.
19* All characters not preceded by % are displayed as typed.
20
12 21
13File Location 22File Location
14------------- 23-------------
15The configuration file must be located in the root folder of the 24The configuration file must be located in the root folder of the
16device and must be named wps.config (lowercase) 25device and must be named wps.config (lowercase)
17 26
27
18Tags 28Tags
19---- 29----
20%t : ID3 Title 30ID3 Info Tags:
21%a : ID3 Artist 31 %it : ID3 Title
22%n : ID3 Track Number 32 %ia : ID3 Artist
23%u : ID3 Album 33 %in : ID3 Track Number
24%c : Conditional Title/Filename 34 %id : ID3 Album
25 Displays "Artist - Title" *or* 35File Info Tags:
26 Displays Filename if no ID3 Artist/Title 36 %fc : Conditional Title/Filename
27%h : Conditional Title/Filename 37 Displays "Artist - Title" *or*
28 Displays "Title - Artist" *or* 38 Displays Filename if no ID3 Artist/Title
29 Displays Filename if no ID3 Artist/Title 39 %fd : Conditional Title/Filename
30%b : File Bitrate 40 Displays "Title - Artist" *or*
31%f : File Frequency 41 Displays Filename if no ID3 Artist/Title
32%p : File Path 42 %fb : File Bitrate
33%m : File Name 43 %ff : File Frequency
34%s : File Size (In Kilobytes) 44 %fp : File Path
35%i : Playlist Position 45 %fn : File Name
36%l : Playlist Total Entries 46 %fs : File Size (In Kilobytes)
37%e : Elapsed Track Time 47Playlist/Song Info Tags:
38%o : Total Track Time 48 %pp : Playlist Position
39%% : Displays a % 49 %pe : Playlist Total Entries
40 50 %pc : Current Time In Song
41Example wps.config File 51 %pt : Total Track Time
52Other Tags:
53 %% : Displays a %
54Conditional ID3/File Tags (If/Else block):
55 The following two tags are completely optional, and meant only for those
56 that wish to go crazy with customization. It lets you specify what to
57 do when it finds an ID3 tag, and also when it doesn't find one. It can
58 be placed anywhere within the wps.config file.
59 The first condition of the If/Else block is what to do when it DOES find
60 valid ID3 tags. The second condition is what to do when there are no
61 valid ID3 tags available.
62 %? : Start/End an If/Else block
63 %: : Seperator between If and Else
64 Example:
65 To display "Title - Artist" if there is ID3 available, or "Filename"
66 if there is no ID3, the following string would be used:
67 %?%it - %ia%:%fn%?
68 Yes, you are not going crazy (although I may be)... This *IS* more
69 confusing then Perl :-)
70
71
72Example wps.config File (Without If/Else)
42----------------------- 73-----------------------
43%i/%l: %c * %sKB 74%pp/%pe: %fc * %fsKB
75
44 76
45Example Output 77Example Output
46-------------- 78--------------
@@ -53,5 +85,8 @@ File Size: 3500
53Elapsed Track Time: 2:23 85Elapsed Track Time: 2:23
54Total Track Time: 3:01 86Total Track Time: 3:01
55The output of this on the player would be: 87The output of this on the player would be:
565/10: My Song.mp3 * 3500KB 88 ---------------------------
572:23/3:01 89| 5/10: My Song.mp3 * 3500KB|
90| 2:23/3:01 |
91 ---------------------------
92Of course, the whole first line wouldn't fit, so it scrolls it.