Userscript: Semi-automate adding "remixer" and "remix of" credits

Tags: #<Tag:0x00007f58fdc9ba28> #<Tag:0x00007f58fdc9b910>

I always try to add “remixer” and (to a lesser extent) “remix of” credits to releases, but find the process very tedious and time consuming. So I finally got around to writing a userscript that semi-automates the process. It should work pretty well in about 95% of cases.

The script checks to see if a track title contains a remix credit and then adds links which open the “Add relationship” dialog, set the type field and fill in the name:

Peek 2021-01-29 12-22

This reduces the entire process to 3 clicks (assuming the remix artist already exists in MB). The “remix of” process doesn’t tend to work very well most of the time as track names often exist multiple times in the database (or not at all).

You can install from my Github repository or directly below:

mb_add_remix_credit_links.user.js

I’ve only tested the script in Brave/ViolentMonkey on Linux, so it may not work in other browsers/extensions. If you have any issues then let me know here or raise a Github issue and I’ll do my best to fix them.

Edit The script has been updated and is now working in Tampermonkey on Firefox

10 Likes

It looks great, I have installed it and I can’t wait to have a release with remixes! :slight_smile:

2 Likes

You could improve the search results by prefilling the recording search with title and artist instead of the title only, i.e. “Fly Away The Sunburst Band” for your example. This should work well in most cases and is also the first thing I would do manually when the search yields no useful results (before I copy the recording MBID from a different tab :wink:).

2 Likes

Thanks for the suggestion. Determining the recording artist is a bit more involved as it’s not displayed with the recording for single artist releases, so some additional logic will be required. I’ll have a look at it over the weekend. :slight_smile:

3 Likes

I’m not sure if Firefox is to blame or Tampermonkey. But this script doesn’t seem to work when used in Firefox in conjunction with Tampermonkey.

Curiously it works flawlessly in Chrome with Tampermonkey. It also works as expected when used with Violentmonkey in Firefox.

I couldn’t see any error in the console as if it never runs…

The scripts by @loujin on the other hand always work, no matter if it’s Tampermonkey on Firefox.

So, at line 153 I replaced window.addEventListener('load', function () { by $(document).ready(function () { and now it works.

Also added add-rel to classes for nicer button placement:


->

¯\_(ツ)_/¯

4 Likes

@atj, I filed a very small patch that maybe will fix this loading issue (no run-at is explicitly set and Tampermonkey has different default value).

@chaban, very nice! :slight_smile: :+1:

5 Likes

I don’t really understand how this fixes the issue as $(document) is jQuery syntax, yet the userscript doesn’t load it. :man_shrugging:

@jesus2099: I’ve merged the PR, thank a lot :slight_smile:

1 Like

The answer is that some MB userscripts rely on the jQuery version which is already delivered and used by MBS itself. As long as jQuery is already available this avoids loading the same library from two different servers, but it becomes a problem when MBS decides to remove a library which is no longer in use. A few months ago the removal of Lodash broke some userscripts that relied on this library being provided by MBS:

3 Likes

Thanks, I thought this might be the case. I’ve created a new Firefox profile for testing scripts in Tampermonkey and have replicated the issue, so I’ll try and resolve it without resorting to jQuery.

1 Like

Thanks @chaban / @jesus2099 / @kellnerd for the reports and assistance. I’ve just updated the script to version 2021.1.30.2 with fixes for the loading and icon alignment issues in Tampermonkey/Firefox.

1 Like

I have just experimented a bit and implemented the code that is needed to extract the track artists from the page. In case no track artists are displayed for a remix because they are the same as for the release, I am using the release artists from the header instead.

5 Likes

Thanks a lot for this, it’s much appreciated. I learned some useful JS syntax from your changes too! I’ve requested a minor change to the PR, hope you don’t mind. :slight_smile:

2 Likes