diff --git a/iTunesGraphParser.py b/iTunesGraphParser.py index 38608c3..84ecf67 100644 --- a/iTunesGraphParser.py +++ b/iTunesGraphParser.py @@ -100,12 +100,20 @@ class ITunesGraphParser: for k in tracks: track = tracks[k] - + # Filter out any non-music with ratings lower than 3 stars - if (track['Track Type'] != 'File') or ('Artist' not in track) or ('Genre' not in track) or ( - 'Rating' not in track) or (track['Rating'] < self._rating) or (track['Artist'] == 'Various Artists'): + if (track['Track Type'] != 'File') or ('Artist' not in track) or ('Genre' not in track): + # After a lot of investigation, songs without these properties are really problematic + # (songs that need to be relocated, podcast, etc.) continue + # Convert rating - needed for calculation later + if ('Rating' not in track): + if ('Album Rating' not in track): + track['Rating'] = 0 + else: + track['Rating'] = track['Album Rating'] + akey = track['Artist'] if akey not in self._artists: self._artists[akey] = {