libsaria: Remove ids from a playlist

Note that this follows the broken implementation used by the queue.  It
will remove all ids with the given values rather than the ones at a
specifix index.  This will be fixed later when I update the UI to make
it Playlist-aware.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-02-18 11:33:58 -05:00 committed by Bryan Schumaker
parent 7aca058254
commit 95aa5802cd
3 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,7 @@ namespace libsaria
void load();
void add_ids(list<sid_t> &);
void rm_ids(list<sid_t> &);
unsigned int size();
/* Iterator functions */

View File

@ -22,6 +22,12 @@ namespace libsaria
plist.insert(plist.end(), ids.begin(), ids.end());
}
void Playlist::rm_ids(list<sid_t> &ids)
{
for (it = ids.begin(); it != ids.end(); it++)
plist.remove(*it);
}
unsigned int Playlist::size()
{
return plist.size();

View File

@ -32,6 +32,7 @@ namespace libsaria
list<sid_t>::iterator it;
for (it = ids.begin(); it != ids.end(); it++)
playqueue.remove(*it);
q_queue.rm_ids(ids);
save_and_refresh();
}