diff --git a/src/mpdpp.cpp b/src/mpdpp.cpp index f8fc3cb0..96f0886e 100644 --- a/src/mpdpp.cpp +++ b/src/mpdpp.cpp @@ -486,7 +486,7 @@ int Connection::AddSong(const string &path) int Connection::AddSong(const Song &s) { - return !s.Empty() ? (s.IsFromDB() ? (AddSong(s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile())) : AddSong("file://" + (s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile()))) : -1; + return !s.Empty() ? (AddSong((!s.IsFromDB() ? "file://" : "") + (s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile()))) : -1; } void Connection::QueueAddSong(const string &path) @@ -503,7 +503,7 @@ void Connection::QueueAddSong(const string &path) void Connection::QueueAddSong(const Song &s) { if (!s.Empty()) - QueueAddSong(s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile()); + QueueAddSong((!s.IsFromDB() ? "file://" : "") + (s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile())); } void Connection::QueueAddToPlaylist(const string &playlist, const string &path) @@ -521,7 +521,7 @@ void Connection::QueueAddToPlaylist(const string &playlist, const string &path) void Connection::QueueAddToPlaylist(const string &playlist, const Song &s) { if (!s.Empty()) - QueueAddToPlaylist(playlist, s.GetFile()); + QueueAddToPlaylist(playlist, s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile()); } void Connection::QueueDeleteSong(int id) diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 86910840..2a09e673 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -2906,7 +2906,7 @@ int main(int argc, char *argv[]) { case itDirectory: { - Mpd->GetDirectoryRecursive(item.name, result); + Mpd->GetDirectoryRecursive(locale_to_utf_cpy(item.name), result); break; } case itSong: @@ -2917,7 +2917,7 @@ int main(int argc, char *argv[]) } case itPlaylist: { - Mpd->GetPlaylistContent(item.name, result); + Mpd->GetPlaylistContent(locale_to_utf_cpy(item.name), result); break; } } @@ -2925,7 +2925,7 @@ int main(int argc, char *argv[]) } case csSearcher: { - Song *s = mSearcher->at(*it).second; + Song *s = new Song(*mSearcher->at(*it).second); result.push_back(s); break; } @@ -2952,15 +2952,22 @@ int main(int argc, char *argv[]) mDialog->SetTimeout(ncmpcpp_window_timeout); mDialog->SetItemDisplayer(GenericDisplayer); + bool playlists_not_active = current_screen == csBrowser && Config.local_browser; + + if (playlists_not_active) + { + ShowMessage("Local items cannot be added to m3u playlist!"); + } + mDialog->AddOption("Current MPD playlist"); - mDialog->AddOption("Create new playlist (m3u file)"); + mDialog->AddOption("Create new playlist (m3u file)", 0, playlists_not_active); mDialog->AddSeparator(); TagList playlists; Mpd->GetPlaylists(playlists); for (TagList::iterator it = playlists.begin(); it != playlists.end(); it++) { utf_to_locale(*it); - mDialog->AddOption("'" + *it + "' playlist"); + mDialog->AddOption("'" + *it + "' playlist", 0, playlists_not_active); } mDialog->AddSeparator(); mDialog->AddOption("Cancel"); @@ -2989,6 +2996,7 @@ int main(int argc, char *argv[]) mDialog->Scroll(wEnd); } + current_screen = prev_screen; size_t id = mDialog->Choice(); // redraw_screen = 1; @@ -3048,7 +3056,6 @@ int main(int argc, char *argv[]) GetDirectory("/"); mPlaylistList->Clear(0); // make playlist editor update itself } - current_screen = prev_screen; timer = time(NULL); delete mDialog; FreeSongList(result);