plugins: Properties: Add 'Last Modified' for audio files

In commit f3358eb, the Properties plugin started using the
Track Info screen for audio files, which didn't show when
the file was last modified. This adds it back.

Change-Id: I3ce519da234a4bcadab1d64b67de0298cada8f6e
This commit is contained in:
Christian Soffke 2023-01-06 05:37:26 +01:00
parent 5750eb3181
commit b444ecfca2
7 changed files with 39 additions and 9 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()))
playlist_amount(), NULL))
return GO_TO_ROOT;
restore = true;
}

View file

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

View file

@ -517,7 +517,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) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED;
viewer.num_tracks, NULL) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED;
}

View file

@ -157,12 +157,12 @@ int plugin_open(const char *plugin, const char *parameter);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 259
#define PLUGIN_API_VERSION 260
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 259
#define PLUGIN_MIN_API_VERSION 260
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
@ -489,7 +489,8 @@ struct plugin_api {
void (*onplay_show_playlist_menu)(const char* path, void (*playlist_insert_cb));
bool (*browse_id3)(struct mp3entry *id3,
int playlist_display_index, int playlist_amount);
int playlist_display_index, int playlist_amount,
struct tm *modified);
/* talking */
int (*talk_id)(int32_t id, bool enqueue);

View file

@ -412,7 +412,7 @@ 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) :
bool usb = props_type == PROPS_ID3 ? rb->browse_id3(&id3, 0, 0, &tm) :
browse_file_or_dir(&stats);
FOR_NB_SCREENS(i)

View file

@ -387,10 +387,13 @@ static const int id3_headers[]=
LANG_ID3_ALBUM_GAIN,
LANG_FILESIZE,
LANG_ID3_PATH,
LANG_DATE,
LANG_TIME,
};
struct id3view_info {
struct mp3entry* id3;
struct tm *modified;
int count;
int playlist_display_index;
int playlist_amount;
@ -488,6 +491,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
{
struct id3view_info *info = (struct id3view_info*)data;
struct mp3entry* id3 =info->id3;
struct tm *tm = info->modified;
int info_no=selected_item/2;
if(!(selected_item%2))
{/* header */
@ -662,6 +666,28 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
if(say_it && val)
output_dyn_value(NULL, 0, id3->filesize, byte_units, 4, true);
break;
case LANG_DATE:
if (!tm)
return NULL;
snprintf(buffer, buffer_len, "%04d/%02d/%02d",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
val = buffer;
if (say_it)
talk_date(tm, true);
break;
case LANG_TIME:
if (!tm)
return NULL;
snprintf(buffer, buffer_len, "%02d:%02d:%02d",
tm->tm_hour, tm->tm_min, tm->tm_sec);
val = buffer;
if (say_it)
talk_time(tm, true);
break;
}
if((!val || !*val) && say_it)
talk_id(LANG_ID3_NO_INFO, true);
@ -688,7 +714,8 @@ static int id3_speak_item(int selected_item, void* data)
return 0;
}
bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount)
bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount,
struct tm *modified)
{
struct gui_synclist id3_lists;
int key;
@ -696,6 +723,7 @@ bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_a
struct id3view_info info;
info.count = 0;
info.id3 = id3;
info.modified = modified;
info.playlist_display_index = playlist_display_index;
info.playlist_amount = playlist_amount;
bool ret = false;

View file

@ -39,7 +39,8 @@ int mmc_remove_request(void);
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);
bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount,
struct tm *modified);
int view_runtime(void);
#ifdef HAVE_TOUCHSCREEN