summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2023-10-13 19:30:09 +0200
committerChristian Soffke <christian.soffke@gmail.com>2023-10-19 13:32:03 +0200
commit4cfd7cc77d0cf85ba50f3b4edc1bd7dba2053d65 (patch)
tree89515ef6c4a43e36a54b39dd5c106d25c161ae12
parent759aaecdffc3302cf965ade7aef9c2742a9270f3 (diff)
downloadrockbox-4cfd7cc77d0cf85ba50f3b4edc1bd7dba2053d65.tar.gz
rockbox-4cfd7cc77d0cf85ba50f3b4edc1bd7dba2053d65.zip
Track Info [Playlist] field: Add playlist name
For any selected track that is part of a playlist, additional info about the list is now provided in the [Playlist] field of the Track Info screen. 1) Asterisk indicates if playlist has been modified. 2) Playlist filename is visible, unless the current playlist is *not* associated with a file on disk, in which case the following will be shown instead: - (Folder) for unmodified folder playlists. - (Dynamic) for playlists that are neither associated with a playlist file, nor with a folder. Change-Id: I9dcf7cbba4ac2e37b23413180a2b2bf4bbe5ee2a
-rw-r--r--apps/playlist_viewer.c2
-rw-r--r--apps/screens.c44
-rw-r--r--apps/screens.h4
3 files changed, 45 insertions, 5 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index d780bfb7e9..8219aa5feb 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -523,7 +523,7 @@ static enum pv_onplay_result show_track_info(const struct playlist_entry *curren
523 } 523 }
524 524
525 return id3_retrieval_successful && 525 return id3_retrieval_successful &&
526 browse_id3(&id3, current_track->index + 1, 526 browse_id3_ex(&id3, viewer.playlist, current_track->index + 1,
527 viewer.num_tracks, NULL, 1) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED; 527 viewer.num_tracks, NULL, 1) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED;
528} 528}
529 529
diff --git a/apps/screens.c b/apps/screens.c
index 50b7711fa7..c11e052bce 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -397,6 +397,7 @@ struct id3view_info {
397 struct tm *modified; 397 struct tm *modified;
398 int track_ct; 398 int track_ct;
399 int count; 399 int count;
400 struct playlist_info *playlist;
400 int playlist_display_index; 401 int playlist_display_index;
401 int playlist_amount; 402 int playlist_amount;
402 int info_id[ARRAYLEN(id3_headers)]; 403 int info_id[ARRAYLEN(id3_headers)];
@@ -496,6 +497,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
496 const unsigned char * const *unit; 497 const unsigned char * const *unit;
497 unsigned int unit_ct; 498 unsigned int unit_ct;
498 unsigned long length; 499 unsigned long length;
500 bool pl_modified;
499 struct tm *tm = info->modified; 501 struct tm *tm = info->modified;
500 int info_no=selected_item/2; 502 int info_no=selected_item/2;
501 if(!(selected_item%2)) 503 if(!(selected_item%2))
@@ -618,14 +620,39 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
618 case LANG_ID3_PLAYLIST: 620 case LANG_ID3_PLAYLIST:
619 if (info->playlist_display_index == 0 || info->playlist_amount == 0 ) 621 if (info->playlist_display_index == 0 || info->playlist_amount == 0 )
620 return NULL; 622 return NULL;
621 snprintf(buffer, buffer_len, "%d/%d", 623
622 info->playlist_display_index, info->playlist_amount); 624 pl_modified = playlist_modified(info->playlist);
623 val=buffer; 625
626 snprintf(buffer, buffer_len, "%d/%d%s",
627 info->playlist_display_index, info->playlist_amount,
628 pl_modified ? "* " :" ");
629 val = buffer;
630 size_t prefix_len = strlen(buffer);
631 buffer += prefix_len;
632 buffer_len -= prefix_len;
633
634 if (info->playlist)
635 playlist_name(info->playlist, buffer, buffer_len);
636 else
637 {
638 if (playlist_allow_dirplay(NULL))
639 strmemccpy(buffer, "(Folder)", buffer_len);
640 else if (playlist_dynamic_only())
641 strmemccpy(buffer, "(Dynamic)", buffer_len);
642 else
643 playlist_name(NULL, buffer, buffer_len);
644 }
645
624 if(say_it) 646 if(say_it)
625 { 647 {
626 talk_number(info->playlist_display_index, true); 648 talk_number(info->playlist_display_index, true);
627 talk_id(VOICE_OF, true); 649 talk_id(VOICE_OF, true);
628 talk_number(info->playlist_amount, true); 650 talk_number(info->playlist_amount, true);
651
652 if (pl_modified)
653 talk_spell("Modified", true);
654 if (buffer) /* playlist name */
655 talk_spell(buffer, true);
629 } 656 }
630 break; 657 break;
631 case LANG_FORMAT: 658 case LANG_FORMAT:
@@ -750,7 +777,8 @@ static int id3_speak_item(int selected_item, void* data)
750/* Note: If track_ct > 1, filesize value will be treated as 777/* Note: If track_ct > 1, filesize value will be treated as
751 * KiB (instead of Bytes), and length as s instead of ms. 778 * KiB (instead of Bytes), and length as s instead of ms.
752 */ 779 */
753bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, 780bool browse_id3_ex(struct mp3entry *id3, struct playlist_info *playlist,
781 int playlist_display_index, int playlist_amount,
754 struct tm *modified, int track_ct) 782 struct tm *modified, int track_ct)
755{ 783{
756 struct gui_synclist id3_lists; 784 struct gui_synclist id3_lists;
@@ -760,6 +788,7 @@ bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_a
760 info.id3 = id3; 788 info.id3 = id3;
761 info.modified = modified; 789 info.modified = modified;
762 info.track_ct = track_ct; 790 info.track_ct = track_ct;
791 info.playlist = playlist;
763 info.playlist_amount = playlist_amount; 792 info.playlist_amount = playlist_amount;
764 bool ret = false; 793 bool ret = false;
765 int curr_activity = get_current_activity(); 794 int curr_activity = get_current_activity();
@@ -821,6 +850,13 @@ refresh_info:
821 return ret; 850 return ret;
822} 851}
823 852
853bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount,
854 struct tm *modified, int track_ct)
855{
856 return browse_id3_ex(id3, NULL, playlist_display_index, playlist_amount,
857 modified, track_ct);
858}
859
824static const char* runtime_get_data(int selected_item, void* data, 860static const char* runtime_get_data(int selected_item, void* data,
825 char* buffer, size_t buffer_len) 861 char* buffer, size_t buffer_len)
826{ 862{
diff --git a/apps/screens.h b/apps/screens.h
index bcd06655ad..1cfd7dcdcf 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -24,6 +24,7 @@
24#include "config.h" 24#include "config.h"
25#include "timefuncs.h" 25#include "timefuncs.h"
26#include "metadata.h" 26#include "metadata.h"
27#include "playlist.h"
27 28
28struct screen; 29struct screen;
29 30
@@ -41,6 +42,9 @@ bool set_time_screen(const char* title, struct tm *tm, bool set_date);
41 42
42bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, 43bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount,
43 struct tm *modified, int track_ct); 44 struct tm *modified, int track_ct);
45bool browse_id3_ex(struct mp3entry *id3, struct playlist_info *playlist,
46 int playlist_display_index, int playlist_amount,
47 struct tm *modified, int track_ct);
44int view_runtime(void); 48int view_runtime(void);
45 49
46#ifdef HAVE_TOUCHSCREEN 50#ifdef HAVE_TOUCHSCREEN