diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2023-04-12 20:19:58 +0200 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2023-04-13 03:55:21 +0200 |
commit | 43b0fba75d4312230793f2747700371362204bb6 (patch) | |
tree | edd51dacc2c0218bf415645708386d938b1a1a56 /apps/screens.c | |
parent | 6ca57ec389e9dd2141f9c9e73063c7193526dbbd (diff) | |
download | rockbox-43b0fba75d4312230793f2747700371362204bb6.tar.gz rockbox-43b0fba75d4312230793f2747700371362204bb6.zip |
Track Info: Show number of tracks being inspected
Applies to the database and PictureFlow
+ fix red 6ca57ec
Change-Id: If708851ebdfe075e9d6ea3f2e2dd790cc9deac94
Diffstat (limited to 'apps/screens.c')
-rw-r--r-- | apps/screens.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/apps/screens.c b/apps/screens.c index c519da9353..d359267d8d 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -367,6 +367,7 @@ bool set_time_screen(const char* title, struct tm *tm, bool set_date) | |||
367 | 367 | ||
368 | static const int id3_headers[]= | 368 | static const int id3_headers[]= |
369 | { | 369 | { |
370 | LANG_TAGNAVI_ALL_TRACKS, | ||
370 | LANG_ID3_TITLE, | 371 | LANG_ID3_TITLE, |
371 | LANG_ID3_ARTIST, | 372 | LANG_ID3_ARTIST, |
372 | LANG_ID3_COMPOSER, | 373 | LANG_ID3_COMPOSER, |
@@ -394,7 +395,7 @@ static const int id3_headers[]= | |||
394 | struct id3view_info { | 395 | struct id3view_info { |
395 | struct mp3entry* id3; | 396 | struct mp3entry* id3; |
396 | struct tm *modified; | 397 | struct tm *modified; |
397 | bool multiple_tracks; | 398 | int track_ct; |
398 | int count; | 399 | int count; |
399 | int playlist_display_index; | 400 | int playlist_display_index; |
400 | int playlist_amount; | 401 | int playlist_amount; |
@@ -502,7 +503,8 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, | |||
502 | if(say_it) | 503 | if(say_it) |
503 | talk_id(id3_headers[info->info_id[info_no]], false); | 504 | talk_id(id3_headers[info->info_id[info_no]], false); |
504 | snprintf(buffer, buffer_len, | 505 | snprintf(buffer, buffer_len, |
505 | "[%s]", str(id3_headers[info->info_id[info_no]])); | 506 | info->info_id[info_no] > 0 ? "[%s]" : "%s", |
507 | str(id3_headers[info->info_id[info_no]])); | ||
506 | return buffer; | 508 | return buffer; |
507 | } | 509 | } |
508 | else | 510 | else |
@@ -511,6 +513,14 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, | |||
511 | char * val=NULL; | 513 | char * val=NULL; |
512 | switch(id3_headers[info->info_id[info_no]]) | 514 | switch(id3_headers[info->info_id[info_no]]) |
513 | { | 515 | { |
516 | case LANG_TAGNAVI_ALL_TRACKS: | ||
517 | if (info->track_ct <= 1) | ||
518 | return NULL; | ||
519 | snprintf(buffer, buffer_len, "%d", info->track_ct); | ||
520 | val = buffer; | ||
521 | if(say_it) | ||
522 | talk_number(info->track_ct, true); | ||
523 | break; | ||
514 | case LANG_ID3_TITLE: | 524 | case LANG_ID3_TITLE: |
515 | val=id3->title; | 525 | val=id3->title; |
516 | if(say_it && val) | 526 | if(say_it && val) |
@@ -597,7 +607,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, | |||
597 | } | 607 | } |
598 | break; | 608 | break; |
599 | case LANG_ID3_LENGTH: | 609 | case LANG_ID3_LENGTH: |
600 | length = info->multiple_tracks ? id3->length : id3->length / 1000; | 610 | length = info->track_ct > 1 ? id3->length : id3->length / 1000; |
601 | 611 | ||
602 | format_time_auto(buffer, buffer_len, | 612 | format_time_auto(buffer, buffer_len, |
603 | length, UNIT_SEC | UNIT_TRIM_ZERO, true); | 613 | length, UNIT_SEC | UNIT_TRIM_ZERO, true); |
@@ -674,7 +684,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, | |||
674 | case LANG_FILESIZE: /* not LANG_ID3_FILESIZE because the string is shared */ | 684 | case LANG_FILESIZE: /* not LANG_ID3_FILESIZE because the string is shared */ |
675 | if (!id3->filesize) | 685 | if (!id3->filesize) |
676 | return NULL; | 686 | return NULL; |
677 | if (info->multiple_tracks) | 687 | if (info->track_ct > 1) |
678 | { | 688 | { |
679 | unit = kibyte_units; | 689 | unit = kibyte_units; |
680 | unit_ct = 3; | 690 | unit_ct = 3; |
@@ -737,11 +747,11 @@ static int id3_speak_item(int selected_item, void* data) | |||
737 | return 0; | 747 | return 0; |
738 | } | 748 | } |
739 | 749 | ||
740 | /* Note: Setting multiple_tracks parameter to true causes filesize value | 750 | /* Note: If track_ct > 1, filesize value will be treated as |
741 | * to be treated as KiB (instead of Bytes), and length as s instead of ms. | 751 | * KiB (instead of Bytes), and length as s instead of ms. |
742 | */ | 752 | */ |
743 | bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, | 753 | bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, |
744 | struct tm *modified, bool multiple_tracks) | 754 | struct tm *modified, int track_ct) |
745 | { | 755 | { |
746 | struct gui_synclist id3_lists; | 756 | struct gui_synclist id3_lists; |
747 | int key; | 757 | int key; |
@@ -750,7 +760,7 @@ bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_a | |||
750 | info.count = 0; | 760 | info.count = 0; |
751 | info.id3 = id3; | 761 | info.id3 = id3; |
752 | info.modified = modified; | 762 | info.modified = modified; |
753 | info.multiple_tracks = multiple_tracks; | 763 | info.track_ct = track_ct; |
754 | info.playlist_display_index = playlist_display_index; | 764 | info.playlist_display_index = playlist_display_index; |
755 | info.playlist_amount = playlist_amount; | 765 | info.playlist_amount = playlist_amount; |
756 | bool ret = false; | 766 | bool ret = false; |