Improve main loop + process

This commit is contained in:
2017-04-20 00:14:30 +02:00
parent 5778bc4f23
commit fd8c1381d7

View File

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