From e6ba5c31392ec7656026a5dd845f2a2b7454cddc Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sat, 18 Jun 2011 11:22:24 -0400 Subject: [PATCH] libsaria: Remove path from library I need to delete it, save the library, and rebulid the tree and index. --- libsaria/sources/library/__init__.py | 13 ++++++++++--- libsaria/sources/library/library.py | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libsaria/sources/library/__init__.py b/libsaria/sources/library/__init__.py index 2c928426..0a81ab14 100644 --- a/libsaria/sources/library/__init__.py +++ b/libsaria/sources/library/__init__.py @@ -20,12 +20,19 @@ library.load() tree.make_tree() index.reindex() -def update_lib(): - update.update() +def refresh(): tree.make_tree() index.reindex() libsaria.callbacks.library_updated() +def update_lib(): + update.update() + refresh() + +def rm_path(path): + library.rm_path(path) + refresh() + def reset(): library.reset() - tree.make_tree() + refresh() diff --git a/libsaria/sources/library/library.py b/libsaria/sources/library/library.py index 01631300..0b1a5009 100644 --- a/libsaria/sources/library/library.py +++ b/libsaria/sources/library/library.py @@ -39,6 +39,12 @@ def add_path(path): lib_dict.setdefault(path, dict()) unlock_library() +def rm_path(path): + lock_library() + del lib_dict[path] + save() + unlock_library() + def list_paths(): res = [] lock_library()