From 01ee37410087795150d3e28ec7c189fb82f3d37d Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Wed, 7 Mar 2018 10:18:31 +0100 Subject: [PATCH 1/2] Bandcamp importer: count tracks actually streamable, and add Stream for free link only if fully streamable Fix https://github.com/murdos/musicbrainz-userscripts/issues/157 --- bandcamp_importer.user.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bandcamp_importer.user.js b/bandcamp_importer.user.js index e73ac26..9da1b14 100644 --- a/bandcamp_importer.user.js +++ b/bandcamp_importer.user.js @@ -106,6 +106,7 @@ var BandcampImport = { release.artist_credit = MBImport.makeArtistCredits([bandcampAlbumData.artist]); } + var tracks_streamable = 0; $.each(bandcampAlbumData.trackinfo, function (index, bctrack) { var title = bctrack.title; var artist = []; @@ -116,6 +117,7 @@ var BandcampImport = { artist = [m[1]]; } } + if (bctrack.file) tracks_streamable++; var track = { 'title': title, 'duration': Math.round(bctrack.duration * 1000), @@ -173,7 +175,7 @@ var BandcampImport = { } } // Check if the release is streamable - if (bandcampAlbumData.hasAudio && !nostream) { + if (bandcampAlbumData.hasAudio && !nostream && disc.tracks.length > 0 && disc.tracks.length == tracks_streamable) { release.urls.push({ 'url': release.url, 'link_type': link_type.stream_for_free From bc3f5df6f5176a49b8742fe2f14a87654e9e114e Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Wed, 7 Mar 2018 10:19:29 +0100 Subject: [PATCH 2/2] Bandcamp importer: bump version to 2018.3.7.1 --- bandcamp_importer.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bandcamp_importer.user.js b/bandcamp_importer.user.js index 9da1b14..9c477dc 100644 --- a/bandcamp_importer.user.js +++ b/bandcamp_importer.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Import Bandcamp releases to MusicBrainz // @description Add a button on Bandcamp's album pages to open MusicBrainz release editor with pre-filled data for the selected release -// @version 2018.2.18.1 +// @version 2018.3.7.1 // @namespace http://userscripts.org/users/22504 // @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/bandcamp_importer.user.js // @updateURL https://raw.github.com/murdos/musicbrainz-userscripts/master/bandcamp_importer.user.js