mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-12-14 04:12:28 +00:00
Merge pull request #178 from zas/fix_download_link
Bandcamp importer: fix stream for free link
This commit is contained in:
commit
f1d856fbfc
1 changed files with 4 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Import Bandcamp releases to MusicBrainz
|
// @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
|
// @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
|
// @namespace http://userscripts.org/users/22504
|
||||||
// @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/bandcamp_importer.user.js
|
// @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
|
// @updateURL https://raw.github.com/murdos/musicbrainz-userscripts/master/bandcamp_importer.user.js
|
||||||
|
@ -106,6 +106,7 @@ var BandcampImport = {
|
||||||
release.artist_credit = MBImport.makeArtistCredits([bandcampAlbumData.artist]);
|
release.artist_credit = MBImport.makeArtistCredits([bandcampAlbumData.artist]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tracks_streamable = 0;
|
||||||
$.each(bandcampAlbumData.trackinfo, function (index, bctrack) {
|
$.each(bandcampAlbumData.trackinfo, function (index, bctrack) {
|
||||||
var title = bctrack.title;
|
var title = bctrack.title;
|
||||||
var artist = [];
|
var artist = [];
|
||||||
|
@ -116,6 +117,7 @@ var BandcampImport = {
|
||||||
artist = [m[1]];
|
artist = [m[1]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bctrack.file) tracks_streamable++;
|
||||||
var track = {
|
var track = {
|
||||||
'title': title,
|
'title': title,
|
||||||
'duration': Math.round(bctrack.duration * 1000),
|
'duration': Math.round(bctrack.duration * 1000),
|
||||||
|
@ -173,7 +175,7 @@ var BandcampImport = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check if the release is streamable
|
// 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({
|
release.urls.push({
|
||||||
'url': release.url,
|
'url': release.url,
|
||||||
'link_type': link_type.stream_for_free
|
'link_type': link_type.stream_for_free
|
||||||
|
|
Loading…
Reference in a new issue