summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/wps.c4
-rw-r--r--apps/onplay.c6
-rw-r--r--apps/playlist_viewer.c35
-rw-r--r--apps/screens.c14
-rw-r--r--apps/screens.h3
5 files changed, 49 insertions, 13 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index cdb34ab447..7554892451 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -903,7 +903,9 @@ long gui_wps_show(void)
903 case ACTION_WPS_ID3SCREEN: 903 case ACTION_WPS_ID3SCREEN:
904 { 904 {
905 gwps_leave_wps(); 905 gwps_leave_wps();
906 if (browse_id3()) 906 if (browse_id3(audio_current_track(),
907 playlist_get_display_index(),
908 playlist_amount()))
907 return GO_TO_ROOT; 909 return GO_TO_ROOT;
908 restore = true; 910 restore = true;
909 } 911 }
diff --git a/apps/onplay.c b/apps/onplay.c
index aeda39ba14..93c7c93624 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -1529,7 +1529,9 @@ MENUITEM_FUNCTION(view_cue_item, 0, ID2P(LANG_BROWSE_CUESHEET),
1529 1529
1530static int browse_id3_wrapper(void) 1530static int browse_id3_wrapper(void)
1531{ 1531{
1532 if (browse_id3()) 1532 if (browse_id3(audio_current_track(),
1533 playlist_get_display_index(),
1534 playlist_amount()))
1533 return GO_TO_ROOT; 1535 return GO_TO_ROOT;
1534 return GO_TO_PREVIOUS; 1536 return GO_TO_PREVIOUS;
1535} 1537}
@@ -1854,7 +1856,7 @@ static struct hotkey_assignment hotkey_items[] = {
1854 HOTKEY_FUNC(NULL, NULL), 1856 HOTKEY_FUNC(NULL, NULL),
1855 ONPLAY_PLAYLIST }, 1857 ONPLAY_PLAYLIST },
1856 { HOTKEY_SHOW_TRACK_INFO, LANG_MENU_SHOW_ID3_INFO, 1858 { HOTKEY_SHOW_TRACK_INFO, LANG_MENU_SHOW_ID3_INFO,
1857 HOTKEY_FUNC(browse_id3, NULL), 1859 HOTKEY_FUNC(browse_id3_wrapper, NULL),
1858 ONPLAY_RELOAD_DIR }, 1860 ONPLAY_RELOAD_DIR },
1859#ifdef HAVE_PITCHCONTROL 1861#ifdef HAVE_PITCHCONTROL
1860 { HOTKEY_PITCHSCREEN, LANG_PITCH, 1862 { HOTKEY_PITCHSCREEN, LANG_PITCH,
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 21b61d4a67..63d8697ee8 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -479,6 +479,31 @@ static bool update_playlist(bool force)
479 return true; 479 return true;
480} 480}
481 481
482static int show_track_info(struct playlist_entry *current_track)
483{
484 struct mp3entry id3;
485 bool id3_retrieval_successful = false;
486
487#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
488 if (tagcache_fill_tags(&id3, current_track->name))
489 id3_retrieval_successful = true;
490 else
491#endif
492 {
493 int fd = open(current_track->name, O_RDONLY);
494 if (fd >= 0)
495 {
496 if (get_metadata(&id3, fd, current_track->name))
497 id3_retrieval_successful = true;
498 close(fd);
499 }
500 }
501
502 return id3_retrieval_successful &&
503 browse_id3(&id3, current_track->index + 1,
504 viewer.num_tracks) ? -1 : 0;
505}
506
482/* Menu of playlist commands. Invoked via ON+PLAY on main viewer screen. 507/* Menu of playlist commands. Invoked via ON+PLAY on main viewer screen.
483 Returns -1 if USB attached, 0 if no playlist change, 1 if playlist 508 Returns -1 if USB attached, 0 if no playlist change, 1 if playlist
484 changed, 2 if a track was removed from the playlist */ 509 changed, 2 if a track was removed from the playlist */
@@ -489,7 +514,8 @@ static int onplay_menu(int index)
489 playlist_buffer_get_track(&viewer.buffer, index); 514 playlist_buffer_get_track(&viewer.buffer, index);
490 MENUITEM_STRINGLIST(menu_items, ID2P(LANG_PLAYLIST), NULL, 515 MENUITEM_STRINGLIST(menu_items, ID2P(LANG_PLAYLIST), NULL,
491 ID2P(LANG_CURRENT_PLAYLIST), ID2P(LANG_CATALOG), 516 ID2P(LANG_CURRENT_PLAYLIST), ID2P(LANG_CATALOG),
492 ID2P(LANG_REMOVE), ID2P(LANG_MOVE), ID2P(LANG_SHUFFLE), 517 ID2P(LANG_REMOVE), ID2P(LANG_MOVE), ID2P(LANG_MENU_SHOW_ID3_INFO),
518 ID2P(LANG_SHUFFLE),
493 ID2P(LANG_SAVE), 519 ID2P(LANG_SAVE),
494 ID2P(LANG_PLAYLISTVIEWER_SETTINGS)); 520 ID2P(LANG_PLAYLISTVIEWER_SETTINGS));
495 bool current = (current_track->index == viewer.current_playing_track); 521 bool current = (current_track->index == viewer.current_playing_track);
@@ -547,16 +573,19 @@ static int onplay_menu(int index)
547 ret = 0; 573 ret = 0;
548 break; 574 break;
549 case 4: 575 case 4:
576 ret = show_track_info(current_track);
577 break;
578 case 5:
550 /* shuffle */ 579 /* shuffle */
551 playlist_randomise(viewer.playlist, current_tick, false); 580 playlist_randomise(viewer.playlist, current_tick, false);
552 ret = 1; 581 ret = 1;
553 break; 582 break;
554 case 5: 583 case 6:
555 /* save playlist */ 584 /* save playlist */
556 save_playlist_screen(viewer.playlist); 585 save_playlist_screen(viewer.playlist);
557 ret = 0; 586 ret = 0;
558 break; 587 break;
559 case 6: 588 case 7:
560 /* playlist viewer settings */ 589 /* playlist viewer settings */
561 result = do_menu(&viewer_settings_menu, NULL, NULL, false); 590 result = do_menu(&viewer_settings_menu, NULL, NULL, false);
562 ret = (result == MENU_ATTACHED_USB) ? -1 : 0; 591 ret = (result == MENU_ATTACHED_USB) ? -1 : 0;
diff --git a/apps/screens.c b/apps/screens.c
index fa2f9f9927..f3a969a838 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -40,7 +40,6 @@
40#include "powermgmt.h" 40#include "powermgmt.h"
41#include "talk.h" 41#include "talk.h"
42#include "misc.h" 42#include "misc.h"
43#include "metadata.h"
44#include "screens.h" 43#include "screens.h"
45#include "debug.h" 44#include "debug.h"
46#include "led.h" 45#include "led.h"
@@ -389,6 +388,8 @@ static const int id3_headers[]=
389struct id3view_info { 388struct id3view_info {
390 struct mp3entry* id3; 389 struct mp3entry* id3;
391 int count; 390 int count;
391 int playlist_display_index;
392 int playlist_amount;
392 int info_id[ARRAYLEN(id3_headers)]; 393 int info_id[ARRAYLEN(id3_headers)];
393}; 394};
394 395
@@ -589,13 +590,13 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
589 break; 590 break;
590 case LANG_ID3_PLAYLIST: 591 case LANG_ID3_PLAYLIST:
591 snprintf(buffer, buffer_len, "%d/%d", 592 snprintf(buffer, buffer_len, "%d/%d",
592 playlist_get_display_index(), playlist_amount()); 593 info->playlist_display_index, info->playlist_amount);
593 val=buffer; 594 val=buffer;
594 if(say_it) 595 if(say_it)
595 { 596 {
596 talk_number(playlist_get_display_index(), true); 597 talk_number(info->playlist_display_index, true);
597 talk_id(VOICE_OF, true); 598 talk_id(VOICE_OF, true);
598 talk_number(playlist_amount(), true); 599 talk_number(info->playlist_amount, true);
599 } 600 }
600 break; 601 break;
601 case LANG_ID3_BITRATE: 602 case LANG_ID3_BITRATE:
@@ -669,15 +670,16 @@ static int id3_speak_item(int selected_item, void* data)
669 return 0; 670 return 0;
670} 671}
671 672
672bool browse_id3(void) 673bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount)
673{ 674{
674 struct gui_synclist id3_lists; 675 struct gui_synclist id3_lists;
675 struct mp3entry* id3 = audio_current_track();
676 int key; 676 int key;
677 unsigned int i; 677 unsigned int i;
678 struct id3view_info info; 678 struct id3view_info info;
679 info.count = 0; 679 info.count = 0;
680 info.id3 = id3; 680 info.id3 = id3;
681 info.playlist_display_index = playlist_display_index;
682 info.playlist_amount = playlist_amount;
681 bool ret = false; 683 bool ret = false;
682 push_current_activity(ACTIVITY_ID3SCREEN); 684 push_current_activity(ACTIVITY_ID3SCREEN);
683 for (i = 0; i < ARRAYLEN(id3_headers); i++) 685 for (i = 0; i < ARRAYLEN(id3_headers); i++)
diff --git a/apps/screens.h b/apps/screens.h
index 2201f679bd..92b00062cb 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -23,6 +23,7 @@
23 23
24#include "config.h" 24#include "config.h"
25#include "timefuncs.h" 25#include "timefuncs.h"
26#include "metadata.h"
26 27
27struct screen; 28struct screen;
28 29
@@ -39,7 +40,7 @@ bool set_time_screen(const char* title, struct tm *tm);
39#endif 40#endif
40 41
41bool shutdown_screen(void); 42bool shutdown_screen(void);
42bool browse_id3(void); 43bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount);
43int view_runtime(void); 44int view_runtime(void);
44 45
45#ifdef HAVE_TOUCHSCREEN 46#ifdef HAVE_TOUCHSCREEN