From afcbd75d9710d5c094e9b30a029f63891bdbdfcc Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Fri, 12 May 2017 11:39:30 -0700 Subject: [PATCH] Filter out unplayable tracks from library on update --- amazon/content/contents/code/amazon.js | 14 +++++++++++++- amazon/content/metadata.json | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/amazon/content/contents/code/amazon.js b/amazon/content/contents/code/amazon.js index b13081262..bc3c5bfa4 100644 --- a/amazon/content/contents/code/amazon.js +++ b/amazon/content/contents/code/amazon.js @@ -560,7 +560,19 @@ var AmazonResolver = Tomahawk.extend( Tomahawk.Resolver, { return that._post(this.api_location + 'cirrus/', { data: _query }, true).then(function(response) { - previousResults = previousResults.concat(response.searchLibraryResponse.searchLibraryResult.searchReturnItemList.map(that._convertTrack)); + previousResults = previousResults.concat(response + .searchLibraryResponse + .searchLibraryResult + .searchReturnItemList + .filter(function(track) { + track = track.metadata; + return ( + track.purchased == 'true' || + track.uploaded == 'true' || + (track.primeStatus == 'PRIME' && that._appConfig.featureController.robin == 1) || + (track.isMusicSubscription == 'true' && that._appConfig.featureController.hawkfireAccess == 1)); + }) + .map(that._convertTrack)); nextResultsToken = response.searchLibraryResponse.searchLibraryResult.nextResultsToken; if (null === nextResultsToken) return previousResults; diff --git a/amazon/content/metadata.json b/amazon/content/metadata.json index 96a96f508..9599df316 100644 --- a/amazon/content/metadata.json +++ b/amazon/content/metadata.json @@ -3,7 +3,7 @@ "pluginName": "amazon", "author": "Creepy Guy In The Corner", "email": "", - "version": "0.0.10", + "version": "0.0.11", "website": "http://gettomahawk.com", "description": "Streams music from Amazon Music", "type": "resolver/javascript",