int mpd_run_add_id_to(struct mpd_connection *connection, const char *uri, unsigned to) { int id; if (!mpd_run_check(connection) || !mpd_send_add_id_to(connection, uri, to)) return -1; id = mpd_recv_song_id(connection); if (!mpd_response_finish(connection)) id = -1; return id; }
int Connection::AddSong(const std::string &path, int pos) { prechecks(); int id; if (pos < 0) mpd_send_add_id(m_connection.get(), path.c_str()); else mpd_send_add_id_to(m_connection.get(), path.c_str(), pos); if (!m_command_list_active) { id = mpd_recv_song_id(m_connection.get()); mpd_response_finish(m_connection.get()); checkErrors(); } else id = 0; return id; }