Skip to content

Commit

Permalink
Send MB release ID instead of full URI
Browse files Browse the repository at this point in the history
Thanks to chaban for the suggestion.
  • Loading branch information
atj committed Jun 17, 2019
1 parent fead25a commit 17028f7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mb_spotify_isrc_link.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Add Spotify ISRC link to release pages
// @version 2019.6.13.1
// @version 2019.6.17.1
// @description Adds an "import ISRCs" link to release pages with a Spotify URL
// @author atj
// @license MIT; https://opensource.org/licenses/MIT
Expand All @@ -22,8 +22,8 @@ $(document).ready(function() {
return;
}

let releaseUrl = window.location.href.replace(/\?.*$/, '').replace(/#.*$/, '');
let spotifyId = spotifyLink.href.replace(/^https?:\/\/open\.spotify\.com\/album\//i, '');
let tatsumoUrl = `https://tatsumo.pythonanywhere.com/album/${spotifyId}?bind=${encodeURIComponent(releaseUrl)}`;
let mbId = window.location.href.replace(/^.+\/release\/([-0-9a-f]{36}).*$/i, '$1');
let spotifyId = spotifyLink.href.replace(/^.+\/album\/([0-9a-z]+)/i, '$1');
let tatsumoUrl = `https://tatsumo.pythonanywhere.com/album/${spotifyId}?bind=${mbId}`;
$(spotifyLink.nextElementSibling.nextSibling).after(` [<a href="${tatsumoUrl}" target="_blank">import ISRCs</a>]`);
});

0 comments on commit 17028f7

Please sign in to comment.