Playlist Viewer: Add Track Info
Adds a command for showing track info to the Playlist Viewer's context menu, which brings up the same screen used by the WPS for currently playing tracks. Change-Id: I17d99671935934dad565d290a0d6fb3b0dfd8b01
This commit is contained in:
parent
e8b9123205
commit
7dffbd84af
5 changed files with 49 additions and 13 deletions
|
@ -903,7 +903,9 @@ long gui_wps_show(void)
|
|||
case ACTION_WPS_ID3SCREEN:
|
||||
{
|
||||
gwps_leave_wps();
|
||||
if (browse_id3())
|
||||
if (browse_id3(audio_current_track(),
|
||||
playlist_get_display_index(),
|
||||
playlist_amount()))
|
||||
return GO_TO_ROOT;
|
||||
restore = true;
|
||||
}
|
||||
|
|
|
@ -1529,7 +1529,9 @@ MENUITEM_FUNCTION(view_cue_item, 0, ID2P(LANG_BROWSE_CUESHEET),
|
|||
|
||||
static int browse_id3_wrapper(void)
|
||||
{
|
||||
if (browse_id3())
|
||||
if (browse_id3(audio_current_track(),
|
||||
playlist_get_display_index(),
|
||||
playlist_amount()))
|
||||
return GO_TO_ROOT;
|
||||
return GO_TO_PREVIOUS;
|
||||
}
|
||||
|
@ -1854,7 +1856,7 @@ static struct hotkey_assignment hotkey_items[] = {
|
|||
HOTKEY_FUNC(NULL, NULL),
|
||||
ONPLAY_PLAYLIST },
|
||||
{ HOTKEY_SHOW_TRACK_INFO, LANG_MENU_SHOW_ID3_INFO,
|
||||
HOTKEY_FUNC(browse_id3, NULL),
|
||||
HOTKEY_FUNC(browse_id3_wrapper, NULL),
|
||||
ONPLAY_RELOAD_DIR },
|
||||
#ifdef HAVE_PITCHCONTROL
|
||||
{ HOTKEY_PITCHSCREEN, LANG_PITCH,
|
||||
|
|
|
@ -479,6 +479,31 @@ static bool update_playlist(bool force)
|
|||
return true;
|
||||
}
|
||||
|
||||
static int show_track_info(struct playlist_entry *current_track)
|
||||
{
|
||||
struct mp3entry id3;
|
||||
bool id3_retrieval_successful = false;
|
||||
|
||||
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
||||
if (tagcache_fill_tags(&id3, current_track->name))
|
||||
id3_retrieval_successful = true;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int fd = open(current_track->name, O_RDONLY);
|
||||
if (fd >= 0)
|
||||
{
|
||||
if (get_metadata(&id3, fd, current_track->name))
|
||||
id3_retrieval_successful = true;
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
return id3_retrieval_successful &&
|
||||
browse_id3(&id3, current_track->index + 1,
|
||||
viewer.num_tracks) ? -1 : 0;
|
||||
}
|
||||
|
||||
/* Menu of playlist commands. Invoked via ON+PLAY on main viewer screen.
|
||||
Returns -1 if USB attached, 0 if no playlist change, 1 if playlist
|
||||
changed, 2 if a track was removed from the playlist */
|
||||
|
@ -489,7 +514,8 @@ static int onplay_menu(int index)
|
|||
playlist_buffer_get_track(&viewer.buffer, index);
|
||||
MENUITEM_STRINGLIST(menu_items, ID2P(LANG_PLAYLIST), NULL,
|
||||
ID2P(LANG_CURRENT_PLAYLIST), ID2P(LANG_CATALOG),
|
||||
ID2P(LANG_REMOVE), ID2P(LANG_MOVE), ID2P(LANG_SHUFFLE),
|
||||
ID2P(LANG_REMOVE), ID2P(LANG_MOVE), ID2P(LANG_MENU_SHOW_ID3_INFO),
|
||||
ID2P(LANG_SHUFFLE),
|
||||
ID2P(LANG_SAVE),
|
||||
ID2P(LANG_PLAYLISTVIEWER_SETTINGS));
|
||||
bool current = (current_track->index == viewer.current_playing_track);
|
||||
|
@ -547,16 +573,19 @@ static int onplay_menu(int index)
|
|||
ret = 0;
|
||||
break;
|
||||
case 4:
|
||||
ret = show_track_info(current_track);
|
||||
break;
|
||||
case 5:
|
||||
/* shuffle */
|
||||
playlist_randomise(viewer.playlist, current_tick, false);
|
||||
ret = 1;
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
/* save playlist */
|
||||
save_playlist_screen(viewer.playlist);
|
||||
ret = 0;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
/* playlist viewer settings */
|
||||
result = do_menu(&viewer_settings_menu, NULL, NULL, false);
|
||||
ret = (result == MENU_ATTACHED_USB) ? -1 : 0;
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "powermgmt.h"
|
||||
#include "talk.h"
|
||||
#include "misc.h"
|
||||
#include "metadata.h"
|
||||
#include "screens.h"
|
||||
#include "debug.h"
|
||||
#include "led.h"
|
||||
|
@ -389,6 +388,8 @@ static const int id3_headers[]=
|
|||
struct id3view_info {
|
||||
struct mp3entry* id3;
|
||||
int count;
|
||||
int playlist_display_index;
|
||||
int playlist_amount;
|
||||
int info_id[ARRAYLEN(id3_headers)];
|
||||
};
|
||||
|
||||
|
@ -589,13 +590,13 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
|
|||
break;
|
||||
case LANG_ID3_PLAYLIST:
|
||||
snprintf(buffer, buffer_len, "%d/%d",
|
||||
playlist_get_display_index(), playlist_amount());
|
||||
info->playlist_display_index, info->playlist_amount);
|
||||
val=buffer;
|
||||
if(say_it)
|
||||
{
|
||||
talk_number(playlist_get_display_index(), true);
|
||||
talk_number(info->playlist_display_index, true);
|
||||
talk_id(VOICE_OF, true);
|
||||
talk_number(playlist_amount(), true);
|
||||
talk_number(info->playlist_amount, true);
|
||||
}
|
||||
break;
|
||||
case LANG_ID3_BITRATE:
|
||||
|
@ -669,15 +670,16 @@ static int id3_speak_item(int selected_item, void* data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool browse_id3(void)
|
||||
bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount)
|
||||
{
|
||||
struct gui_synclist id3_lists;
|
||||
struct mp3entry* id3 = audio_current_track();
|
||||
int key;
|
||||
unsigned int i;
|
||||
struct id3view_info info;
|
||||
info.count = 0;
|
||||
info.id3 = id3;
|
||||
info.playlist_display_index = playlist_display_index;
|
||||
info.playlist_amount = playlist_amount;
|
||||
bool ret = false;
|
||||
push_current_activity(ACTIVITY_ID3SCREEN);
|
||||
for (i = 0; i < ARRAYLEN(id3_headers); i++)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "timefuncs.h"
|
||||
#include "metadata.h"
|
||||
|
||||
struct screen;
|
||||
|
||||
|
@ -39,7 +40,7 @@ bool set_time_screen(const char* title, struct tm *tm);
|
|||
#endif
|
||||
|
||||
bool shutdown_screen(void);
|
||||
bool browse_id3(void);
|
||||
bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount);
|
||||
int view_runtime(void);
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
|
|
Loading…
Reference in a new issue