From b444ecfca2218068233a89c278cc86b9e9ef67d7 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Fri, 6 Jan 2023 05:37:26 +0100 Subject: 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 --- apps/gui/wps.c | 2 +- apps/onplay.c | 2 +- apps/playlist_viewer.c | 2 +- apps/plugin.h | 7 ++++--- apps/plugins/properties.c | 2 +- apps/screens.c | 30 +++++++++++++++++++++++++++++- apps/screens.h | 3 ++- 7 files changed, 39 insertions(+), 9 deletions(-) (limited to 'apps') diff --git a/apps/gui/wps.c b/apps/gui/wps.c index cef232c6fc..4b0c7c056f 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -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; } diff --git a/apps/onplay.c b/apps/onplay.c index ec38ad9132..a3efadd8f6 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -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; } diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 80239367e4..e9b57285cc 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -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; } diff --git a/apps/plugin.h b/apps/plugin.h index e44511a6f5..ed688eb753 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -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); diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 73ad841c0c..46cf818fb4 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c @@ -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) diff --git a/apps/screens.c b/apps/screens.c index 4fd6c2c2e2..91280a72f1 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -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; diff --git a/apps/screens.h b/apps/screens.h index 3322ce53e7..47dc1375ca 100644 --- a/apps/screens.h +++ b/apps/screens.h @@ -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 -- cgit v1.2.3