summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/debug_menu.c11
-rw-r--r--apps/metadata.c14
2 files changed, 25 insertions, 0 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 9fcb0719be..968355f518 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -2086,6 +2086,16 @@ static bool dbg_screendump(void)
2086} 2086}
2087#endif /* HAVE_LCD_BITMAP */ 2087#endif /* HAVE_LCD_BITMAP */
2088 2088
2089extern bool write_metadata_log;
2090
2091static bool dbg_metadatalog(void)
2092{
2093 write_metadata_log = !write_metadata_log;
2094 splashf(HZ, "Metadata log %s",
2095 write_metadata_log?"enabled":"disabled");
2096 return false;
2097}
2098
2089#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) 2099#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2090static bool dbg_set_memory_guard(void) 2100static bool dbg_set_memory_guard(void)
2091{ 2101{
@@ -2360,6 +2370,7 @@ static const struct the_menu_item menuitems[] = {
2360 { "Dump ATA identify info", dbg_identify_info}, 2370 { "Dump ATA identify info", dbg_identify_info},
2361#endif 2371#endif
2362#endif 2372#endif
2373 { "Metadata log", dbg_metadatalog },
2363#ifdef HAVE_DIRCACHE 2374#ifdef HAVE_DIRCACHE
2364 { "View dircache info", dbg_dircache_info }, 2375 { "View dircache info", dbg_dircache_info },
2365#endif 2376#endif
diff --git a/apps/metadata.c b/apps/metadata.c
index 866e035f4e..79ef7ebcad 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -55,6 +55,7 @@ static bool get_other_asap_metadata(int fd, struct mp3entry *id3)
55 return true; 55 return true;
56} 56}
57#endif /* CONFIG_CODEC == SWCODEC */ 57#endif /* CONFIG_CODEC == SWCODEC */
58bool write_metadata_log = false;
58 59
59const struct afmt_entry audio_formats[AFMT_NUM_CODECS] = 60const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
60{ 61{
@@ -291,6 +292,19 @@ bool mp3info(struct mp3entry *entry, const char *filename)
291bool get_metadata(struct mp3entry* id3, int fd, const char* trackname) 292bool get_metadata(struct mp3entry* id3, int fd, const char* trackname)
292{ 293{
293 const struct afmt_entry *entry; 294 const struct afmt_entry *entry;
295 int logfd = 0;
296 DEBUGF("Read metadata for %s\n", trackname);
297 if (write_metadata_log)
298 {
299 logfd = open("/metadata.log", O_WRONLY | O_APPEND | O_CREAT, 0666);
300 if (logfd >= 0)
301 {
302 write(logfd, trackname, strlen(trackname));
303 write(logfd, "\n", 1);
304 close(logfd);
305 }
306 }
307
294 /* Clear the mp3entry to avoid having bogus pointers appear */ 308 /* Clear the mp3entry to avoid having bogus pointers appear */
295 memset(id3, 0, sizeof(struct mp3entry)); 309 memset(id3, 0, sizeof(struct mp3entry));
296 310