Import for specified date/time range

Tags: #<Tag:0x00007f41a022cea8> #<Tag:0x00007f41a022cdb8>

A while back, I implemented parallel listen reporting to ListenBrainz and on my devices. Well, today I discovered that one device was only sending to A new full import would end up duplicating listens from the time I started the parallel, I’m sure. Would there be a way to import only a given date or date-time range?

Hi @dkg!
I am almost sure that LB will handle it just fine. The way it works is that all track_name and listened_at timestamp pairs are unique for a given user. That is if you try to submit a listen which has the same track_name and listened_at timestamp as an already existing listen for that user, LB will ignore it.

Hence, The only way these listens could get duplicated is if the player you used to submit listens to and LB sent different listened_at times to the two services or if modified the track name.

Having said that, we can probably look into adding a feature to let users import listens in the their selected time frame.

1 Like

The listens were submitted by two different foobar2000 plugins. I don’t think it’s guaranteed they used the exact same values for listened_at. I don’t want to make a mess of things by trying it and finding out a year’s worth of listens are duplicated! Can you point out a way I can verify whether the timestamps match? I’m willing to do some of my own hacking with scripts or whatnot.

The “My Listens” page has a calendar at the bottom which you can use to navigate to an exact time and date. The page will then show listens submitted around that point of time. You can hover on the datetime of a particular listen to view the exact timestamp of the listen. But I am not sure how you can view those times in LFM UI.

If you can do some scripting, then you can also use LB API to fetch the listens stored in LB and similarly get your LFM listens using LFM’s API. Then compare the listened_at and track_name pairs and see if there are any differences. If you decide to go the scripting route, feel free to hop in the #metabrainz IRC channel. I’ll try my best to help you out.

If you have also sent everything to you could also clear all of your LB listens and do a full import from

I’m not sure if this any loses info compared to the listens sent directly to LB?

I believe that will drop the MBIDs, i.e., they would no longer be linked to artists and recordings.