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)
}
#endif /* HAVE_LCD_BITMAP */
+extern bool write_metadata_log;
+
+static bool dbg_metadatalog(void)
+{
+ write_metadata_log = !write_metadata_log;
+ splashf(HZ, "Metadata log %s",
+ write_metadata_log?"enabled":"disabled");
+ return false;
+}
+
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
static bool dbg_set_memory_guard(void)
{
@@ -2360,6 +2370,7 @@ static const struct the_menu_item menuitems[] = {
{ "Dump ATA identify info", dbg_identify_info},
#endif
#endif
+ { "Metadata log", dbg_metadatalog },
#ifdef HAVE_DIRCACHE
{ "View dircache info", dbg_dircache_info },
#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)
return true;
}
#endif /* CONFIG_CODEC == SWCODEC */
+bool write_metadata_log = false;
const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
{
@@ -291,6 +292,19 @@ bool mp3info(struct mp3entry *entry, const char *filename)
bool get_metadata(struct mp3entry* id3, int fd, const char* trackname)
{
const struct afmt_entry *entry;
+ int logfd = 0;
+ DEBUGF("Read metadata for %s\n", trackname);
+ if (write_metadata_log)
+ {
+ logfd = open("/metadata.log", O_WRONLY | O_APPEND | O_CREAT, 0666);
+ if (logfd >= 0)
+ {
+ write(logfd, trackname, strlen(trackname));
+ write(logfd, "\n", 1);
+ close(logfd);
+ }
+ }
+
/* Clear the mp3entry to avoid having bogus pointers appear */
memset(id3, 0, sizeof(struct mp3entry));