diff --git a/libsaria/collection/collection.py b/libsaria/collection/collection.py index b79ea1d6..9d3f66cc 100644 --- a/libsaria/collection/collection.py +++ b/libsaria/collection/collection.py @@ -2,6 +2,9 @@ import libsaria +import datetime +timedelta = datetime.timedelta + tag = None audio = None ins_table = None @@ -9,8 +12,9 @@ ins_index = None ins_tree = None class TrackRecord: - def __init__(self, year, length): + def __init__(self, year, length, lenstr): self.length = length + self.lenstr = lenstr self.count = 0 self.year = year #self.like = None @@ -58,7 +62,7 @@ class Collection: def walk_tags(self): for tag in self.tag_tree.walk_forwards(): rec = self.records[tag[3]] - yield tag + [rec.year] + [rec.length] + yield tag + [rec.year] + [rec.lenstr] def find_id(self, file): stripped = file.strip(libsaria.path.sep) @@ -94,7 +98,8 @@ class Collection: if title == "": title = u"Unknown Title" - record = TrackRecord(t.year, audio.length) + len = audio.length + record = TrackRecord(t.year, len, "%s" % timedelta(seconds=len)) id = self.next_record self.next_record += 1 diff --git a/libsaria/collection/index.py b/libsaria/collection/index.py index cfc3c7a1..ac190892 100644 --- a/libsaria/collection/index.py +++ b/libsaria/collection/index.py @@ -47,7 +47,6 @@ class Index(dict): text = unicode(text) terms = format(text) results = dict() - #results = set() search = re.search get = self.get diff --git a/tests/dl_tree.py b/tests/dl_tree.py index c9e865f4..57448fe6 100644 --- a/tests/dl_tree.py +++ b/tests/dl_tree.py @@ -4,7 +4,7 @@ from libsaria import collection -collection.new_source("~/Desktop") -#collection.new_source("~/Music/") +#collection.new_source("~/Desktop") +collection.new_source("~/Music/") #collection.new_source("/media/Music") print collection.library.size