libsaria: Find list of files to add to library

I put them all into a dictionary for use later.
This commit is contained in:
Bryan Schumaker 2011-05-21 07:26:30 -04:00
parent 8debb4a508
commit a1722eafb3
1 changed files with 23 additions and 2 deletions

View File

@ -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)