summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-05-09 21:37:43 +0200
committerMax Kellermann <max@duempel.org>2011-05-09 21:37:43 +0200
commit4b4aa64261154bcb1e521b98629c0640d6b259f7 (patch)
treee901de6264797d243bc8d3352ab2f033ff45977f
parent26735390fffaa467bf90041a5c380802602affb6 (diff)
directory: allow directories with just playlists
Keep those when scanning for empty directories. The check in playlist_vector_is_empty() was missing.
-rw-r--r--NEWS1
-rw-r--r--src/directory.h3
-rw-r--r--src/playlist_vector.h6
3 files changed, 9 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index fed63b5b1..f56e2e872 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ ver 0.16.3 (2011/??/??)
* fix assertion failure in audio format mask parser
* fix NULL pointer dereference in playlist parser
* fix playlist files in base music directory
+* database: allow directories with just playlists
* decoder:
- ffmpeg: support libavcodec 0.7
diff --git a/src/directory.h b/src/directory.h
index 69e2b3638..151cf5423 100644
--- a/src/directory.h
+++ b/src/directory.h
@@ -62,7 +62,8 @@ directory_free(struct directory *directory);
static inline bool
directory_is_empty(const struct directory *directory)
{
- return directory->children.nr == 0 && directory->songs.nr == 0;
+ return directory->children.nr == 0 && directory->songs.nr == 0 &&
+ playlist_vector_is_empty(&directory->playlists);
}
static inline const char *
diff --git a/src/playlist_vector.h b/src/playlist_vector.h
index 566de5f00..62861ae49 100644
--- a/src/playlist_vector.h
+++ b/src/playlist_vector.h
@@ -51,6 +51,12 @@ playlist_vector_init(struct playlist_vector *pv)
void
playlist_vector_deinit(struct playlist_vector *pv);
+static inline bool
+playlist_vector_is_empty(const struct playlist_vector *pv)
+{
+ return pv->head == NULL;
+}
+
struct playlist_metadata *
playlist_vector_find(struct playlist_vector *pv, const char *name);