Use new logging system in all import scripts.

This commit is contained in:
Aurélien Mino 2015-01-18 14:13:32 +01:00
parent 59e0f8b244
commit f217ccf005
4 changed files with 16 additions and 44 deletions

View file

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Import Bandcamp releases into MB // @name Import Bandcamp releases into MB
// @version 2014.10.18.1 // @version 2015.01.18.0
// @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
@ -8,6 +8,7 @@
// @include http*://*.bandcamp.com/track/* // @include http*://*.bandcamp.com/track/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js // @require https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
// @require https://raw.github.com/murdos/musicbrainz-userscripts/master/lib/import_functions.js // @require https://raw.github.com/murdos/musicbrainz-userscripts/master/lib/import_functions.js
// @require https://raw.github.com/murdos/musicbrainz-userscripts/master/lib/logger.js
// ==/UserScript== // ==/UserScript==
if (!unsafeWindow) unsafeWindow = window; if (!unsafeWindow) unsafeWindow = window;
@ -134,7 +135,7 @@ function retrieveReleaseInfo() {
}); });
} }
mylog(release); LOGGER.info("Parsed release: ", release);
return release; return release;
} }
@ -143,21 +144,10 @@ function retrieveReleaseInfo() {
function insertLink(release) { function insertLink(release) {
if(release.type == "single" && typeof release.parent_album != "undefined") { if(release.type == "single" && typeof release.parent_album != "undefined") {
mylog("This is part of an album, not continuing."); LOGGER.info("This is part of an album, not continuing.");
return false; return false;
} }
/*
var mbUI = document.createElement('div');
mbUI.innerHTML = "<h3>MusicBrainz</h3>";
mbUI.className = "section";
var mbContentBlock = document.createElement('div');
mbContentBlock.className = "section_content";
mbUI.appendChild(mbContentBlock);
*/
// Form parameters // Form parameters
var edit_note = 'Imported from ' + window.location.href; var edit_note = 'Imported from ' + window.location.href;
var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note); var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note);
@ -171,10 +161,3 @@ function insertLink(release) {
} }
function mylog(obj) {
var DEBUG = true;
if (DEBUG && unsafeWindow.console) {
unsafeWindow.console.log(obj);
}
}

View file

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name MusicBrainz: Import from Beatport // @name MusicBrainz: Import from Beatport
// @version 2014.09.29.0 // @version 2015.01.18.0
// @downloadURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/beatport_importer.user.js // @downloadURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/beatport_importer.user.js
// @updateURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/beatport_importer.user.js // @updateURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/beatport_importer.user.js
// @include http*://www.beatport.com/release/* // @include http*://www.beatport.com/release/*
@ -8,6 +8,7 @@
// @require https://raw.githubusercontent.com/phstc/jquery-dateFormat/master/src/dateFormat.js // @require https://raw.githubusercontent.com/phstc/jquery-dateFormat/master/src/dateFormat.js
// @require https://raw.githubusercontent.com/phstc/jquery-dateFormat/master/src/jquery.dateFormat.js // @require https://raw.githubusercontent.com/phstc/jquery-dateFormat/master/src/jquery.dateFormat.js
// @require https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/lib/import_functions.js // @require https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/lib/import_functions.js
// @require https://raw.github.com/murdos/musicbrainz-userscripts/master/lib/logger.js
// ==/UserScript== // ==/UserScript==
if (!unsafeWindow) unsafeWindow = window; if (!unsafeWindow) unsafeWindow = window;
@ -65,14 +66,14 @@ function retrieveReleaseInfo() {
}); });
} }
); );
mylog(tracks); LOGGER.debug("tracks: ", tracks);
release.discs = []; release.discs = [];
release.discs.push( { release.discs.push( {
'tracks': tracks, 'tracks': tracks,
'format': "Digital Media" 'format': "Digital Media"
} ); } );
mylog(release); LOGGER.info("Parsed release: ", release);
return release; return release;
} }
@ -86,10 +87,3 @@ function insertLink(release) {
tr.find('td').append(innerHTML); tr.find('td').append(innerHTML);
$("table.meta-data tbody").append(tr); $("table.meta-data tbody").append(tr);
} }
function mylog(obj) {
var DEBUG = true;
if (DEBUG && unsafeWindow.console) {
unsafeWindow.console.log(obj);
}
}

View file

@ -3,13 +3,14 @@
// @author VxJasonxV // @author VxJasonxV
// @description One-click importing of releases from pro.beatport.com/release pages into MusicBrainz // @description One-click importing of releases from pro.beatport.com/release pages into MusicBrainz
// @sourceURL https://github.com/VxJasonxV/musicbrainz-userscripts/blob/master/beatport_pro_importer.user.js // @sourceURL https://github.com/VxJasonxV/musicbrainz-userscripts/blob/master/beatport_pro_importer.user.js
// @version 2014.10.03.0 // @version 2015.01.18.0
// @downloadURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/beatport_pro_importer.user.js // @downloadURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/beatport_pro_importer.user.js
// @updateURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/beatport_pro_importer.user.js // @updateURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/beatport_pro_importer.user.js
// @include http://pro.beatport.com/release/* // @include http://pro.beatport.com/release/*
// @include https://pro.beatport.com/release/* // @include https://pro.beatport.com/release/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @require https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/lib/import_functions.js // @require https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/lib/import_functions.js
// @require https://raw.github.com/murdos/musicbrainz-userscripts/master/lib/logger.js
// ==/UserScript== // ==/UserScript==
if (!unsafeWindow) unsafeWindow = window; if (!unsafeWindow) unsafeWindow = window;
@ -80,7 +81,7 @@ function retrieveReleaseInfo() {
'format': "Digital Media" 'format': "Digital Media"
} ); } );
mylog(release); LOGGER.info("Parsed release: ", release);
return release; return release;
} }
@ -93,10 +94,3 @@ function insertLink(release) {
$(".interior-release-chart-content-list").append(innerHTML); $(".interior-release-chart-content-list").append(innerHTML);
} }
function mylog(obj) {
var DEBUG = true;
if (DEBUG && unsafeWindow.console) {
unsafeWindow.console.log(obj);
}
}

View file

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Import Encyclopedisque releases to MusicBrainz // @name Import Encyclopedisque releases to MusicBrainz
// @version 2014.02.22.1 // @version 2015.01.18.0
// @namespace http://userscripts.org/users/22504 // @namespace http://userscripts.org/users/22504
// @description Easily import Encyclopedisque releases into MusicBrainz // @description Easily import Encyclopedisque releases into MusicBrainz
// @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/encyclopedisque_importer.user.js // @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/encyclopedisque_importer.user.js
@ -9,6 +9,7 @@
// @include http://www.encyclopedisque.fr/artiste/*.html // @include http://www.encyclopedisque.fr/artiste/*.html
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js // @require https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// @require https://raw.github.com/murdos/musicbrainz-userscripts/master/lib/import_functions.js // @require https://raw.github.com/murdos/musicbrainz-userscripts/master/lib/import_functions.js
// @require https://raw.github.com/murdos/musicbrainz-userscripts/master/lib/logger.js
// ==/UserScript== // ==/UserScript==
$(document).ready(function() { $(document).ready(function() {
@ -254,7 +255,7 @@ function parseEncyclopedisquePage() {
release.no_barcode = '1'; release.no_barcode = '1';
} }
console.log(release); LOGGER.info("Parsed release: ", release);
return release; return release;
} }