summaryrefslogtreecommitdiff
path: root/apps/playlist_viewer.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist_viewer.c')
-rw-r--r--apps/playlist_viewer.c35
1 files changed, 32 insertions, 3 deletions
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;