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
This commit is contained in:
Björn Stenberg 2003-02-11 15:03:28 +00:00
parent 5b1644336c
commit 39f7b66ca4
6 changed files with 68 additions and 19 deletions

View file

@ -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:

View file

@ -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 },

View file

@ -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)

View file

@ -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

View file

@ -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);

View file

@ -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);