browser: make playing newly loaded playlist work in all cases

This commit is contained in:
Andrzej Rybczak
2012-07-13 22:18:21 +02:00
parent 5e83aade22
commit f96b4fc776

View File

@@ -139,23 +139,18 @@ void Browser::EnterPressed()
}
case itPlaylist:
{
if (itsBrowsedDir == "/")
{
MPD::SongList list;
Mpd.GetPlaylistContent(locale_to_utf_cpy(item.name), list);
if (myPlaylist->Add(list, 1))
ShowMessage("Loading and playing playlist %s...", item.name.c_str());
FreeSongList(list);
}
std::string name = item.name;
ShowMessage("Loading and playing playlist %s...", name.c_str());
locale_to_utf(name);
if (!Mpd.LoadPlaylist(name))
ShowMessage("Couldn't load playlist.");
else
{
std::string name = item.name;
ShowMessage("Loading playlist %s...", name.c_str());
locale_to_utf(name);
if (!Mpd.LoadPlaylist(name))
ShowMessage("Couldn't load playlist.");
size_t old_size = myPlaylist->Items->Size();
Mpd.UpdateStatus();
if (old_size < myPlaylist->Items->Size())
Mpd.Play(old_size);
}
break;
}
}
}