summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2023-01-06 05:37:26 +0100
committerChristian Soffke <christian.soffke@gmail.com>2023-01-06 19:00:24 +0100
commitb444ecfca2218068233a89c278cc86b9e9ef67d7 (patch)
treeb23a87b42e30cb73d31489420135ddd1611b862f
parent5750eb3181de4923a8d3141066f4631df3b7d70c (diff)
downloadrockbox-b444ecfca2218068233a89c278cc86b9e9ef67d7.tar.gz
rockbox-b444ecfca2218068233a89c278cc86b9e9ef67d7.zip
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
-rw-r--r--apps/gui/wps.c2
-rw-r--r--apps/onplay.c2
-rw-r--r--apps/playlist_viewer.c2
-rw-r--r--apps/plugin.h7
-rw-r--r--apps/plugins/properties.c2
-rw-r--r--apps/screens.c30
-rw-r--r--apps/screens.h3
7 files changed, 39 insertions, 9 deletions
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)
1035 gwps_leave_wps(true); 1035 gwps_leave_wps(true);
1036 if (browse_id3(audio_current_track(), 1036 if (browse_id3(audio_current_track(),
1037 playlist_get_display_index(), 1037 playlist_get_display_index(),
1038 playlist_amount())) 1038 playlist_amount(), NULL))
1039 return GO_TO_ROOT; 1039 return GO_TO_ROOT;
1040 restore = true; 1040 restore = true;
1041 } 1041 }
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)
1524 1524
1525 if (browse_id3(audio_current_track(), 1525 if (browse_id3(audio_current_track(),
1526 playlist_get_display_index(), 1526 playlist_get_display_index(),
1527 playlist_amount())) 1527 playlist_amount(), NULL))
1528 return GO_TO_ROOT; 1528 return GO_TO_ROOT;
1529 return GO_TO_PREVIOUS; 1529 return GO_TO_PREVIOUS;
1530} 1530}
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
517 517
518 return id3_retrieval_successful && 518 return id3_retrieval_successful &&
519 browse_id3(&id3, current_track->index + 1, 519 browse_id3(&id3, current_track->index + 1,
520 viewer.num_tracks) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED; 520 viewer.num_tracks, NULL) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED;
521} 521}
522 522
523 523
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);
157#define PLUGIN_MAGIC 0x526F634B /* RocK */ 157#define PLUGIN_MAGIC 0x526F634B /* RocK */
158 158
159/* increase this every time the api struct changes */ 159/* increase this every time the api struct changes */
160#define PLUGIN_API_VERSION 259 160#define PLUGIN_API_VERSION 260
161 161
162/* update this to latest version if a change to the api struct breaks 162/* update this to latest version if a change to the api struct breaks
163 backwards compatibility (and please take the opportunity to sort in any 163 backwards compatibility (and please take the opportunity to sort in any
164 new function which are "waiting" at the end of the function table) */ 164 new function which are "waiting" at the end of the function table) */
165#define PLUGIN_MIN_API_VERSION 259 165#define PLUGIN_MIN_API_VERSION 260
166 166
167/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ 167/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
168 168
@@ -489,7 +489,8 @@ struct plugin_api {
489 489
490 void (*onplay_show_playlist_menu)(const char* path, void (*playlist_insert_cb)); 490 void (*onplay_show_playlist_menu)(const char* path, void (*playlist_insert_cb));
491 bool (*browse_id3)(struct mp3entry *id3, 491 bool (*browse_id3)(struct mp3entry *id3,
492 int playlist_display_index, int playlist_amount); 492 int playlist_display_index, int playlist_amount,
493 struct tm *modified);
493 494
494 /* talking */ 495 /* talking */
495 int (*talk_id)(int32_t id, bool enqueue); 496 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)
412 FOR_NB_SCREENS(i) 412 FOR_NB_SCREENS(i)
413 rb->viewportmanager_theme_enable(i, true, NULL); 413 rb->viewportmanager_theme_enable(i, true, NULL);
414 414
415 bool usb = props_type == PROPS_ID3 ? rb->browse_id3(&id3, 0, 0) : 415 bool usb = props_type == PROPS_ID3 ? rb->browse_id3(&id3, 0, 0, &tm) :
416 browse_file_or_dir(&stats); 416 browse_file_or_dir(&stats);
417 417
418 FOR_NB_SCREENS(i) 418 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[]=
387 LANG_ID3_ALBUM_GAIN, 387 LANG_ID3_ALBUM_GAIN,
388 LANG_FILESIZE, 388 LANG_FILESIZE,
389 LANG_ID3_PATH, 389 LANG_ID3_PATH,
390 LANG_DATE,
391 LANG_TIME,
390}; 392};
391 393
392struct id3view_info { 394struct id3view_info {
393 struct mp3entry* id3; 395 struct mp3entry* id3;
396 struct tm *modified;
394 int count; 397 int count;
395 int playlist_display_index; 398 int playlist_display_index;
396 int playlist_amount; 399 int playlist_amount;
@@ -488,6 +491,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
488{ 491{
489 struct id3view_info *info = (struct id3view_info*)data; 492 struct id3view_info *info = (struct id3view_info*)data;
490 struct mp3entry* id3 =info->id3; 493 struct mp3entry* id3 =info->id3;
494 struct tm *tm = info->modified;
491 int info_no=selected_item/2; 495 int info_no=selected_item/2;
492 if(!(selected_item%2)) 496 if(!(selected_item%2))
493 {/* header */ 497 {/* header */
@@ -662,6 +666,28 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
662 if(say_it && val) 666 if(say_it && val)
663 output_dyn_value(NULL, 0, id3->filesize, byte_units, 4, true); 667 output_dyn_value(NULL, 0, id3->filesize, byte_units, 4, true);
664 break; 668 break;
669 case LANG_DATE:
670 if (!tm)
671 return NULL;
672
673 snprintf(buffer, buffer_len, "%04d/%02d/%02d",
674 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
675
676 val = buffer;
677 if (say_it)
678 talk_date(tm, true);
679 break;
680 case LANG_TIME:
681 if (!tm)
682 return NULL;
683
684 snprintf(buffer, buffer_len, "%02d:%02d:%02d",
685 tm->tm_hour, tm->tm_min, tm->tm_sec);
686
687 val = buffer;
688 if (say_it)
689 talk_time(tm, true);
690 break;
665 } 691 }
666 if((!val || !*val) && say_it) 692 if((!val || !*val) && say_it)
667 talk_id(LANG_ID3_NO_INFO, true); 693 talk_id(LANG_ID3_NO_INFO, true);
@@ -688,7 +714,8 @@ static int id3_speak_item(int selected_item, void* data)
688 return 0; 714 return 0;
689} 715}
690 716
691bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount) 717bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount,
718 struct tm *modified)
692{ 719{
693 struct gui_synclist id3_lists; 720 struct gui_synclist id3_lists;
694 int key; 721 int key;
@@ -696,6 +723,7 @@ bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_a
696 struct id3view_info info; 723 struct id3view_info info;
697 info.count = 0; 724 info.count = 0;
698 info.id3 = id3; 725 info.id3 = id3;
726 info.modified = modified;
699 info.playlist_display_index = playlist_display_index; 727 info.playlist_display_index = playlist_display_index;
700 info.playlist_amount = playlist_amount; 728 info.playlist_amount = playlist_amount;
701 bool ret = false; 729 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);
39bool set_time_screen(const char* title, struct tm *tm, bool set_date); 39bool set_time_screen(const char* title, struct tm *tm, bool set_date);
40#endif 40#endif
41 41
42bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount); 42bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount,
43 struct tm *modified);
43int view_runtime(void); 44int view_runtime(void);
44 45
45#ifdef HAVE_TOUCHSCREEN 46#ifdef HAVE_TOUCHSCREEN