summaryrefslogtreecommitdiff
path: root/apps/plugins/properties.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/properties.c')
-rw-r--r--apps/plugins/properties.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index ce9bfa04a2..81e10812cc 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -35,6 +35,7 @@ char str_time[64];
35char str_title[MAX_PATH]; 35char str_title[MAX_PATH];
36char str_artist[MAX_PATH]; 36char str_artist[MAX_PATH];
37char str_album[MAX_PATH]; 37char str_album[MAX_PATH];
38char str_duration[32];
38 39
39int num_properties; 40int num_properties;
40 41
@@ -103,6 +104,7 @@ static bool file_properties(char* selected_file)
103 if (!rb->mp3info(&id3, selected_file)) 104 if (!rb->mp3info(&id3, selected_file))
104#endif 105#endif
105 { 106 {
107 long dur = id3.length / 1000; /* seconds */
106 rb->snprintf(str_artist, sizeof str_artist, 108 rb->snprintf(str_artist, sizeof str_artist,
107 "Artist: %s", id3.artist ? id3.artist : ""); 109 "Artist: %s", id3.artist ? id3.artist : "");
108 rb->snprintf(str_title, sizeof str_title, 110 rb->snprintf(str_title, sizeof str_title,
@@ -110,6 +112,21 @@ static bool file_properties(char* selected_file)
110 rb->snprintf(str_album, sizeof str_album, 112 rb->snprintf(str_album, sizeof str_album,
111 "Album: %s", id3.album ? id3.album : ""); 113 "Album: %s", id3.album ? id3.album : "");
112 num_properties += 3; 114 num_properties += 3;
115
116 if (dur > 0)
117 {
118 if (dur < 3600)
119 rb->snprintf(str_duration, sizeof str_duration,
120 "Duration: %d:%02d", (int)(dur / 60),
121 (int)(dur % 60));
122 else
123 rb->snprintf(str_duration, sizeof str_duration,
124 "Duration: %d:%02d:%02d",
125 (int)(dur / 3600),
126 (int)(dur % 3600 / 60),
127 (int)(dur % 60));
128 num_properties++;
129 }
113 } 130 }
114#if (CONFIG_CODEC == SWCODEC) 131#if (CONFIG_CODEC == SWCODEC)
115 rb->close(fd); 132 rb->close(fd);
@@ -243,6 +260,9 @@ char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len)
243 case 7: 260 case 7:
244 rb->strncpy(buffer, its_a_dir ? "" : str_album, buffer_len); 261 rb->strncpy(buffer, its_a_dir ? "" : str_album, buffer_len);
245 break; 262 break;
263 case 8:
264 rb->strncpy(buffer, its_a_dir ? "" : str_duration, buffer_len);
265 break;
246 default: 266 default:
247 rb->strncpy(buffer, "ERROR", buffer_len); 267 rb->strncpy(buffer, "ERROR", buffer_len);
248 break; 268 break;