summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/id3.c23
-rw-r--r--apps/plugins/lib/id3.h4
-rw-r--r--apps/plugins/lib/mul_id3.h2
3 files changed, 11 insertions, 18 deletions
diff --git a/apps/plugins/lib/id3.c b/apps/plugins/lib/id3.c
index 0ce1736ffe..b0202b1d9c 100644
--- a/apps/plugins/lib/id3.c
+++ b/apps/plugins/lib/id3.c
@@ -20,27 +20,20 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22 22
23bool retrieve_id3(struct mp3entry *id3, const char* file, bool try_tagcache) 23/* Fills mp3entry with metadata retrieved from RAM, if possible, or by reading from
24 * the file directly. Note that the tagcache only stores a subset of metadata and
25 * will thus not return certain properties of the file, such as frequency, size, or
26 * codec.
27 */
28bool retrieve_id3(struct mp3entry *id3, const char* file)
24{ 29{
25 bool ret = false;
26 int fd;
27
28#if defined (HAVE_TAGCACHE) && defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) 30#if defined (HAVE_TAGCACHE) && defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
29 if (try_tagcache && rb->tagcache_fill_tags(id3, file)) 31 if (rb->tagcache_fill_tags(id3, file))
30 { 32 {
31 rb->strlcpy(id3->path, file, sizeof(id3->path)); 33 rb->strlcpy(id3->path, file, sizeof(id3->path));
32 return true; 34 return true;
33 } 35 }
34#else
35 (void) try_tagcache;
36#endif 36#endif
37 37
38 fd = rb->open(file, O_RDONLY); 38 return !rb->mp3info(id3, file);
39 if (fd >= 0)
40 {
41 if (rb->get_metadata(id3, fd, file))
42 ret = true;
43 rb->close(fd);
44 }
45 return ret;
46} 39}
diff --git a/apps/plugins/lib/id3.h b/apps/plugins/lib/id3.h
index 292556d0c4..6ae1688798 100644
--- a/apps/plugins/lib/id3.h
+++ b/apps/plugins/lib/id3.h
@@ -21,6 +21,6 @@
21#ifndef ID3_H 21#ifndef ID3_H
22#define ID3_H 22#define ID3_H
23 23
24bool retrieve_id3(struct mp3entry *id3, const char* file, bool try_tagcache); 24bool retrieve_id3(struct mp3entry *id3, const char* file);
25 25
26#endif /* ID3_H */ \ No newline at end of file 26#endif /* ID3_H */
diff --git a/apps/plugins/lib/mul_id3.h b/apps/plugins/lib/mul_id3.h
index 71da10e87e..40d7fa7822 100644
--- a/apps/plugins/lib/mul_id3.h
+++ b/apps/plugins/lib/mul_id3.h
@@ -25,4 +25,4 @@ void init_mul_id3(void);
25void collect_id3(struct mp3entry *id3, bool is_first_track); 25void collect_id3(struct mp3entry *id3, bool is_first_track);
26void write_id3_mul_tracks(struct mp3entry *id3); 26void write_id3_mul_tracks(struct mp3entry *id3);
27 27
28#endif /* MUL_ID3_H */ \ No newline at end of file 28#endif /* MUL_ID3_H */