void Connection::AddToPlaylist(const std::string &path, const std::string &file) { prechecks(); if (m_command_list_active) mpd_send_playlist_add(m_connection.get(), path.c_str(), file.c_str()); else { mpd_run_playlist_add(m_connection.get(), path.c_str(), file.c_str()); checkErrors(); } }
/* * Add a song to a playlist * FIXME: return value */ song_t Control::add(Songlist * list, Song * song) { song_t i = MPD_SONG_NO_ID; Song * nsong; assert(list != NULL); assert(song != NULL); EXIT_IDLE; pms->log(MSG_DEBUG, 0, "Adding song %s to list %s\n", song->file.c_str(), list->filename.c_str()); if (list == _queue) { return mpd_run_add_id(conn->h(), song->file.c_str()); } else if (list != _library) { if (list->filename.size() == 0) { return i; } return mpd_run_playlist_add(conn->h(), list->filename.c_str(), song->file.c_str()); } return i; /* FIXME if (command_mode != 0) return i; if (finish()) { nsong = new Song(song); if (list == _queue) { nsong->id = i; nsong->pos = playlist()->size(); increment(); } else { nsong->id = MPD_SONG_NO_ID; nsong->pos = MPD_SONG_NO_NUM; i = list->size(); } list->add(nsong); } return i; */ }