summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2009-07-04 08:28:32 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2009-07-04 08:28:32 +0200
commit4e77530f314f4d897d9074a85bcf7e15c33ac14b (patch)
tree9b8a33e1041cd2d4cff6960f01fb4a396bacf0f8
parent5838d02077f4b50e6078f19fc1be599a9b0d411b (diff)
if playlist is filtered, add to playlist only filtered items
-rw-r--r--src/ncmpcpp.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
index 4f0a4351..ffa93434 100644
--- a/src/ncmpcpp.cpp
+++ b/src/ncmpcpp.cpp
@@ -650,8 +650,7 @@ int main(int argc, char *argv[])
LockStatusbar();
Statusbar() << "Save playlist as: ";
string playlist_name = wFooter->GetString();
- string real_playlist_name = playlist_name;
- locale_to_utf(real_playlist_name);
+ string real_playlist_name = locale_to_utf_cpy(playlist_name);
UnlockStatusbar();
if (playlist_name.find("/") != string::npos)
{
@@ -660,7 +659,16 @@ int main(int argc, char *argv[])
}
if (!playlist_name.empty())
{
- if (Mpd.SavePlaylist(real_playlist_name))
+ if (myPlaylist->Main()->isFiltered())
+ {
+ Mpd.StartCommandsList();
+ for (size_t i = 0; i < myPlaylist->Main()->Size(); ++i)
+ Mpd.AddToPlaylist(real_playlist_name, (*myPlaylist->Main())[i]);
+ Mpd.CommitCommandsList();
+ if (Mpd.GetErrorMessage().empty())
+ ShowMessage("Filtered items added to playlist \"%s\"", playlist_name.c_str());
+ }
+ else if (Mpd.SavePlaylist(real_playlist_name))
{
ShowMessage("Playlist saved as: %s", playlist_name.c_str());
if (myPlaylistEditor->Main()) // check if initialized