added option to import a directory

This commit is contained in:
Remy
2011-06-03 05:53:03 -07:00
parent 96ca7cfecd
commit bd3a173149
2 changed files with 15 additions and 10 deletions
+11 -7
View File
@@ -13,13 +13,17 @@ database = os.path.join(FULL_PATH, 'headphones.db')
def itunesImport(pathtoxml):
pl = XMLLibraryParser(pathtoxml)
l = Library(pl.dictionary)
lst = []
for song in l.songs:
lst.append(song.artist)
rawlist = {}.fromkeys(lst).keys()
artistlist = [f for f in rawlist if f != None]
if os.path.splitext(pathtoxml)[1] == '.xml':
pl = XMLLibraryParser(pathtoxml)
l = Library(pl.dictionary)
lst = []
for song in l.songs:
lst.append(song.artist)
rawlist = {}.fromkeys(lst).keys()
artistlist = [f for f in rawlist if f != None]
else:
rawlist = os.listdir(pathtoxml)
artistlist = [f for f in rawlist if f != '.DS_STORE']
for name in artistlist:
time.sleep(1)
artistResults = ws.Query().getArtists(ws.ArtistFilter(string.replace(name, '&', '%38'), limit=1))