aboutsummaryrefslogtreecommitdiffstats
path: root/src/PlaylistPrint.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/PlaylistPrint.cxx (renamed from src/playlist_print.c)44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/playlist_print.c b/src/PlaylistPrint.cxx
index 59c42f969..40b895f80 100644
--- a/src/playlist_print.c
+++ b/src/PlaylistPrint.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2012 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,19 +18,22 @@
*/
#include "config.h"
-#include "playlist_print.h"
+#include "PlaylistPrint.hxx"
+#include "PlaylistFile.hxx"
+#include "QueuePrint.hxx"
+
+extern "C" {
#include "playlist_list.h"
#include "playlist_plugin.h"
#include "playlist_any.h"
#include "playlist_song.h"
#include "playlist.h"
-#include "queue_print.h"
-#include "stored_playlist.h"
#include "song_print.h"
#include "song.h"
#include "database.h"
#include "client.h"
#include "input_stream.h"
+}
void
playlist_print_uris(struct client *client, const struct playlist *playlist)
@@ -88,16 +91,9 @@ playlist_print_current(struct client *client, const struct playlist *playlist)
void
playlist_print_find(struct client *client, const struct playlist *playlist,
- const struct locate_item_list *list)
-{
- queue_find(client, &playlist->queue, list);
-}
-
-void
-playlist_print_search(struct client *client, const struct playlist *playlist,
- const struct locate_item_list *list)
+ const SongFilter &filter)
{
- queue_search(client, &playlist->queue, list);
+ queue_find(client, &playlist->queue, filter);
}
void
@@ -120,30 +116,31 @@ bool
spl_print(struct client *client, const char *name_utf8, bool detail,
GError **error_r)
{
- GPtrArray *list;
-
- list = spl_load(name_utf8, error_r);
- if (list == NULL)
+ GError *error = NULL;
+ PlaylistFileContents contents = LoadPlaylistFile(name_utf8, &error);
+ if (contents.empty() && error != nullptr) {
+ g_propagate_error(error_r, error);
return false;
+ }
- for (unsigned i = 0; i < list->len; ++i) {
- const char *temp = g_ptr_array_index(list, i);
+ for (const auto &uri_utf8 : contents) {
bool wrote = false;
if (detail) {
- struct song *song = db_get_song(temp);
+ struct song *song = db_get_song(uri_utf8.c_str());
if (song) {
song_print_info(client, song);
+ db_return_song(song);
wrote = true;
}
}
if (!wrote) {
- client_printf(client, SONG_FILE "%s\n", temp);
+ client_printf(client, SONG_FILE "%s\n",
+ uri_utf8.c_str());
}
}
- spl_free(list);
return true;
}
@@ -164,8 +161,7 @@ playlist_provider_print(struct client *client, const char *uri,
else
song_print_uri(client, song);
- if (!song_in_database(song))
- song_free(song);
+ song_free(song);
}
g_free(base_uri);