Library indexing
I can now add artist / album / title of each song to an index in the library.
This commit is contained in:
parent
6ac2abda27
commit
b8eb1817b7
|
@ -33,7 +33,7 @@ class Index(dict):
|
|||
def __init__(self):
|
||||
dict.__init__(self)
|
||||
|
||||
def insert(self, tags, id):
|
||||
def insert(self, id, tags):
|
||||
get = self.get
|
||||
for tag in tags:
|
||||
for word in format(tag):
|
||||
|
|
|
@ -51,23 +51,23 @@ def reset():
|
|||
def load():
|
||||
global fs_tree
|
||||
global tag_tree
|
||||
#global index
|
||||
global index
|
||||
global tracks
|
||||
global sources
|
||||
#global size
|
||||
#global songs
|
||||
objects = libsaria.data.load("library", ".lib")
|
||||
if objects == None or len(objects) != 4:
|
||||
if objects == None or len(objects) != 5:
|
||||
#if objects == None or len(objects) != 6:
|
||||
reset()
|
||||
return
|
||||
(sources, tracks, fs_tree, tag_tree) = objects
|
||||
(sources, tracks, fs_tree, tag_tree, index) = objects
|
||||
#(fs_tree, tag_tree, index, tracks, next_id, size) = objects
|
||||
libsaria.event.start("POSTLIBLOAD")
|
||||
|
||||
def save():
|
||||
global sources
|
||||
libsaria.data.save( (sources, tracks, fs_tree, tag_tree),
|
||||
libsaria.data.save( (sources, tracks, fs_tree, tag_tree, index),
|
||||
"library", ".lib")
|
||||
|
||||
def walk():
|
||||
|
@ -165,6 +165,7 @@ def insert_track(path, ref):
|
|||
global ttable
|
||||
global fs_tree
|
||||
global tag_tree
|
||||
global index
|
||||
tags = ref.tag()
|
||||
audio = ref.audioProperties()
|
||||
ino = os.stat(path).st_ino
|
||||
|
@ -179,6 +180,7 @@ def insert_track(path, ref):
|
|||
[artist, album, title, ino]
|
||||
)
|
||||
|
||||
index.insert(ino, (artist, album, title))
|
||||
track.fs = fs
|
||||
track.tags = tag
|
||||
tracks[ino] = track
|
||||
|
|
Loading…
Reference in New Issue