libsaria: Find list of files to add to library
I put them all into a dictionary for use later.
This commit is contained in:
parent
8debb4a508
commit
a1722eafb3
|
@ -1,7 +1,28 @@
|
|||
# Bryan Schumaker (5 / 21 / 2011)
|
||||
|
||||
import os
|
||||
|
||||
import library
|
||||
|
||||
stat = os.stat
|
||||
walk = os.walk
|
||||
join = os.path.join
|
||||
|
||||
def song_id(path):
|
||||
return stat(path).st_ino
|
||||
|
||||
def scan_path(path):
|
||||
print "Scanning path:", path
|
||||
file_map = dict()
|
||||
for root, dir, files in walk(path):
|
||||
for file in files:
|
||||
file = join(root, file)
|
||||
file_map[song_id(file)] = file
|
||||
return file_map
|
||||
|
||||
def update_path(path, origdict):
|
||||
file_map = scan_path(path)
|
||||
|
||||
def update():
|
||||
for path in library.lib_dict.keys():
|
||||
print path
|
||||
for path, lib in library.lib_dict.iteritems():
|
||||
update_path(path, lib)
|
||||
|
|
Loading…
Reference in New Issue