libsaria: Remove paths from library

If the user no longer wishes to track a certain path, they can remove it
from the library.  Note: it is unsafe to remove a path from the library
while that path is being scanned.  This could potentially lead to a
segmentation fault.
This commit is contained in:
Bryan Schumaker 2011-10-20 20:18:35 -04:00
parent 2c12cb80aa
commit 245157c6b4
2 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@ namespace libsaria
void refresh();
void add_path(string);
void remove_path(string);
void play_id(ino_t);
void for_each(void (*)(Track &));
void for_each_path(void (*)(struct PathInfo &));

View File

@ -129,4 +129,15 @@ namespace libsaria
update_path(dir);
}
void library::remove_path(string dir)
{
map<string, LibraryPath>::iterator it;
it = get_library_map()->find(dir);
if (it != get_library_map()->end()) {
get_library_map()->erase(it);
save();
refresh();
}
}
}; /* Namespace: libsaria */