pass to MPD::Connection::AddSong() another parameter - position to add
This commit is contained in:
@@ -409,14 +409,17 @@ void Connection::SetCrossfade(unsigned crossfade) const
|
|||||||
(isCommandsListEnabled ? mpd_send_crossfade : mpd_run_crossfade)(itsConnection, crossfade);
|
(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)
|
if (!itsConnection)
|
||||||
return -1;
|
return -1;
|
||||||
int id = -1;
|
int id = -1;
|
||||||
if (GetPlaylistLength() < itsMaxPlaylistLength)
|
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)
|
if (!isCommandsListEnabled)
|
||||||
{
|
{
|
||||||
id = mpd_recv_song_id(itsConnection);
|
id = mpd_recv_song_id(itsConnection);
|
||||||
@@ -431,9 +434,9 @@ int Connection::AddSong(const std::string &path)
|
|||||||
return id;
|
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
|
void Connection::Add(const std::string &path) const
|
||||||
|
|||||||
@@ -152,8 +152,8 @@ namespace MPD
|
|||||||
void SetCrossfade(unsigned) const;
|
void SetCrossfade(unsigned) const;
|
||||||
void SetVolume(unsigned);
|
void SetVolume(unsigned);
|
||||||
|
|
||||||
int AddSong(const std::string &); // returns id of added song
|
int AddSong(const std::string &, int = -1); // returns id of added song
|
||||||
int AddSong(const Song &); // returns id of added song
|
int AddSong(const Song &, int = -1); // returns id of added song
|
||||||
bool AddRandomSongs(size_t);
|
bool AddRandomSongs(size_t);
|
||||||
void Add(const std::string &path) const;
|
void Add(const std::string &path) const;
|
||||||
void Delete(unsigned) const;
|
void Delete(unsigned) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user