From 0af81adbcd6f1f4b5343b8f75a6c44f1a13edd2a Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Thu, 11 Nov 2010 22:46:17 -0500 Subject: [PATCH] Easy file_to_id() file_to_id() can stat the filepath to find the inode number (aka the song id). This is much easier than doing a bunch of lookups. What I really want to do eventually is get rid of file_to_id()... --- libsaria/collection/library.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/libsaria/collection/library.py b/libsaria/collection/library.py index 113e0321..9526ff80 100644 --- a/libsaria/collection/library.py +++ b/libsaria/collection/library.py @@ -75,14 +75,7 @@ def walk(): yield tag[3] def file_to_id(file): - global fs_tree - stripped = file.strip(libsaria.path.sep) - split = stripped.split(libsaria.path.sep) - - res = fs_tree.walk_path(split) - if res == False: - return None - return res[0] + return os.stat(file).st_ino def get_attrs(id, *attrs): res = []