diff --git a/itunesimport.py b/itunesimport.py index 86bcf7aa..3c17bde2 100644 --- a/itunesimport.py +++ b/itunesimport.py @@ -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)) diff --git a/webServer.py b/webServer.py index aa3e79b7..6b7be1bc 100644 --- a/webServer.py +++ b/webServer.py @@ -306,10 +306,11 @@ class Headphones: page = [templates._header] page.append(templates._logobar) page.append(templates._nav) - page.append('''

Import or Sync Your iTunes Library


- Enter the full path to your iTunes XML file. + page.append('''

Import or Sync Your iTunes Library/Music Folder


+ Enter the full path to your iTunes XML file or music folder

i.e. /Users/"username"/Music/iTunes/iTunes Music Library.xml
- note: This process can take a LONG time!

+ or /Users/"username"/Music/iTunes/iTunes Media/Music

(artists should have their own directories for folder import to work) +

note: This process can take a LONG time!

Once you click "Submit" you can navigate away from this page while the process runs.