support adding last.fm streams to playlist
This commit is contained in:
@@ -1027,6 +1027,15 @@ bool MPD::Connection::DeletePlaylist(const std::string &name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MPD::Connection::LoadPlaylist(const std::string &name)
|
||||||
|
{
|
||||||
|
if (!itsConnection)
|
||||||
|
return false;
|
||||||
|
assert(!isCommandsListEnabled);
|
||||||
|
GoBusy();
|
||||||
|
return mpd_run_load(itsConnection, name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
int MPD::Connection::SavePlaylist(const std::string &name)
|
int MPD::Connection::SavePlaylist(const std::string &name)
|
||||||
{
|
{
|
||||||
if (!itsConnection)
|
if (!itsConnection)
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ namespace MPD
|
|||||||
bool CommitCommandsList();
|
bool CommitCommandsList();
|
||||||
|
|
||||||
bool DeletePlaylist(const std::string &);
|
bool DeletePlaylist(const std::string &);
|
||||||
|
bool LoadPlaylist(const std::string &name);
|
||||||
int SavePlaylist(const std::string &);
|
int SavePlaylist(const std::string &);
|
||||||
void ClearPlaylist(const std::string &);
|
void ClearPlaylist(const std::string &);
|
||||||
void AddToPlaylist(const std::string &, const Song &);
|
void AddToPlaylist(const std::string &, const Song &);
|
||||||
|
|||||||
@@ -1235,13 +1235,21 @@ int main(int argc, char *argv[])
|
|||||||
UnlockStatusbar();
|
UnlockStatusbar();
|
||||||
if (!path.empty())
|
if (!path.empty())
|
||||||
{
|
{
|
||||||
|
Statusbar() << "Adding...";
|
||||||
|
wFooter->Refresh();
|
||||||
if (myScreen == myPlaylistEditor)
|
if (myScreen == myPlaylistEditor)
|
||||||
{
|
{
|
||||||
Mpd.AddToPlaylist(myPlaylistEditor->Playlists->Current(), path);
|
Mpd.AddToPlaylist(myPlaylistEditor->Playlists->Current(), path);
|
||||||
myPlaylistEditor->Content->Clear(); // make it refetch content of playlist
|
myPlaylistEditor->Content->Clear(); // make it refetch content of playlist
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static const char lastfm_url[] = "lastfm://";
|
||||||
|
if (path.compare(0, static_strlen(lastfm_url), lastfm_url) == 0)
|
||||||
|
Mpd.LoadPlaylist(path);
|
||||||
else
|
else
|
||||||
Mpd.Add(path);
|
Mpd.Add(path);
|
||||||
|
}
|
||||||
UpdateStatusImmediately = 1;
|
UpdateStatusImmediately = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user