From 2ab7ace6089fff69288b1d33704cade6dce0c7c9 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Wed, 17 Nov 2010 23:31:02 -0500 Subject: [PATCH] library tag accessor functions I have created functions to make it easy to get at titles and song ids from known tags. --- libsaria/sources/library.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libsaria/sources/library.py b/libsaria/sources/library.py index ccc364e3..f7c63096 100644 --- a/libsaria/sources/library.py +++ b/libsaria/sources/library.py @@ -88,6 +88,22 @@ def albums(artist): res.append( (art[key].value, key) ) return res +def titles(artist, album): + art = tag_tree[artist] + alb = art[album] + keys = alb.keys() + keys.sort() + res = [] + for key in keys: + res.append( (alb[key].value, key) ) + return res + +def song_id(artist, album, title): + art = tag_tree[artist] + alb = art[album] + title = alb[title] + return title.keys()[0] + def get_attrs(id, *attrs): res = [] rec = tracks.get(id, None)