aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory_print.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-07-21 08:58:15 +0200
committerMax Kellermann <max@duempel.org>2010-07-21 09:26:50 +0200
commite598922133d11cc59994f35f62fe0f454ceb4173 (patch)
treed2bcfedb8870ceb4d18a5199ce2b06593c8926a0 /src/directory_print.c
parente21ad70f3fa183447436c5434585288d58559a46 (diff)
downloadmpd-e598922133d11cc59994f35f62fe0f454ceb4173.tar.gz
mpd-e598922133d11cc59994f35f62fe0f454ceb4173.tar.xz
mpd-e598922133d11cc59994f35f62fe0f454ceb4173.zip
update: store playlist files in database
Don't open the music directory for each "lsinfo" call. Get the list of playlist files from the memory database.
Diffstat (limited to 'src/directory_print.c')
-rw-r--r--src/directory_print.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/directory_print.c b/src/directory_print.c
index ef4738e45..74ff26cb3 100644
--- a/src/directory_print.c
+++ b/src/directory_print.c
@@ -23,7 +23,6 @@
#include "client.h"
#include "song_print.h"
#include "mapper.h"
-#include "playlist_list.h"
#include "decoder_list.h"
#include "path.h"
#include "uri.h"
@@ -61,36 +60,9 @@ static void
directory_print_playlists(struct client *client,
const struct directory *directory)
{
- char *path_fs = map_directory_fs(directory);
- if (path_fs == NULL)
- return;
-
- DIR *dir = opendir(path_fs);
- g_free(path_fs);
- if (dir == NULL)
- return;
-
- struct dirent *ent;
- while ((ent = readdir(dir))) {
- char *name_utf8 = fs_charset_to_utf8(ent->d_name);
- if (name_utf8 == NULL)
- continue;
-
- const char *suffix = uri_get_suffix(name_utf8);
- if (suffix != NULL &&
- /* ignore files which are handled by a decoder for
- now, too expensive to probe them all, and most
- of them probably don't contain a playlist
- (e.g. FLAC files without embedded cue sheet) */
- decoder_plugin_from_suffix(suffix, NULL) == NULL &&
- playlist_suffix_supported(suffix))
- print_playlist_in_directory(client, directory,
- name_utf8);
-
- g_free(name_utf8);
- }
-
- closedir(dir);
+ for (const struct playlist_metadata *pm = directory->playlists.head;
+ pm != NULL; pm = pm->next)
+ print_playlist_in_directory(client, directory, pm->name);
}
void