[userscript] manual track owned albums

so i recently started adding my record collection to musicbrainz and while i’m adding the records i’m also playing them. but i got a bit annoyed that i had to search for them in musicbrainz & copy the mbid to be able to track the album.

so i made a userscript, it will fetch the (public) “Owned Music” collections and in the manual add listens popup give you an extra tab that will give you a list where you can choose the album you want to track.
(you do have to press the space bar to search for it, i have tried to search for a way to get around this but haven’t found it yet)

6 Likes

so, does this allow you to search your MusicBrainz collections in order to manually submit listens on ListenBrainz? or am I misunderstanding here?

Yes, it first gets your collections. Then ik checks which collections are of the type “Owned music” and then it will list all the releases, clicking on one of them will fill it in on the search bar & focus on the search bar. You only have to press space for the change detection of the searchbar.

That’s so cool!

At first I thought it wasn’t working but then I changed some of my collections to the “Owned music” type, and then the button pops up.

Unfortunately when I press the button it gives me this error:

By the way the script description still says “Add a button to import events to musicbrainz” and it made me a bit confused at first :smiley:

are your “owned music” collections public?

Yeah, you should be able to see the collection in question at the link to some of my collections :thinking:

edit: It works when I un-public the 700 release collection, it will show the 19 release collection.

async function waitTillModal() {
  while (modal == null) {
    await sleep(1000);
    modal = document.getElementById("AddListenModal");
    //console.log(modal);
  }
  addButton();
}

I’m both horrified and in awe that it works better than my own userscript’s hook methods

1 Like

@RustyNova

@sanojjonas is the Master of the Script. He studied at @jesus2099. :wink:

I mean, MutationObservers are litterally made for that exact purpose. But I guess I use them badly

yeah it only works for releases, i didn’t think people would manually track a lot of single songs.

i just use it to track albums i listen to.

but i should fix that it doesn’t crash if you don’t have the correct collections public

it ain’t stupid if it works…

1 Like

I don’t understand, I don’t have any collections with songs/recordings, just release collections

i fixed it, it was my fault. i only tested it on my one collection with only 40 releases.
i made it date it would page through bigger collections. but i had some errors in there.

so it should be fixed, but it will be much slower (since i can only reqesut one thing per second)

tl;dr: its fixed

1 Like

Works, very cool, thank you!

i started using localstorig to store data, so it will still load the latest values but it will already shw stuff it finds in local storage.
this should speed up stuff in so you don’t have to wait every time until everything is loaded.

1 Like