void Connection::PlaylistMove(const std::string &path, int from, int to) { prechecks(); if (m_command_list_active) mpd_send_playlist_move(m_connection.get(), path.c_str(), from, to); else { mpd_send_playlist_move(m_connection.get(), path.c_str(), from, to); mpd_response_finish(m_connection.get()); checkErrors(); } }
/* * Move selected songs */ unsigned int Control::move(Songlist * list, int offset) { ListItem * item; ListItemSong * song_item; Song * song; int newpos; const char * filename; unsigned int moved = 0; /* FIXME: this function must be moved to the Songlist class */ assert(false); /* Library is read only */ /* FIXME: error message */ if (list == _library || !list) return 0; filename = list->filename.c_str(); if (offset < 0) { //item = list->get_next_selected(); } else { //item = list->get_prev_selected(); } song_item = dynamic_cast<ListItemSong *>(item); song = song_item->song; EXIT_IDLE; //list_start(); while (song != NULL) { assert(song->pos != MPD_SONG_NO_NUM); newpos = song->pos + offset; if (!list->move(song->pos, newpos)) { break; } ++moved; if (list != _queue) { if (!mpd_send_playlist_move(conn->h(), filename, song->pos, newpos)) { break; } } else { if (!mpd_run_move(conn->h(), song->pos, song->pos)) { break; } } if (offset < 0) { //item = list->get_next_selected(); } else { //item = list->get_prev_selected(); } song_item = dynamic_cast<ListItemSong *>(item); song = song_item->song; } return get_error_bool(); }