Improve main loop + process
This commit is contained in:
@@ -100,9 +100,7 @@ class ITunesParser:
|
||||
tracks = self._read_tracks()
|
||||
ret = ""
|
||||
|
||||
for k in tracks:
|
||||
track = tracks[k]
|
||||
|
||||
for _, track in tracks.items():
|
||||
# Filter out any non-music
|
||||
if track['Track Type'] != 'File':
|
||||
continue
|
||||
@@ -157,13 +155,10 @@ class ITunesParser:
|
||||
self._artists[akey]['Rating'] = rating
|
||||
self._artists[akey]['Play Count'] += play_count
|
||||
|
||||
if 'Genre' not in track:
|
||||
return
|
||||
|
||||
# Split up the Genres
|
||||
genre_parts = track['Genre'].split('/')
|
||||
self._artists[akey]['Genre'] |= set(genre_parts)
|
||||
return
|
||||
if 'Genre' in track:
|
||||
# Split up the Genres
|
||||
genre_parts = track['Genre'].split('/')
|
||||
self._artists[akey]['Genre'] |= set(genre_parts)
|
||||
|
||||
def _process_album(self, track):
|
||||
"""
|
||||
@@ -198,18 +193,14 @@ class ITunesParser:
|
||||
self._albums[akey]['Rating'] = rating
|
||||
self._albums[akey]['Play Count'] += play_count
|
||||
|
||||
if 'Genre' not in track:
|
||||
return
|
||||
|
||||
# Split up the Genres
|
||||
genre_parts = track['Genre'].split('/')
|
||||
self._albums[akey]['Genre'] |= set(genre_parts)
|
||||
if 'Genre' in track:
|
||||
# Split up the Genres
|
||||
genre_parts = track['Genre'].split('/')
|
||||
self._albums[akey]['Genre'] |= set(genre_parts)
|
||||
|
||||
## Add different artists
|
||||
if 'Artist' not in track:
|
||||
return
|
||||
self._albums[akey]['Artist'].add(track['Artist'])
|
||||
return
|
||||
if 'Artist' in track:
|
||||
self._albums[akey]['Artist'].add(track['Artist'])
|
||||
|
||||
def _write_artists(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user