listenbrainz/elbisaur: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
(Update instructions for the latest LB and elbisaur updates & Clarify that elbisaur is the CLI)
(Update instructions for the latest LB and elbisaur updates & Clarify that elbisaur is the CLI)
 
(No difference)

Latest revision as of 08:45, 27 May 2024

elbisaur is a (beta) Deno command line application to access the ListenBrainz API. It supports ListenBrainz submission and various other tools, e.g. listen deletion.

For more information visit the elbisaur site and documentation:

https://github.com/kellnerd/listenbrainz-ts/tree/main/cli

How-to: Delete a time range of ListenBrainz listens

  1. Install Deno from https://deno.com/ (runtime which can execute JavaScript and TypeScript programs). With that installed, you can directly run scripts from the internet using their URL. Sounds dangerous, but Deno is a sandbox system which asks for permissions to read/write resources by default. Check that you have successfully installed Deno, by executing deno --version in a terminal (e.g. in the 'Command Prompt' program in Windows).
  2. Install elbisaur with the following command: deno install --allow-env=LB_USER,LB_TOKEN,ELBISAUR_LISTEN_TEMPLATE --allow-net=api.listenbrainz.org,musicbrainz.org --allow-read --allow-write https://deno.land/x/listenbrainz/cli/elbisaur.ts It looks more complex than it really is because of all the permission arguments.
  3. Try executing elbisaur it should show the help... and complain about a missing LB_TOKEN.
  4. Get your token from https://listenbrainz.org/settings/
  5. Create a text file called .env in a empty folder, where you will be storing the list of listens for deletion. In that text file write a single line, LB_TOKEN = xxx (xxx is your token from step 4).
  6. In your terminal, navigate to that folder (example command for navigating to a folder: cd Admin\ListenBrainz).
  7. Run elbisaur again, it should find the token and complain no more.
  8. Run elbisaur history to show your most recent listens.
  9. The next step is to download (and thus backup) the list of listens that we are going to delete. We will specify the time range of these listens. The command will be something like elbisaur history --user username --after "2024-01-23 12:34:56" --before "2024-01-24 12:34" --count 200 We need the time of the first and the last bad listen (in your timezone). And count, if you are deleting a lot of listens - the API only returns 25 by default. Modify and run the command until the results contain all the listens you want to delete.
  10. Then, run the command again but append --output bad_listens.jsonl to store the list in a file.
  11. Now you have a backup (because you can always re-submit any listens from that list/file) and we can pull out the delete command. It only deletes listens from a file, so you can't accidentally delete listens for which you don't have a backup. The command to preview the deletes is elbisaur delete --preview bad_listens.jsonl
  12. Removing --preview will run it for real, which takes a while as the API requires one request per delete and is rate-limited. Run it when you are ready, and then check the website for results. You may have to wait until the full hour before the deleted listens finally disappear from ListenBrainz.