Fixed crash on iTunes library parsing when the "Location" element is missing in track data dictionary.

This commit is contained in:
Virgil Dupras 2012-04-13 15:21:48 -04:00
parent 933474400c
commit df9af9a796
1 changed files with 4 additions and 1 deletions

View File

@ -83,7 +83,10 @@ def get_itunes_songs(plistpath):
for song_data in plist['Tracks'].values():
if song_data['Track Type'] != 'File':
continue
song = ITunesSong(song_data)
try:
song = ITunesSong(song_data)
except KeyError: # No "Location" or "Track ID" key in track
continue
if io.exists(song.path):
result.append(song)
return result