fix adding selected items to playlist
This commit is contained in:
@@ -486,7 +486,7 @@ int Connection::AddSong(const string &path)
|
|||||||
|
|
||||||
int Connection::AddSong(const Song &s)
|
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)
|
void Connection::QueueAddSong(const string &path)
|
||||||
@@ -503,7 +503,7 @@ void Connection::QueueAddSong(const string &path)
|
|||||||
void Connection::QueueAddSong(const Song &s)
|
void Connection::QueueAddSong(const Song &s)
|
||||||
{
|
{
|
||||||
if (!s.Empty())
|
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)
|
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)
|
void Connection::QueueAddToPlaylist(const string &playlist, const Song &s)
|
||||||
{
|
{
|
||||||
if (!s.Empty())
|
if (!s.Empty())
|
||||||
QueueAddToPlaylist(playlist, s.GetFile());
|
QueueAddToPlaylist(playlist, s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::QueueDeleteSong(int id)
|
void Connection::QueueDeleteSong(int id)
|
||||||
|
|||||||
@@ -2906,7 +2906,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
case itDirectory:
|
case itDirectory:
|
||||||
{
|
{
|
||||||
Mpd->GetDirectoryRecursive(item.name, result);
|
Mpd->GetDirectoryRecursive(locale_to_utf_cpy(item.name), result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case itSong:
|
case itSong:
|
||||||
@@ -2917,7 +2917,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
case itPlaylist:
|
case itPlaylist:
|
||||||
{
|
{
|
||||||
Mpd->GetPlaylistContent(item.name, result);
|
Mpd->GetPlaylistContent(locale_to_utf_cpy(item.name), result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2925,7 +2925,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
case csSearcher:
|
case csSearcher:
|
||||||
{
|
{
|
||||||
Song *s = mSearcher->at(*it).second;
|
Song *s = new Song(*mSearcher->at(*it).second);
|
||||||
result.push_back(s);
|
result.push_back(s);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2952,15 +2952,22 @@ int main(int argc, char *argv[])
|
|||||||
mDialog->SetTimeout(ncmpcpp_window_timeout);
|
mDialog->SetTimeout(ncmpcpp_window_timeout);
|
||||||
mDialog->SetItemDisplayer(GenericDisplayer);
|
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("Current MPD playlist");
|
||||||
mDialog->AddOption("Create new playlist (m3u file)");
|
mDialog->AddOption("Create new playlist (m3u file)", 0, playlists_not_active);
|
||||||
mDialog->AddSeparator();
|
mDialog->AddSeparator();
|
||||||
TagList playlists;
|
TagList playlists;
|
||||||
Mpd->GetPlaylists(playlists);
|
Mpd->GetPlaylists(playlists);
|
||||||
for (TagList::iterator it = playlists.begin(); it != playlists.end(); it++)
|
for (TagList::iterator it = playlists.begin(); it != playlists.end(); it++)
|
||||||
{
|
{
|
||||||
utf_to_locale(*it);
|
utf_to_locale(*it);
|
||||||
mDialog->AddOption("'" + *it + "' playlist");
|
mDialog->AddOption("'" + *it + "' playlist", 0, playlists_not_active);
|
||||||
}
|
}
|
||||||
mDialog->AddSeparator();
|
mDialog->AddSeparator();
|
||||||
mDialog->AddOption("Cancel");
|
mDialog->AddOption("Cancel");
|
||||||
@@ -2989,6 +2996,7 @@ int main(int argc, char *argv[])
|
|||||||
mDialog->Scroll(wEnd);
|
mDialog->Scroll(wEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current_screen = prev_screen;
|
||||||
size_t id = mDialog->Choice();
|
size_t id = mDialog->Choice();
|
||||||
|
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
@@ -3048,7 +3056,6 @@ int main(int argc, char *argv[])
|
|||||||
GetDirectory("/");
|
GetDirectory("/");
|
||||||
mPlaylistList->Clear(0); // make playlist editor update itself
|
mPlaylistList->Clear(0); // make playlist editor update itself
|
||||||
}
|
}
|
||||||
current_screen = prev_screen;
|
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
delete mDialog;
|
delete mDialog;
|
||||||
FreeSongList(result);
|
FreeSongList(result);
|
||||||
|
|||||||
Reference in New Issue
Block a user