Track Info: Show number of tracks being inspected

Applies to the database and PictureFlow

+ fix red 6ca57ec

Change-Id: If708851ebdfe075e9d6ea3f2e2dd790cc9deac94
This commit is contained in:
Christian Soffke 2023-04-12 20:19:58 +02:00
parent 6ca57ec389
commit 43b0fba75d
9 changed files with 30 additions and 18 deletions

View file

@ -1035,7 +1035,7 @@ long gui_wps_show(void)
gwps_leave_wps(true);
if (browse_id3(audio_current_track(),
playlist_get_display_index(),
playlist_amount(), NULL, false))
playlist_amount(), NULL, 1))
return GO_TO_ROOT;
restore = true;
}

View file

@ -1569,7 +1569,7 @@ static int browse_id3_wrapper(void)
if (browse_id3(audio_current_track(),
playlist_get_display_index(),
playlist_amount(), NULL, false))
playlist_amount(), NULL, 1))
return GO_TO_ROOT;
return GO_TO_PREVIOUS;
}

View file

@ -526,7 +526,7 @@ static enum pv_onplay_result show_track_info(const struct playlist_entry *curren
return id3_retrieval_successful &&
browse_id3(&id3, current_track->index + 1,
viewer.num_tracks, NULL, false) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED;
viewer.num_tracks, NULL, 1) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED;
}

View file

@ -500,7 +500,7 @@ struct plugin_api {
void (*add_to_pl_cb));
bool (*browse_id3)(struct mp3entry *id3,
int playlist_display_index, int playlist_amount,
struct tm *modified, bool multiple_tracks);
struct tm *modified, int track_ct);
/* talking */
int (*talk_id)(int32_t id, bool enqueue);

View file

@ -135,7 +135,7 @@ void collect_id3(struct mp3entry *id3, bool is_first_track)
* - Unit for length will be s instead of ms
*
* Use result only as input for browse_id3,
* and set multiple_tracks parameter to true.
* with the track_ct parameter set to > 1.
*/
void finalize_id3(struct mp3entry *id3)
{

View file

@ -4027,7 +4027,7 @@ static int show_id3_info(const char *selected_file)
if (is_multiple_tracks)
finalize_id3(&id3);
return rb->browse_id3(&id3, 0, 0, NULL, i > 1) ? PLUGIN_USB_CONNECTED : 0;
return rb->browse_id3(&id3, 0, 0, NULL, i) ? PLUGIN_USB_CONNECTED : 0;
}

View file

@ -446,9 +446,11 @@ enum plugin_status plugin_start(const void* parameter)
FOR_NB_SCREENS(i)
rb->viewportmanager_theme_enable(i, true, NULL);
bool usb = props_type == PROPS_ID3 ? rb->browse_id3(&id3, 0, 0, &tm, false) :
(props_type == PROPS_MUL_ID3 ? rb->browse_id3(&id3, 0, 0, NULL, mul_id3_count > 1) :
browse_file_or_dir(&stats));
bool usb = props_type == PROPS_ID3 ? rb->browse_id3(&id3, 0, 0, &tm, 1) :
#ifdef HAVE_TAGCACHE
props_type == PROPS_MUL_ID3 ? rb->browse_id3(&id3, 0, 0, NULL, mul_id3_count) :
#endif
browse_file_or_dir(&stats);
FOR_NB_SCREENS(i)
rb->viewportmanager_theme_undo(i, false);

View file

@ -367,6 +367,7 @@ bool set_time_screen(const char* title, struct tm *tm, bool set_date)
static const int id3_headers[]=
{
LANG_TAGNAVI_ALL_TRACKS,
LANG_ID3_TITLE,
LANG_ID3_ARTIST,
LANG_ID3_COMPOSER,
@ -394,7 +395,7 @@ static const int id3_headers[]=
struct id3view_info {
struct mp3entry* id3;
struct tm *modified;
bool multiple_tracks;
int track_ct;
int count;
int playlist_display_index;
int playlist_amount;
@ -502,7 +503,8 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
if(say_it)
talk_id(id3_headers[info->info_id[info_no]], false);
snprintf(buffer, buffer_len,
"[%s]", str(id3_headers[info->info_id[info_no]]));
info->info_id[info_no] > 0 ? "[%s]" : "%s",
str(id3_headers[info->info_id[info_no]]));
return buffer;
}
else
@ -511,6 +513,14 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
char * val=NULL;
switch(id3_headers[info->info_id[info_no]])
{
case LANG_TAGNAVI_ALL_TRACKS:
if (info->track_ct <= 1)
return NULL;
snprintf(buffer, buffer_len, "%d", info->track_ct);
val = buffer;
if(say_it)
talk_number(info->track_ct, true);
break;
case LANG_ID3_TITLE:
val=id3->title;
if(say_it && val)
@ -597,7 +607,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
}
break;
case LANG_ID3_LENGTH:
length = info->multiple_tracks ? id3->length : id3->length / 1000;
length = info->track_ct > 1 ? id3->length : id3->length / 1000;
format_time_auto(buffer, buffer_len,
length, UNIT_SEC | UNIT_TRIM_ZERO, true);
@ -674,7 +684,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
case LANG_FILESIZE: /* not LANG_ID3_FILESIZE because the string is shared */
if (!id3->filesize)
return NULL;
if (info->multiple_tracks)
if (info->track_ct > 1)
{
unit = kibyte_units;
unit_ct = 3;
@ -737,11 +747,11 @@ static int id3_speak_item(int selected_item, void* data)
return 0;
}
/* Note: Setting multiple_tracks parameter to true causes filesize value
* to be treated as KiB (instead of Bytes), and length as s instead of ms.
/* Note: If track_ct > 1, filesize value will be treated as
* KiB (instead of Bytes), and length as s instead of ms.
*/
bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount,
struct tm *modified, bool multiple_tracks)
struct tm *modified, int track_ct)
{
struct gui_synclist id3_lists;
int key;
@ -750,7 +760,7 @@ bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_a
info.count = 0;
info.id3 = id3;
info.modified = modified;
info.multiple_tracks = multiple_tracks;
info.track_ct = track_ct;
info.playlist_display_index = playlist_display_index;
info.playlist_amount = playlist_amount;
bool ret = false;

View file

@ -40,7 +40,7 @@ bool set_time_screen(const char* title, struct tm *tm, bool set_date);
#endif
bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount,
struct tm *modified, bool multiple_tracks);
struct tm *modified, int track_ct);
int view_runtime(void);
#ifdef HAVE_TOUCHSCREEN