summaryrefslogtreecommitdiff
path: root/apps/metadata.c
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2010-12-11 04:30:54 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2010-12-11 04:30:54 +0000
commit9788043b11710f755b7b05bd2bd7b27f38aabbdf (patch)
treece85a555bc3c5064e1834693d5addefa91d50141 /apps/metadata.c
parentb3f38bcf6324f5a3545c7aff6689164318cd8a20 (diff)
downloadrockbox-9788043b11710f755b7b05bd2bd7b27f38aabbdf.tar.gz
rockbox-9788043b11710f755b7b05bd2bd7b27f38aabbdf.zip
Commit FS#11776 by Jonas Haggqvist. Enables option to log building the database in order to trouble shoot crashes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28789 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata.c')
-rw-r--r--apps/metadata.c14
1 files changed, 14 insertions, 0 deletions
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