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/screens.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'apps/screens.c') 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; -- cgit v1.2.3