Honor banned tracks when enabling a library path
Before this I was always putting them into the Library playlist. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
4afce6300c
commit
3d722f364d
|
@ -6,6 +6,7 @@
|
|||
#include <libsaria/prefs.h>
|
||||
#include <libsaria/deck.h>
|
||||
#include <libsaria/idle.h>
|
||||
#include <libsaria/ban.h>
|
||||
#include <libsaria/fs.h>
|
||||
#include "library.h"
|
||||
|
||||
|
@ -46,6 +47,19 @@ libsaria::library::Path *push_path(libsaria::library::Path &path)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
static void list_path(libsaria::library::Path *path,
|
||||
list<libsaria::Track *> &tracks,
|
||||
list<libsaria::Track *> &banned)
|
||||
{
|
||||
list<libsaria::Track>::iterator it;
|
||||
for (it = path->tracks.begin(); it != path->tracks.end(); it++) {
|
||||
if (!it->get_banned())
|
||||
tracks.push_back(&(*it));
|
||||
else
|
||||
banned.push_back(&(*it));
|
||||
}
|
||||
}
|
||||
|
||||
void pop_path(libsaria::library::Path *path)
|
||||
{
|
||||
list<libsaria::library::Path>::iterator it;
|
||||
|
@ -110,28 +124,30 @@ namespace libsaria
|
|||
void library::hide_path(Path *path)
|
||||
{
|
||||
list<Track *> tracks;
|
||||
list<Track>::iterator it;
|
||||
for (it = path->tracks.begin(); it != path->tracks.end(); it++)
|
||||
tracks.push_back(&(*it));
|
||||
list<Track *> banned;
|
||||
|
||||
list_path(path, tracks, banned);
|
||||
lib_playlist.remove_tracks(tracks);
|
||||
ban::get_banned_plist()->remove_tracks(banned);
|
||||
|
||||
path->visible = false;
|
||||
path->data_state = DIRTY;
|
||||
save_path(path);
|
||||
lib_playlist.remove_tracks(tracks);
|
||||
notify_path_updated(path);
|
||||
}
|
||||
|
||||
void library::show_path(Path *path)
|
||||
{
|
||||
list<Track *> tracks;
|
||||
list<Track>::iterator it;
|
||||
for (it = path->tracks.begin(); it != path->tracks.end(); it++)
|
||||
tracks.push_back(&(*it));
|
||||
list<Track *> banned;
|
||||
|
||||
list_path(path, tracks, banned);
|
||||
lib_playlist.add_tracks(tracks);
|
||||
ban::get_banned_plist()->add_tracks(banned);
|
||||
|
||||
path->visible = true;
|
||||
path->data_state = DIRTY;
|
||||
save_path(path);
|
||||
lib_playlist.add_tracks(tracks);
|
||||
notify_path_updated(path);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace libsaria
|
|||
unsigned int Playlist::remove_track_it(list<Track *>::iterator &it,
|
||||
unsigned int rm_index)
|
||||
{
|
||||
bool removing_cur = (it == cur);
|
||||
length -= (*it)->get_length();
|
||||
index.remove_track(*it);
|
||||
(*it)->rm_playlist(this);
|
||||
|
@ -35,6 +36,8 @@ namespace libsaria
|
|||
it--;
|
||||
} else
|
||||
it = plist.begin();
|
||||
if (removing_cur)
|
||||
cur = it;
|
||||
data_state = DIRTY;
|
||||
return rm_index;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue