summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-02-11 15:03:28 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-02-11 15:03:28 +0000
commit39f7b66ca40e8f0a147a43a903121153b84a890e (patch)
tree830919ce13cdf02c38bc6ab6959a8786cb6d0427
parent5b1644336c790d7a6b171f95302a7e09c396fd00 (diff)
Added Genre+Year to ID3 viewer, and added the viewer to the main menu.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3234 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang20
-rw-r--r--apps/main_menu.c4
-rw-r--r--apps/wps-display.c6
-rw-r--r--apps/wps-display.h1
-rw-r--r--apps/wps.c55
-rw-r--r--apps/wps.h1
6 files changed, 68 insertions, 19 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index a520ec64bc..7ab205f9f7 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -1346,3 +1346,23 @@ id: LANG_PLAYER_KEYBOARD_ABORT
desc: Abort alternative in player keyboard interaction
eng: "Abort"
new:
+
+id: LANG_MENU_SHOW_ID3_INFO
+desc: Menu option to start id3 viewer
+eng: "Show ID3 Info"
+new:
+
+id: LANG_ID3_GENRE
+desc: ID3 frame 'genre'
+eng: "[Genre]"
+new:
+
+id: LANG_ID3_YEAR
+desc: ID3 info 'year'
+eng: "[Year]"
+new:
+
+id: LANG_ID3_NO_INFO
+desc: ID3 info is missing
+eng: "<no info>"
+new:
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 0b71d1d98a..9f4aa8f812 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -40,6 +40,7 @@
#include "status.h"
#include "fat.h"
#include "sleeptimer.h"
+#include "wps.h"
#include "lang.h"
@@ -261,7 +262,8 @@ bool main_menu(void)
{ str(LANG_RECORDING), recording_screen },
{ str(LANG_RECORDING_SETTINGS), recording_menu },
#endif
- { str(LANG_CREATE_PLAYLIST), create_playlist },
+ { str(LANG_CREATE_PLAYLIST), create_playlist },
+ { str(LANG_MENU_SHOW_ID3_INFO), browse_id3 },
{ str(LANG_SLEEP_TIMER), sleeptimer_screen },
#ifdef HAVE_ALARM_MOD
{ str(LANG_ALARM_MOD_ALARM_MENU), alarm_screen },
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 263c0a78b6..5c43d510e1 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -95,6 +95,12 @@ static const char* const genres[] = {
"Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall"
};
+char* wps_get_genre(unsigned int genre)
+{
+ if (genre < sizeof(genres)/sizeof(char*))
+ return (char*)genres[genre];
+ return NULL;
+}
/* Set format string to use for WPS, splitting it into lines */
static void wps_format(char* fmt)
diff --git a/apps/wps-display.h b/apps/wps-display.h
index 7054343b5e..99330453c0 100644
--- a/apps/wps-display.h
+++ b/apps/wps-display.h
@@ -37,5 +37,6 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, unsigned char refresh_mo
bool wps_display(struct mp3entry* id3);
bool wps_load(char* file, bool display);
void wps_reset(void);
+char* wps_get_genre(unsigned int genre);
#endif
diff --git a/apps/wps.c b/apps/wps.c
index 4e552c7faa..f52ec234ca 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -148,7 +148,7 @@ void display_mute_text(bool muted)
sleep(HZ);
}
-static int browse_id3(void)
+bool browse_id3(void)
{
int button;
int menu_pos = 0;
@@ -156,12 +156,9 @@ static int browse_id3(void)
bool exit = false;
char scroll_text[MAX_PATH];
- lcd_clear_display();
- lcd_puts(0, 0, str(LANG_ID3_INFO));
- lcd_puts(0, 1, str(LANG_ID3_SCREEN));
- lcd_update();
- sleep(HZ);
-
+ if (!(mpeg_status() & MPEG_STATUS_PLAY))
+ return false;
+
while (!exit)
{
lcd_clear_display();
@@ -190,19 +187,35 @@ static int browse_id3(void)
case 3:
lcd_puts(0, 0, str(LANG_ID3_TRACKNUM));
- if (id3->tracknum)
- {
+ if (id3->tracknum) {
snprintf(scroll_text,sizeof(scroll_text), "%d",
id3->tracknum);
lcd_puts_scroll(0, 1, scroll_text);
}
else
- {
lcd_puts_scroll(0, 1, str(LANG_ID3_NO_TRACKNUM));
- }
break;
case 4:
+ lcd_puts(0, 0, str(LANG_ID3_GENRE));
+ lcd_puts_scroll(0, 1,
+ wps_get_genre(id3->genre) ?
+ wps_get_genre(id3->genre) :
+ (char*)str(LANG_ID3_NO_INFO));
+ break;
+
+ case 5:
+ lcd_puts(0, 0, str(LANG_ID3_YEAR));
+ if (id3->year) {
+ snprintf(scroll_text,sizeof(scroll_text), "%d",
+ id3->year);
+ lcd_puts_scroll(0, 1, scroll_text);
+ }
+ else
+ lcd_puts_scroll(0, 1, str(LANG_ID3_NO_INFO));
+ break;
+
+ case 6:
lcd_puts(0, 0, str(LANG_ID3_LENGHT));
snprintf(scroll_text,sizeof(scroll_text), "%d:%02d",
id3->length / 60000,
@@ -210,7 +223,7 @@ static int browse_id3(void)
lcd_puts(0, 1, scroll_text);
break;
- case 5:
+ case 7:
lcd_puts(0, 0, str(LANG_ID3_PLAYLIST));
snprintf(scroll_text,sizeof(scroll_text), "%d/%d",
id3->index + 1, playlist_amount());
@@ -218,21 +231,21 @@ static int browse_id3(void)
break;
- case 6:
+ case 8:
lcd_puts(0, 0, str(LANG_ID3_BITRATE));
snprintf(scroll_text,sizeof(scroll_text), "%d kbps",
id3->bitrate);
lcd_puts(0, 1, scroll_text);
break;
- case 7:
+ case 9:
lcd_puts(0, 0, str(LANG_ID3_FRECUENCY));
snprintf(scroll_text,sizeof(scroll_text), "%d Hz",
id3->frequency);
lcd_puts(0, 1, scroll_text);
break;
- case 8:
+ case 10:
lcd_puts(0, 0, str(LANG_ID3_PATH));
lcd_puts_scroll(0, 1, id3->path);
break;
@@ -279,11 +292,11 @@ static int browse_id3(void)
case SYS_USB_CONNECTED:
status_set_playmode(STATUS_STOP);
usb_screen();
- return SYS_USB_CONNECTED;
+ return true;
break;
}
}
- return 0;
+ return false;
}
static bool ffwd_rew(int button)
@@ -618,7 +631,13 @@ static bool menu(void)
#else
case BUTTON_F1 | BUTTON_ON:
#endif
- if(browse_id3() == SYS_USB_CONNECTED)
+ lcd_clear_display();
+ lcd_puts(0, 0, str(LANG_ID3_INFO));
+ lcd_puts(0, 1, str(LANG_ID3_SCREEN));
+ lcd_update();
+ sleep(HZ);
+
+ if(browse_id3())
return true;
#ifdef HAVE_PLAYER_KEYPAD
status_set_param(false);
diff --git a/apps/wps.h b/apps/wps.h
index c6cec3fdce..3680515951 100644
--- a/apps/wps.h
+++ b/apps/wps.h
@@ -27,6 +27,7 @@ extern bool wps_time_countup;
int wps_show(void);
bool refresh_wps(bool refresh_scroll);
void handle_usb(void);
+bool browse_id3(void);
#ifdef HAVE_RECORDER_KEYPAD
bool f2_screen(void);