diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2023-10-13 19:30:09 +0200 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2023-10-19 13:32:03 +0200 |
commit | 4cfd7cc77d0cf85ba50f3b4edc1bd7dba2053d65 (patch) | |
tree | 89515ef6c4a43e36a54b39dd5c106d25c161ae12 /apps/screens.c | |
parent | 759aaecdffc3302cf965ade7aef9c2742a9270f3 (diff) | |
download | rockbox-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
Diffstat (limited to 'apps/screens.c')
-rw-r--r-- | apps/screens.c | 44 |
1 files changed, 40 insertions, 4 deletions
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 | */ |
753 | bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, | 780 | bool 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 | ||
853 | bool 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 | |||
824 | static const char* runtime_get_data(int selected_item, void* data, | 860 | static 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 | { |