From fdbaf7df597b404be04cecbdc83dbc0551a5b996 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 5 Jul 2024 17:13:10 -0400 Subject: [Feature] playlist_viewer id3 title display Not sure this is a great idea from disk and battery standpoint but there is no reason you can't.. using the name buffer to fill title data prevent hitting the disk for each screen scroll add get_metadata_ex to allow flags METADATA_EXCLUDE_ID3_PATH prevent copying the filename to the ID3 struct METADATA_CLOSE_FD_ON_EXIT instead of seeking to the beginning the file is closed before get_metadata returns add logic to allow a invalid fd to signal that get_metadata should open and close the file within its call bugfix per Chris_s don't use the tagcache for the trackinfo Change-Id: Ic7a595b39a8d7a57f975312bc9c8bb4111f22a88 --- apps/tagcache.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'apps/tagcache.c') diff --git a/apps/tagcache.c b/apps/tagcache.c index 5413e2def0..1412647368 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -2193,7 +2193,6 @@ static void NO_INLINE add_tagcache(char *path, unsigned long mtime) struct mp3entry id3; struct temp_file_entry entry; bool ret; - int fd; int idx_id = -1; char tracknumfix[3]; int offset = 0; @@ -2266,21 +2265,16 @@ static void NO_INLINE add_tagcache(char *path, unsigned long mtime) } } - fd = open(path, O_RDONLY); - if (fd < 0) - { - logf("open fail: %s", path); - return ; - } - - memset(&id3, 0, sizeof(struct mp3entry)); + /*memset(&id3, 0, sizeof(struct mp3entry)); -- get_metadata does this for us */ memset(&entry, 0, sizeof(struct temp_file_entry)); memset(&tracknumfix, 0, sizeof(tracknumfix)); - ret = get_metadata(&id3, fd, path); - close(fd); + ret = get_metadata_ex(&id3, -1, path, METADATA_EXCLUDE_ID3_PATH); if (!ret) + { + logf("get_metadata fail: %s", path); return ; + } logf("-> %s", path); -- cgit v1.2.3