ListenBrainz File Parser - Submit your listen files to ListenBrainz

I saw that my program has been gaining some attention, so I figured I’d make a post about it - ListenBrainz File Parser. This program takes a file that holds listens, and submits them to ListenBrainz! It should be semi-easy to setup and run, and if you have a filetype that isn’t currently supported, send me over a sample file and I’ll work on adding it!
Cheers y’all!

8 Likes

Updated to add Jellyfin playback_reporting support

Would it be possible to add support for Spotify extended history?

Here is a guide that mentions how to get it into last.fm which has some helpful information

And a stats.fm doc on it to import it there with more information.

And when you get it they send a PDF that contains some info including the JSON structure

Audio
{
"ts": "YYY-MM-DD 13:30:30",
"username": "_________",
"platform": "_________",
"ms_played": _________,
"conn_country": "_________",
"ip_addr_decrypted": "___.___.___.___",
"user_agent_decrypted": "_________",
"master_metadata_track_name": "_________,
“master_metadata_album_artist_name:_________”,
“master_metadata_album_album_name:_________",
“spotify_track_uri:_________”,
"episode_name": _________,
"episode_show_name": _________,
“spotify_episode_uri:_________”,
"reason_start": "_________",
"reason_end": "_________",
"shuffle": null/true/false,
"skipped": null/true/false,
"offline": null/true/false,
"offline_timestamp": _________,
"incognito_mode": null/true/false,
}
Video
{
"ts": "YYY-MM-DD 13:30:30",
"username": "_________",
"platform": "_________",
"ms_played": _________,
"conn_country": "_________",
"ip_addr_decrypted": "___.___.___.___",
"user_agent_decrypted": "_________",
"master_metadata_track_name": _________,
"master_metadata_album_artist_name": _________,
"master_metadata_album_album_name": _________,
“spotify_track_uri:_________”,
"episode_name": "___________________________",
"episode_show_name": "__________________",
“spotify_episode_uri:_________”,
"reason_start": "_________",
"reason_end": "_________",
"shuffle": null/true/false,
"skipped": null/true/false,
"offline": null/true/false,
"offline_timestamp": _________,
"incognito_mode": null/true/false,
}
And field info

Technical field - Contains
ts: This field is a timestamp indicating when the track stopped
playing in UTC (Coordinated Universal Time). The order is
year, month and day followed by a timestamp in military time
username: This field is your Spotify username.
platform: This field is the platform used when streaming the track (e.g.
Android OS, Google Chromecast).
ms_played: This field is the number of milliseconds the stream was
played.
conn_country: This field is the country code of the country where the stream
was played (e.g. SE - Sweden).
Ip_addr_decrypted: This field contains the IP address logged when streaming the
track.
user_agent_decrypted: This field contains the user agent used when streaming the
track (e.g. a browser, like Mozilla Firefox, or Safari)
master_metadata_track _name: This field is the name of the track.
master_metadata_album_artist_name: This field is the name of the artist, band or podcast.
master_metadata_album_album_name: This field is the name of the album of the track.
spotify_track_uri: A Spotify URI, uniquely identifying the track in the form of
“spotify:track:”
A Spotify URI is a resource identifier that you can enter, for
example, in the Spotify Desktop client’s search box to locate
an artist, album, or track.
episode_name: This field contains the name of the episode of the podcast.
episode_show_name: This field contains the name of the show of the podcast.
spotify_episode_uri: A Spotify Episode URI, uniquely identifying the podcast
episode in the form of “spotify:episode:”
A Spotify Episode URI is a resource identifier that you can
enter, for example, in the Spotify Desktop client’s search box
to locate an episode of a podcast.
reason_start: This field is a value telling why the track started (e.g.
“trackdone”)
reason_end: This field is a value telling why the track ended (e.g.
“endplay”).
shuffle: This field has the value True or False depending on if shuffle
mode was used when playing the track.
skipped: This field indicates if the user skipped to the next song
offline: This field indicates whether the track was played in offline
mode (“True”) or not (“False”).
offline_timestamp: This field is a timestamp of when offline mode was used, if
used.
incognito_mode: This field indicates whether the track was played in incognito
mode (“True”) or not (“False”).

1 Like

FWIW, We intend to add Spotify extended history import support directly in LB. Import from spotify extended streaming history by amCap1712 · Pull Request #1800 · metabrainz/listenbrainz-server · GitHub

I had also looked into importing Apple Music data a while ago but last I checked the data they returned was missing the timestamp field. If that’s available now, we could add support for it too.

6 Likes

I think a useful feature (either for the file parser or the official support) would be to let you set a cutoff date. i.e. you only want to import Spotify listens before the date you connected Spotify to ListenBrainz

edit: that or better duplicate detection on ListenBrainz…

3 Likes

made a ticket for this, cause I’d really like this feature (at least until it’s implemented into ListenBrainz itself, but even then, these file do contain IP addresses and whatnot, so some might not like sending that over the internet)

1 Like