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

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

View File

@@ -306,10 +306,11 @@ class Headphones:
page = [templates._header]
page.append(templates._logobar)
page.append(templates._nav)
page.append('''<div class="table"><div class="config"><h1>Import or Sync Your iTunes Library</h1><br />
Enter the full path to your iTunes XML file.
page.append('''<div class="table"><div class="config"><h1>Import or Sync Your iTunes Library/Music Folder</h1><br />
Enter the full path to your iTunes XML file or music folder<br /><br />
i.e. /Users/"username"/Music/iTunes/iTunes Music Library.xml<br />
note: This process can take a LONG time!<br /><br />
<i>or</i> /Users/"username"/Music/iTunes/iTunes Media/Music <br /><br />(artists should have their own directories for folder import to work)
<br /><br />note: This process can take a LONG time!<br /><br />
Once you click "Submit" you can navigate away from this
page while the process runs.<br /><br /><br />
<form action="importItunes" method="GET" align="center">