mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-11-13 22:37:08 +00:00
bandcamp: try to use mblinks cache to get artist mbid
This commit is contained in:
parent
6a57231062
commit
38e732a3c4
1 changed files with 10 additions and 2 deletions
|
@ -214,13 +214,21 @@ $(document).ready(function () {
|
|||
var mblinks = new MBLinks('BCI_MBLINKS_CACHE');
|
||||
|
||||
var release = BandcampImport.retrieveReleaseInfo();
|
||||
LOGGER.info("Parsed release: ", release);
|
||||
BandcampImport.insertLink(release);
|
||||
|
||||
// add MB artist link
|
||||
var artist_link = release.url.match(/^(http:\/\/[^\/]+)/)[1];
|
||||
mblinks.searchAndDisplayMbLink(artist_link, 'artist', function (link) { $('div#name-section span[itemprop="byArtist"]').before(link); } );
|
||||
|
||||
if (release.artist_credit.length == 1) {
|
||||
// try to get artist's mbid from cache
|
||||
var artist_mbid = mblinks.resolveMBID(artist_link);
|
||||
if (artist_mbid) {
|
||||
release.artist_credit[0].mbid = artist_mbid;
|
||||
}
|
||||
}
|
||||
BandcampImport.insertLink(release);
|
||||
LOGGER.info("Parsed release: ", release);
|
||||
|
||||
if (release.type == 'track') {
|
||||
// add MB links to parent album
|
||||
mblinks.searchAndDisplayMbLink(release.parent_album_url, 'release', function (link) { $('div#name-section span[itemprop="inAlbum"] a:first').before(link); } );
|
||||
|
|
Loading…
Reference in a new issue