Sound.and.vision's Quick and Dirty Scripts

before I begin I’ll probably put these on Github at some point…

I think that to make the most of this website userscripts are a must, they save time and most importantly stop me wearing out my wrist and giving myself RSI :sweat:

There are plenty of really good and well developed scripts by some of the most seasoned contributors here and I’m nowhere close, but I guess I’ve got heart.

Many of these scripts are a bit wonky and not very robust, and I provide no guarantee it won’t cause you major embarrassment but maybe it could help someone, or at least spur on a better evolution.

Many of these are concering speeding up data-entry.

These are all simple userscripts that you can use with TamperMonkey/ViolentMonkey or similar.

Again as I’m not very skilled some of these are partially generated by ChatGPT.

If you can notice any way I can improve my little scripts then please let me know as I like to learn about these things :smiley:

Karaoke Work Ticker
This is a script that can really save your wrists, I really like joining recordings to works and part of that is ensuring the right attribute is selected. This script was initially setup to tick the Karaoke attribute field only, but you can modify it to tick the other attributes easily enough by changing out the karaoke-checkbox value on line 16 with something like live-checkbox or cover-checkbox :slight_smile: .

// ==UserScript==
// @name         Auto Tick Karaoke Checkbox
// @namespace    https://*.musicbrainz.org/release/*/edit-relationships
// @version      0.4
// @description  Automatically ticks the checkbox with id "karaoke-checkbox" when a button with class "add-item with-label" is clicked by simulating a click event.
// @author       sound.and.vision
// @match        https://*.musicbrainz.org/release/*/edit-relationships
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to simulate a click on the checkbox
    function clickCheckbox() {
        var checkbox = document.getElementById('karaoke-checkbox');
        if (checkbox && !checkbox.checked) {
            checkbox.click(); // Simulate a click event
        }
    }

    // Add event listener to all buttons with the class "add-item with-label"
    document.addEventListener('click', function(event) {
        if (event.target.matches('.add-item.with-label')) {
            clickCheckbox(); // Click the checkbox immediately
        }
    });
})();

5 Likes

Recording Genre Filler
Yeah this one is kind of simple and dumb, but it can help when I need to tag a series of recordings with a set phrase. I simply change the value to the genre I care about. As I like to set my genres at recording level, this is useful to me.

// ==UserScript==
// @name        Genre Filler
// @namespace   https://*.musicbrainz.org/recording/*
// @version     1.0
// @description Fills the genre field on a recording with whatever you want
// @author      sound.and.vision
// @match       https://*.musicbrainz.org/recording/*
// @grant       none
// ==/UserScript==

// Find the text field with the name "tags"
const field = document.querySelector('input[name="tags"]');

// Focus on the field
if (field) {
  field.focus();
  field.value = "pop";
}
4 Likes