discogs_importer: improve mblink_done attribute

It was a boolean, it is now a list of all MB types tried.
This commit is contained in:
Laurent Monin 2015-06-11 15:33:11 +02:00
parent 08046d1b09
commit 2725bdf76d

View file

@ -92,9 +92,12 @@ function insertMBLinks($root) {
var $link = $(this); var $link = $(this);
var mlink = $link.attr('mlink'); var mlink = $link.attr('mlink');
// ensure we do it only once per link // ensure we do it only once per link
var done = $link.attr('mlink_done'); var done = ($link.attr('mlink_done') || "").split(",");
if (done) return; for (var i=0; i<done.length; i++) {
$link.attr('mlink_done', true); if (mb_type == done[i]) return;
}
done.push(mb_type);
$link.attr('mlink_done', done.filter(function(e) { return (e!="");}).join(','));
if (link_infos[mlink] && link_infos[mlink].type == discogs_type) { if (link_infos[mlink] && link_infos[mlink].type == discogs_type) {
var discogs_url = link_infos[mlink].clean_url; var discogs_url = link_infos[mlink].clean_url;
mblinks.searchAndDisplayMbLink(discogs_url, mb_type, function (link) { $link.before(link); }); mblinks.searchAndDisplayMbLink(discogs_url, mb_type, function (link) { $link.before(link); });