From c9676c1be5a8e51cb15fe52297b741f226ddc106 Mon Sep 17 00:00:00 2001 From: "Maxence G. de Montauzan" Date: Wed, 12 Apr 2017 00:58:39 +0200 Subject: [PATCH] Less restrictive filter + convert rating --- iTunesGraphParser.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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] = {