pass to MPD::Connection::AddSong() another parameter - position to add

master
Andrzej Rybczak 17 years ago
parent 2cbd015ce4
commit b979189111
  1. 11
      src/mpdpp.cpp
  2. 4
      src/mpdpp.h

@ -409,14 +409,17 @@ void Connection::SetCrossfade(unsigned crossfade) const
(isCommandsListEnabled ? mpd_send_crossfade : mpd_run_crossfade)(itsConnection, crossfade);
}
int Connection::AddSong(const std::string &path)
int Connection::AddSong(const std::string &path, int pos)
{
if (!itsConnection)
return -1;
int id = -1;
if (GetPlaylistLength() < itsMaxPlaylistLength)
{
mpd_send_add_id(itsConnection, path.c_str());
if (pos < 0)
mpd_send_add_id(itsConnection, path.c_str());
else
mpd_send_add_id_to(itsConnection, path.c_str(), pos);
if (!isCommandsListEnabled)
{
id = mpd_recv_song_id(itsConnection);
@ -431,9 +434,9 @@ int Connection::AddSong(const std::string &path)
return id;
}
int Connection::AddSong(const Song &s)
int Connection::AddSong(const Song &s, int pos)
{
return !s.Empty() ? (AddSong((!s.isFromDB() ? "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()), pos)) : -1;
}
void Connection::Add(const std::string &path) const

@ -152,8 +152,8 @@ namespace MPD
void SetCrossfade(unsigned) const;
void SetVolume(unsigned);
int AddSong(const std::string &); // returns id of added song
int AddSong(const Song &); // returns id of added song
int AddSong(const std::string &, int = -1); // returns id of added song
int AddSong(const Song &, int = -1); // returns id of added song
bool AddRandomSongs(size_t);
void Add(const std::string &path) const;
void Delete(unsigned) const;

Loading…
Cancel
Save