diff --git a/lib/import_functions.js b/lib/import_functions.js index 7bc9d78..f9f561c 100644 --- a/lib/import_functions.js +++ b/lib/import_functions.js @@ -101,6 +101,17 @@ var MBReleaseImportHelper = (function() { return 'Search in MusicBrainz'; } + function fnSearchUrlFor(type, what) { + type = type.replace('-', '_'); + + var params = [ + 'query=' + luceneEscape(what), + 'type=' + type, + 'indexed=1' + ]; + return '//musicbrainz.org/search?' + params.join('&'); + } + // compute HTML of import form function fnBuildFormHTML(parameters) { @@ -345,6 +356,7 @@ var MBReleaseImportHelper = (function() { guessReleaseType: fnGuessReleaseType, hmsToMilliSeconds: hmsToMilliSeconds, ISO8601toMilliSeconds: fnISO8601toMilliSeconds, + searchUrlFor: fnSearchUrlFor, URL_TYPES: url_types }; })();