Tools to export, cleanup and re-import?

Context: I had 3 Last.fm accounts I tried to combine covering 2012-ish, 21-22 and 24-25. Unfortunately I added a load of 21 music to the latest last.fm account before finding out I can import everything with the correct original dates into ListenBrainz.

Problem: Now my LB listens/stats are polluted with music I played in 21 duped into 25.

Task: I’ve used a few tools (elbisaur, scotty, sync script) to do importing across. But I wanna CLEAN my data now. I was thinking I’d export everything, delete all the pollution and re-import.

Question: Are there any tools or workflows that you’d recommend for this?

1 Like

Any idea how the wrong listens from the 25 account can be identified? Could they be filtered by timestamp?

elbisaur might help, as it has the ability to modify a listen export before importing it again. But not sure if it could do the specific thing. Never used it. But it has different filtering options.

With scotty (this one I know better, I’m the author) one idea would be that you use it to import one account after the other, but for the 24/25 account you only start at a later timestamp and don’t import the full history. Again this might work if you can filter the duplicate listens from 25 by timestamp somehow.

Or have the listens added to 25 become moved to a totally different time? Then it might become really difficult to identify the duplicates from 21.

2 Likes

I think elbisaur could do this, if the time stamps/data hasn’t changed.

e.g. import the 21 listens into a LB account, and export as a text file. Then import the 25 listens into a different account, and run the profile exported text file on it with a delete listen command to remove all 21 listens. Then import the 21 listens into that account.

But I’m gathering that the timestamps/dates have changed? In that case I don’t think it can be done in the same way… maybe you can find a way to compare two elbisaur-exported text files. Basically if you can identify the rows that are the same (ignoring the timestamp part) you will be able to de-dupe.

2 Likes

Thank you both!! From what you’ve said I managed to work out how to do it and it was simpler than I expected.

There was an artist I knew I hadn’t listened to in 2025 (Combichrist). So I hunted for their listens in ListenBrainz and noticed a huge number submitted on 2025-09-09. This was probs the day I imported scrobbles from an old Last.fm account to the new before importing to LB.

Exporting the history of that entire day it was filled with obviously imported listens where they duplicated and had exactly 1 min between each.

So I just exported the entire day with Elbisaur:

elbisaur history -a 2025-09-08 -b 2025-09-10 -c 9999999 -o crap-09.jsonl

Then I ran delete of those listens:

elbisaur delete crap-09.jsonl

That deleted 1000 listens and has cleaned up all the old duplicated listens.

For completeness sake I noticed that I accidentally removed 15 listens from 8th Sept so I edited crap-09.jsonl to keep the 8th listens and saved as reimport.jsonl before running:

elbisaur import reimport.jsonl

Everything is now tidy and clean. Thank you!

3 Likes