Bring me a green tagger button!

My default answer to this would usually have been, what @IvanDobsky pointed out above: Not everyone browsing MB is tagging (and the that button would just be a dead link) and even if Picard is running it might have the tagger button integration being disabled or listen on a different port than 8000 (either because it has been configured that way or because it automatically chooses a different port if 8000 is already in use).

But listen, friends of user scripts! Here is the MB auto tagger button script:

https://raw.githubusercontent.com/phw/musicbrainz-magic-tagger-button/main/mb-magic-tagger-button.user.js

Install this script with your favorite user script manager and enjoy the tagger button showing up automatically if you have Picard running. It will even auto detect the proper port.

Some things to be aware off:

  • This has been tested only on latest Firefox with Greasemonkey and Violentmonkey. It might or might not work on other browsers. The code assumes your browser supports modern JS features.
  • Actually this hasn’t been tested properly at all. It works here for me, but might not for you. For now this is a proof of concept.
  • For detecting whether and on which port Picard is running this script performs HTTP GET requests on localhost against the ports 8000 - 8020. If you have a local web server or anything else running on one of those ports better make sure it doesn’t do something unexpected. Proper software shouldn’t, but if you have setup a local webserver to delete all your files whenever you open http://localhost:8000 don’t come complain here.
  • If for some obscure reason you have Picard running on a port outside of this port range it won’t work, you’ll have to edit the script for this. Or just configure Picard to run on port 8000 again.
  • Activating the tagger button requires an automatic page reload. The script tries to avoid page reloads unless necessary. Let me know if the reload happens in a situation where it causes issues.
  • Once the tagger button is displayed, it won’t go away even if you close Picard. I found no way to tell MB.org to forget about the tport parameter again.

UPDATE: Looks like cross origin restrictions in Chromium based browsers makes this non functional. But I have a working fix for this for a future Picard release, let’s see if we can get this in. See https://tickets.metabrainz.org/browse/PICARD-2126

Also doing a request against a local address that is not being listened on is stupidly slow on Windows. Don’t know why, but it can make this awkward to use unless your Picard runs on the default port (8000) or at least close by (8001 or so). Not sure there is a workaround.

6 Likes