From 6df2af1282423c1124ce1b60ef5fade793774cc4 Mon Sep 17 00:00:00 2001 From: Maxime Date: Sun, 23 Aug 2015 16:38:18 +0200 Subject: [PATCH 1/9] add MA importer add MA importer --- metalarchives_importer.user.js | 242 +++++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 metalarchives_importer.user.js diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js new file mode 100644 index 0000000..0a6ae9b --- /dev/null +++ b/metalarchives_importer.user.js @@ -0,0 +1,242 @@ +/* +- First build a 'release' object that you'll fill in with your source of data + +- Call as follows, e.g.: + + var parameters = MBReleaseImportHelper.buildFormParameters( theParsedRelease, optionalEditNote ); + +- Then build the HTML that you'll inject into source site page: + + var formHtml = MBReleaseImportHelper.buildFormHTML( parameters ); + +- Addinionally, you can inject a search link to verify that the release is not already known by MusicBrainz: + + var linkHtml = MBReleaseImportHelper.buildSearchLink( theParsedRelease ); + +--- 'release' object format : --- + + release = { + title, + artist_credit = [ { name: '', + type, + secondary_types = [], + status, + language, + script, + packaging, + country, + year, + month, + day, + labels = [ { name, mbid, catno }, ... ], + barcode, + urls = [ {url, link_type }, ... ], + discs = [ + { + title, + format, + tracks = [ + { number, title, duration, artist_credit }, + ... + ] + }, + ... + ], + } + + where 'artist_credit' has the following format: + + artist_credit = [ + { + credited_name, + artist_name, + artist_mbid, + joinphrase + }, + ... + ] + +*/ + +// ==UserScript== +// @name Import Metal Archives releases into MB +// @namespace http://example.com +// @version 2015.05.23 +// @description import d'une release du site metal-archives vers musicbrainz +// @downloadURL https://raw.githubusercontent.com/MetalDavidian/Import_Metal_Archives_releases_into_MB/master/Import_Metal_Archives_releases_into_MB.user.js +// @update https://raw.githubusercontent.com/MetalDavidian/Import_Metal_Archives_releases_into_MB/master/Import_Metal_Archives_releases_into_MB.user.js +// @include http://www.metal-archives.com/albums/*/*/* +// @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js +// @require lib/mbimport.js +// ==/UserScript== +$(document).ready(function () { + var release = retrieveReleaseInfo(); + insertLink(release); +}); + +function setreleasedate(release, datestring) { + var patt = new RegExp('^d{4}$'); + if (patt.exec(datestring)) { + release.year = datestring; + } else if (datestring.indexOf(',') != - 1) { + var commaindex = datestring.indexOf(','); + var d = new Date(datestring.substring(0, commaindex - 2) + datestring.substring(commaindex)); + release.year = d.getFullYear(); + release.month = d.getMonth()+1; + release.day = d.getDate(); + console.log(release.day); + } else{ + var d = new Date("2 "+datestring); + release.year = d.getFullYear(); + release.month = d.getMonth()+1; + console.log(release.day); + } + return release; +} + +function getGenericalData(){ + var rdata=new Array(); + var keydata = $('dl.float_left dt, dl.float_right dt').map(function(){ + var s=$.trim($(this).text()); + return s.substring(0,s.length-1); + } ).get(); + var valuedata= $('dl.float_left dd,dl.float_right dd').map(function(){ + return $.trim($(this).text()); + } ).get(); + for(i=0;i div:nth-child(2)").find("p:not([class])").contents(); + for(var j=0;j MusicBrainz mapping // +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* +release.type primary type release secondary release type +on MA on MB + +Full-length Album Compilation +Live album Single Demo +Demo EP DJ-mix +Single Broadcast Interview +EP Other Live +Video Audiobook +Boxed set Mixtape/Street +Split Remix +Video/VHS (legacy) Soundtrack +Compilation Spokenword +Split video +*/ +//ReleaseTypes[MAtype]=["primary type","secondary type on mb"]; +var ReleaseTypes = new Array(); +ReleaseTypes["Full-length"]=["Album"]; +ReleaseTypes["Live album"]=["Album", "Live"]; +ReleaseTypes["Demo"]=["Album","Demo"]; +ReleaseTypes["Single"]=["Single"]; +ReleaseTypes["EP"]=["EP"]; +ReleaseTypes["Compilation"]=["Album", "Compilation"]; +ReleaseTypes["Split"]=["Album"]; + +//ReleaseFormat[MAformat]="MBformat"; +var ReleaseFormat = new Array(); +ReleaseFormat["CD"]="CD"; +ReleaseFormat["2CD"]="CD"; +ReleaseFormat["Vinyl"]="Vinyl"; +ReleaseFormat["7\" vinyl"]="7\" Vinyl"; +ReleaseFormat["7\" vinyl (33⅓ RPM)"]="7\" Vinyl"; +ReleaseFormat["10\" vinyl (33⅓ RPM)"]="10\" Vinyl"; +ReleaseFormat["10\" vinyl"]="10\" Vinyl"; +ReleaseFormat["12\" vinyl"]="12\" Vinyl"; +ReleaseFormat["2 12\" vinyls"]="12\" Vinyl"; +ReleaseFormat["12\" vinyl (33⅓ RPM)"]="12\" Vinyl"; +ReleaseFormat["Cassette"]="Cassette"; +ReleaseFormat["Digital"]="Digital Media"; \ No newline at end of file From 640a28dcf985095ea95d20275df8b19b1b069d6e Mon Sep 17 00:00:00 2001 From: Maxime Date: Sun, 23 Aug 2015 18:24:17 +0200 Subject: [PATCH 2/9] fixes: header, debug ... updating header to correct value remove release attributes with empty value remove console.log lines --- metalarchives_importer.user.js | 112 +++++---------------------------- 1 file changed, 17 insertions(+), 95 deletions(-) diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index 0a6ae9b..94be395 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -1,73 +1,13 @@ -/* -- First build a 'release' object that you'll fill in with your source of data - -- Call as follows, e.g.: - - var parameters = MBReleaseImportHelper.buildFormParameters( theParsedRelease, optionalEditNote ); - -- Then build the HTML that you'll inject into source site page: - - var formHtml = MBReleaseImportHelper.buildFormHTML( parameters ); - -- Addinionally, you can inject a search link to verify that the release is not already known by MusicBrainz: - - var linkHtml = MBReleaseImportHelper.buildSearchLink( theParsedRelease ); - ---- 'release' object format : --- - - release = { - title, - artist_credit = [ { name: '', - type, - secondary_types = [], - status, - language, - script, - packaging, - country, - year, - month, - day, - labels = [ { name, mbid, catno }, ... ], - barcode, - urls = [ {url, link_type }, ... ], - discs = [ - { - title, - format, - tracks = [ - { number, title, duration, artist_credit }, - ... - ] - }, - ... - ], - } - - where 'artist_credit' has the following format: - - artist_credit = [ - { - credited_name, - artist_name, - artist_mbid, - joinphrase - }, - ... - ] - -*/ - // ==UserScript== -// @name Import Metal Archives releases into MB -// @namespace http://example.com -// @version 2015.05.23 -// @description import d'une release du site metal-archives vers musicbrainz -// @downloadURL https://raw.githubusercontent.com/MetalDavidian/Import_Metal_Archives_releases_into_MB/master/Import_Metal_Archives_releases_into_MB.user.js -// @update https://raw.githubusercontent.com/MetalDavidian/Import_Metal_Archives_releases_into_MB/master/Import_Metal_Archives_releases_into_MB.user.js -// @include http://www.metal-archives.com/albums/*/*/* -// @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js -// @require lib/mbimport.js +// @name Import Metal Archives releases into MB +// @namespace https://github.com/murdos/musicbrainz-userscripts/ +// @version 2015.08.23.2 +// @description Add a button on Metal Archives release pages allowing to open MusicBrainz release editor with pre-filled data for the selected release +// @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js +// @update https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js +// @include http://www.metal-archives.com/albums/*/*/* +// @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js +// @require https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/lib/mbimport.js // ==/UserScript== $(document).ready(function () { var release = retrieveReleaseInfo(); @@ -84,20 +24,18 @@ function setreleasedate(release, datestring) { release.year = d.getFullYear(); release.month = d.getMonth()+1; release.day = d.getDate(); - console.log(release.day); } else{ var d = new Date("2 "+datestring); release.year = d.getFullYear(); release.month = d.getMonth()+1; - console.log(release.day); } return release; } function getGenericalData(){ - var rdata=new Array(); + var rdata = new Array(); var keydata = $('dl.float_left dt, dl.float_right dt').map(function(){ - var s=$.trim($(this).text()); + var s = $.trim($(this).text()); return s.substring(0,s.length-1); } ).get(); var valuedata= $('dl.float_left dd,dl.float_right dd').map(function(){ @@ -106,12 +44,10 @@ function getGenericalData(){ for(i=0;i div:nth-child(2)").find("p:not([class])").contents(); for(var j=0;j Date: Sun, 23 Aug 2015 20:14:13 +0200 Subject: [PATCH 3/9] url & logger add url mapping add logger.js and LOGGER.info --- metalarchives_importer.user.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index 94be395..c98b9ec 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -6,12 +6,14 @@ // @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js // @update https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js // @include http://www.metal-archives.com/albums/*/*/* -// @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js -// @require https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/lib/mbimport.js +// @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js +// @require lib/mbimport.js +// @require lib/logger.js // ==/UserScript== $(document).ready(function () { var release = retrieveReleaseInfo(); insertLink(release); + LOGGER.info("Parsed release: ", release); }); function setreleasedate(release, datestring) { @@ -77,8 +79,10 @@ function retrieveReleaseInfo() { } // Release URL + // URLs + var link_type = MBImport.URL_TYPES; release.urls = new Array(); - release.urls.push( { url: window.location.href, link_type: 82 } ); + release.urls.push( { url: window.location.href, link_type: link_type.other_databases } ); var releaseNumber=1; release.discs = new Array(); From 4825b1020761d4d3e426b7e08fb9a18f56b9c43a Mon Sep 17 00:00:00 2001 From: Maxime Date: Sun, 23 Aug 2015 20:35:38 +0200 Subject: [PATCH 4/9] beautify Beautify source code with http://jsbeautifier.org/ --- metalarchives_importer.user.js | 155 +++++++++++++++++---------------- 1 file changed, 81 insertions(+), 74 deletions(-) diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index c98b9ec..3fd5037 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Import Metal Archives releases into MB // @namespace https://github.com/murdos/musicbrainz-userscripts/ -// @version 2015.08.23.2 +// @version 2015.08.23.4 // @description Add a button on Metal Archives release pages allowing to open MusicBrainz release editor with pre-filled data for the selected release // @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js // @update https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js @@ -10,106 +10,113 @@ // @require lib/mbimport.js // @require lib/logger.js // ==/UserScript== -$(document).ready(function () { +$(document).ready(function() { var release = retrieveReleaseInfo(); insertLink(release); - LOGGER.info("Parsed release: ", release); + LOGGER.info("Parsed release: ", release); }); function setreleasedate(release, datestring) { var patt = new RegExp('^d{4}$'); if (patt.exec(datestring)) { release.year = datestring; - } else if (datestring.indexOf(',') != - 1) { + } else if (datestring.indexOf(',') != -1) { var commaindex = datestring.indexOf(','); var d = new Date(datestring.substring(0, commaindex - 2) + datestring.substring(commaindex)); release.year = d.getFullYear(); - release.month = d.getMonth()+1; + release.month = d.getMonth() + 1; release.day = d.getDate(); - } else{ - var d = new Date("2 "+datestring); + } else { + var d = new Date("2 " + datestring); release.year = d.getFullYear(); - release.month = d.getMonth()+1; + release.month = d.getMonth() + 1; } return release; } -function getGenericalData(){ +function getGenericalData() { var rdata = new Array(); - var keydata = $('dl.float_left dt, dl.float_right dt').map(function(){ + var keydata = $('dl.float_left dt, dl.float_right dt').map(function() { var s = $.trim($(this).text()); - return s.substring(0,s.length-1); - } ).get(); - var valuedata= $('dl.float_left dd,dl.float_right dd').map(function(){ + return s.substring(0, s.length - 1); + }).get(); + var valuedata = $('dl.float_left dd,dl.float_right dd').map(function() { return $.trim($(this).text()); - } ).get(); - for(i=0;i div:nth-child(2)").find("p:not([class])").contents(); - for(var j=0;j div:nth-child(2)").find("p:not([class])").contents(); + for (var j = 0; j < identifiers.length; j++) { + if (identifiers[j].textContent.indexOf("Barcode:") != -1) { + release.barcode = $.trim(identifiers[j].textContent.substring(8)); break; } } // Release URL - // URLs + // URLs var link_type = MBImport.URL_TYPES; release.urls = new Array(); - release.urls.push( { url: window.location.href, link_type: link_type.other_databases } ); + release.urls.push({ + url: window.location.href, + link_type: link_type.other_databases + }); - var releaseNumber=1; + var releaseNumber = 1; release.discs = new Array(); release.discs.push(new Object()); - release.discs[releaseNumber-1].tracks=new Array(); - release.discs[releaseNumber-1].format=ReleaseFormat[rdata["Format"]]; - var tracksline= $('table.table_lyrics tr.even,table.table_lyrics tr.odd'); - var trackslinelength=tracksline.length; - - tracksline.each(function(index,element){ - var trackNumber= $.trim(element.children[0].textContent).replace('.',""); - if( trackNumber == "1" && trackNumber != index+1 ){ + release.discs[releaseNumber - 1].tracks = new Array(); + release.discs[releaseNumber - 1].format = ReleaseFormat[rdata["Format"]]; + var tracksline = $('table.table_lyrics tr.even,table.table_lyrics tr.odd'); + var trackslinelength = tracksline.length; + + tracksline.each(function(index, element) { + var trackNumber = $.trim(element.children[0].textContent).replace('.', ""); + if (trackNumber == "1" && trackNumber != index + 1) { releaseNumber++; release.discs.push(new Object()); - release.discs[releaseNumber-1].tracks = new Array(); - release.discs[releaseNumber-1].format=ReleaseFormat[rdata["Format"]]; + release.discs[releaseNumber - 1].tracks = new Array(); + release.discs[releaseNumber - 1].format = ReleaseFormat[rdata["Format"]]; } - + var track = { - 'number':trackNumber, + 'number': trackNumber, 'title': element.children[1].textContent, 'duration': element.children[2].textContent, 'artist_credit': [release.artist_credit] }; - release.discs[releaseNumber-1].tracks.push(track); + release.discs[releaseNumber - 1].tracks.push(track); }); - return release; + return release; } // Insert links in page @@ -120,7 +127,7 @@ function insertLink(release) { var innerHTML = MBImport.buildFormHTML(parameters); $('h2.band_name').append(innerHTML); - $("form[action='//musicbrainz.org/release/add']").css("padding","initial"); + $("form[action='//musicbrainz.org/release/add']").css("padding", "initial"); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -133,36 +140,36 @@ on MA on MB Full-length Album Compilation Live album Single Demo Demo EP DJ-mix -Single Broadcast Interview -EP Other Live -Video Audiobook -Boxed set Mixtape/Street -Split Remix -Video/VHS (legacy) Soundtrack -Compilation Spokenword +Single Broadcast Interview +EP Other Live +Video Audiobook +Boxed set Mixtape/Street +Split Remix +Video/VHS (legacy) Soundtrack +Compilation Spokenword Split video */ //ReleaseTypes[MAtype]=["primary type","secondary type on mb"]; var ReleaseTypes = new Array(); -ReleaseTypes["Full-length"]=["Album"]; -ReleaseTypes["Live album"]=["Album", "Live"]; -ReleaseTypes["Demo"]=["Album","Demo"]; -ReleaseTypes["Single"]=["Single"]; -ReleaseTypes["EP"]=["EP"]; -ReleaseTypes["Compilation"]=["Album", "Compilation"]; -ReleaseTypes["Split"]=["Album"]; +ReleaseTypes["Full-length"] = ["Album"]; +ReleaseTypes["Live album"] = ["Album", "Live"]; +ReleaseTypes["Demo"] = ["Album", "Demo"]; +ReleaseTypes["Single"] = ["Single"]; +ReleaseTypes["EP"] = ["EP"]; +ReleaseTypes["Compilation"] = ["Album", "Compilation"]; +ReleaseTypes["Split"] = ["Album"]; //ReleaseFormat[MAformat]="MBformat"; var ReleaseFormat = new Array(); -ReleaseFormat["CD"]="CD"; -ReleaseFormat["2CD"]="CD"; -ReleaseFormat["Vinyl"]="Vinyl"; -ReleaseFormat["7\" vinyl"]="7\" Vinyl"; -ReleaseFormat["7\" vinyl (33⅓ RPM)"]="7\" Vinyl"; -ReleaseFormat["10\" vinyl (33⅓ RPM)"]="10\" Vinyl"; -ReleaseFormat["10\" vinyl"]="10\" Vinyl"; -ReleaseFormat["12\" vinyl"]="12\" Vinyl"; -ReleaseFormat["2 12\" vinyls"]="12\" Vinyl"; -ReleaseFormat["12\" vinyl (33⅓ RPM)"]="12\" Vinyl"; -ReleaseFormat["Cassette"]="Cassette"; -ReleaseFormat["Digital"]="Digital Media"; \ No newline at end of file +ReleaseFormat["CD"] = "CD"; +ReleaseFormat["2CD"] = "CD"; +ReleaseFormat["Vinyl"] = "Vinyl"; +ReleaseFormat["7\" vinyl"] = "7\" Vinyl"; +ReleaseFormat["7\" vinyl (33⅓ RPM)"] = "7\" Vinyl"; +ReleaseFormat["10\" vinyl (33⅓ RPM)"] = "10\" Vinyl"; +ReleaseFormat["10\" vinyl"] = "10\" Vinyl"; +ReleaseFormat["12\" vinyl"] = "12\" Vinyl"; +ReleaseFormat["2 12\" vinyls"] = "12\" Vinyl"; +ReleaseFormat["12\" vinyl (33⅓ RPM)"] = "12\" Vinyl"; +ReleaseFormat["Cassette"] = "Cassette"; +ReleaseFormat["Digital"] = "Digital Media"; \ No newline at end of file From cffdf5903dddf4e5e0b57528527f727f784ea4c9 Mon Sep 17 00:00:00 2001 From: Maxime Date: Tue, 25 Aug 2015 12:02:38 +0200 Subject: [PATCH 5/9] multiple artist support for split & collaboration Adding support for collaboration and split: - there are no proper join phrase on metal archives so I put '/' as a joinphrase only for split - ReleaseType["Collaboration"] return empty string because there is no real equivalent on MV. - removing unused variable - changing import form insertion in DOM --- metalarchives_importer.user.js | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index 3fd5037..aede560 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -49,16 +49,36 @@ function getGenericalData() { return rdata; } +function getArtistsList() { + var artists = $('h2.band_name').text().split('/'); + for (var i = 0; i < artists.length; i++) { + artists[i] = $.trim(artists[i]); + } + return artists; +} + function retrieveReleaseInfo() { var release = new Object(); + var rdata = getGenericalData(); + release.artist_credit = new Array(); - release.artist_credit.push({ - artist_name: $('h2.band_name').text(), - credited_name: $('h2.band_name').text() - }); + var artists = getArtistsList(); + if (rdata["Type"] == "Split") { + var joinphrase = "/"; + }; + for (var i = 0; i < artists.length; i++) { + + release.artist_credit.push({ + artist_name: artists[i], + credited_name: artists[i], + }); + if (i != artists.length - 1) { + release.artist_credit[i].joinphrase = joinphrase; + } + } release.title = $('h1.album_name').text(); - var rdata = getGenericalData(); + release = setreleasedate(release, rdata["Release date"]); //todo add case for multiple labels if such a case exist @@ -97,7 +117,6 @@ function retrieveReleaseInfo() { release.discs[releaseNumber - 1].tracks = new Array(); release.discs[releaseNumber - 1].format = ReleaseFormat[rdata["Format"]]; var tracksline = $('table.table_lyrics tr.even,table.table_lyrics tr.odd'); - var trackslinelength = tracksline.length; tracksline.each(function(index, element) { var trackNumber = $.trim(element.children[0].textContent).replace('.', ""); @@ -126,7 +145,7 @@ function insertLink(release) { var parameters = MBImport.buildFormParameters(release, edit_note); var innerHTML = MBImport.buildFormHTML(parameters); - $('h2.band_name').append(innerHTML); + $('h2.band_name').after(innerHTML); $("form[action='//musicbrainz.org/release/add']").css("padding", "initial"); } @@ -158,6 +177,7 @@ ReleaseTypes["Single"] = ["Single"]; ReleaseTypes["EP"] = ["EP"]; ReleaseTypes["Compilation"] = ["Album", "Compilation"]; ReleaseTypes["Split"] = ["Album"]; +ReleaseTypes["Collaboration"] = [""]; //ReleaseFormat[MAformat]="MBformat"; var ReleaseFormat = new Array(); From af64b3dd901ee343b995cf65900c7c2d85f29803 Mon Sep 17 00:00:00 2001 From: Maxime Date: Tue, 25 Aug 2015 12:05:07 +0200 Subject: [PATCH 6/9] update version number update version number --- metalarchives_importer.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index aede560..2a87226 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Import Metal Archives releases into MB // @namespace https://github.com/murdos/musicbrainz-userscripts/ -// @version 2015.08.23.4 +// @version 2015.08.25.1 // @description Add a button on Metal Archives release pages allowing to open MusicBrainz release editor with pre-filled data for the selected release // @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js // @update https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js From a97ef4d1112cdad845bb4969bf7a2cc98b5c1c91 Mon Sep 17 00:00:00 2001 From: Maxime Date: Tue, 25 Aug 2015 15:21:02 +0200 Subject: [PATCH 7/9] support for collaboration adding support for collaboration & split: -there is no join phrase for collaboration on meta-archive. Using '/' for split album -Collaboration can be an album or an EP on MB so ReleaseTypes["Collaboration"] = [""] removing unused variable --- metalarchives_importer.user.js | 40 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index 2a87226..62e08ba 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -8,8 +8,14 @@ // @include http://www.metal-archives.com/albums/*/*/* // @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js // @require lib/mbimport.js -// @require lib/logger.js +// @require lib/logger.js // ==/UserScript== + +// prevent JQuery conflicts, see http://wiki.greasespot.net/@grant +this.$ = this.jQuery = jQuery.noConflict(true); + +if (!unsafeWindow) unsafeWindow = window; + $(document).ready(function() { var release = retrieveReleaseInfo(); insertLink(release); @@ -59,26 +65,22 @@ function getArtistsList() { function retrieveReleaseInfo() { var release = new Object(); - var rdata = getGenericalData(); - release.artist_credit = new Array(); - var artists = getArtistsList(); - if (rdata["Type"] == "Split") { - var joinphrase = "/"; - }; - for (var i = 0; i < artists.length; i++) { - - release.artist_credit.push({ - artist_name: artists[i], - credited_name: artists[i], - }); - if (i != artists.length - 1) { - release.artist_credit[i].joinphrase = joinphrase; - } - } + var rdata = getGenericalData(); + var artists=getArtistsList(); + if(rdata["Type"]=="Split"){ + var joinphrasesplit="/"; + } + for(var i=0;i Date: Tue, 25 Aug 2015 15:37:26 +0200 Subject: [PATCH 8/9] comment comment --- metalarchives_importer.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index 62e08ba..a5caa8f 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -12,10 +12,10 @@ // ==/UserScript== // prevent JQuery conflicts, see http://wiki.greasespot.net/@grant -this.$ = this.jQuery = jQuery.noConflict(true); +/*this.$ = this.jQuery = jQuery.noConflict(true); if (!unsafeWindow) unsafeWindow = window; - +*/ $(document).ready(function() { var release = retrieveReleaseInfo(); insertLink(release); From ccac2b8120c15bccd12d0a06e9c93600adcfe1ba Mon Sep 17 00:00:00 2001 From: Maxime Date: Wed, 26 Aug 2015 12:09:33 +0200 Subject: [PATCH 9/9] removing unused variable removing unused variable --- metalarchives_importer.user.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index a5caa8f..3b38776 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Import Metal Archives releases into MB // @namespace https://github.com/murdos/musicbrainz-userscripts/ -// @version 2015.08.25.1 +// @version 2015.08.26.1 // @description Add a button on Metal Archives release pages allowing to open MusicBrainz release editor with pre-filled data for the selected release // @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js // @update https://raw.github.com/murdos/musicbrainz-userscripts/master/metalarchives_importer.user.js @@ -119,7 +119,6 @@ function retrieveReleaseInfo() { release.discs[releaseNumber - 1].tracks = new Array(); release.discs[releaseNumber - 1].format = ReleaseFormat[rdata["Format"]]; var tracksline = $('table.table_lyrics tr.even,table.table_lyrics tr.odd'); - var trackslinelength = tracksline.length; tracksline.each(function(index, element) { var trackNumber = $.trim(element.children[0].textContent).replace('.', "");