diff options
author | Max Kellermann <max@duempel.org> | 2010-07-21 08:58:15 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-07-21 09:26:50 +0200 |
commit | e598922133d11cc59994f35f62fe0f454ceb4173 (patch) | |
tree | d2bcfedb8870ceb4d18a5199ce2b06593c8926a0 /src/directory_save.c | |
parent | e21ad70f3fa183447436c5434585288d58559a46 (diff) | |
download | mpd-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_save.c')
-rw-r--r-- | src/directory_save.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/directory_save.c b/src/directory_save.c index 18472db98..af134d9a2 100644 --- a/src/directory_save.c +++ b/src/directory_save.c @@ -23,6 +23,7 @@ #include "song.h" #include "text_file.h" #include "song_save.h" +#include "playlist_database.h" #include <assert.h> #include <string.h> @@ -69,6 +70,8 @@ directory_save(FILE *fp, struct directory *directory) songvec_save(fp, &directory->songs); + playlist_vector_save(fp, &directory->playlists); + if (!directory_is_root(directory)) fprintf(fp, DIRECTORY_END "%s\n", directory_get_path(directory)); @@ -168,6 +171,12 @@ directory_load(FILE *fp, struct directory *directory, return false; songvec_add(&directory->songs, song); + } else if (g_str_has_prefix(line, PLAYLIST_META_BEGIN)) { + const char *name = line + sizeof(PLAYLIST_META_BEGIN) - 1; + + if (!playlist_metadata_load(fp, &directory->playlists, + name, buffer, error)) + return false; } else { g_set_error(error, directory_quark(), 0, "Malformed line: %s", line); |