song rating support.. should probably be moved with browse id3 to a "song options" submenu in the wps context menu...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7013 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
55819b7859
commit
afe0941ae5
5 changed files with 69 additions and 0 deletions
|
@ -382,6 +382,7 @@ int rundb_init(void)
|
|||
audio_set_track_buffer_event(&rundb_buffer_track);
|
||||
audio_set_track_changed_event(&rundb_track_change);
|
||||
audio_set_track_unbuffer_event(&rundb_unbuffer_track);
|
||||
logf("rundb inited.");
|
||||
#endif
|
||||
rundbsize=lseek(rundb_fd,0,SEEK_END);
|
||||
return 0;
|
||||
|
@ -451,6 +452,7 @@ void writerundbentry(struct mp3entry *id)
|
|||
}
|
||||
|
||||
void writeruntimeinfo(struct mp3entry *id) {
|
||||
logf("rundb write");
|
||||
if(!id->rundbhash)
|
||||
addrundbentry(id);
|
||||
else
|
||||
|
@ -474,6 +476,7 @@ void clearruntimeinfo(struct mp3entry *id) {
|
|||
|
||||
void loadruntimeinfo(struct mp3entry *id)
|
||||
{
|
||||
logf("rundb load");
|
||||
clearruntimeinfo(id);
|
||||
clearfileentryinfo(id);
|
||||
if(!getfentrybyfilename(id)) {
|
||||
|
|
|
@ -3154,3 +3154,15 @@ desc: in settings_menu.
|
|||
eng: "Gather runtime data (experimental)"
|
||||
voice: "Gather runtime data"
|
||||
new:
|
||||
|
||||
id: LANG_MENU_SET_RATING
|
||||
desc: in wps context menu
|
||||
eng: "Set song rating"
|
||||
voice: "Set song rating"
|
||||
new:
|
||||
|
||||
id: LANG_RATING
|
||||
desc: in set_rating
|
||||
eng: "Rating:"
|
||||
voice "Rating"
|
||||
new:
|
||||
|
|
|
@ -556,6 +556,9 @@ int onplay(char* file, int attr, int from)
|
|||
items[i].desc = ID2P(LANG_MENU_SHOW_ID3_INFO);
|
||||
items[i].function = browse_id3;
|
||||
i++;
|
||||
items[i].desc = ID2P(LANG_MENU_SET_RATING);
|
||||
items[i].function = set_rating;
|
||||
i++;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MULTIVOLUME
|
||||
|
|
|
@ -1417,3 +1417,53 @@ bool browse_id3(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool set_rating(void)
|
||||
{
|
||||
struct mp3entry* id3 = audio_current_track();
|
||||
int button;
|
||||
bool exit = false;
|
||||
char rating_text[20];
|
||||
|
||||
if (!(audio_status() & AUDIO_STATUS_PLAY))
|
||||
return false;
|
||||
while (!exit)
|
||||
{
|
||||
lcd_clear_display();
|
||||
lcd_puts(0, 0, str(LANG_RATING));
|
||||
snprintf(rating_text,sizeof(rating_text),"%d",id3->rating);
|
||||
lcd_puts(0,1,rating_text);
|
||||
lcd_update();
|
||||
button = button_get(true);
|
||||
|
||||
switch(button)
|
||||
{
|
||||
case SETTINGS_DEC:
|
||||
if (id3->rating > 0)
|
||||
id3->rating--;
|
||||
else
|
||||
id3->rating = 10;
|
||||
break;
|
||||
|
||||
case SETTINGS_INC:
|
||||
if (id3->rating < 10)
|
||||
id3->rating++;
|
||||
else
|
||||
id3->rating = 0;
|
||||
break;
|
||||
case SETTINGS_CANCEL:
|
||||
#ifdef SETTINGS_OK2
|
||||
case SETTINGS_OK2:
|
||||
#endif
|
||||
/* eat release event */
|
||||
button_get(true);
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ bool set_time_screen(const char* string, struct tm *tm);
|
|||
|
||||
bool shutdown_screen(void);
|
||||
bool browse_id3(void);
|
||||
bool set_rating(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue