How to submit listening data via command line?

listenbrainz
Tags: #<Tag:0x00007f23c251bcf0>

#1

Hello,
I was looking into a way to submit listening data from my dlna server to listenbrainz.
The mediaserver (minimserver) does not record listening data but If I watch the logfiles I can extract the files that are being served. feeding these files to beets I can extract the recording mbid (or whatever would be best to submit?) and build a submit listen JSON document as described here [1]. However since I’m not familiar with JSON I have no idea how to get this to the listenbrainz server with authentication and so on. Is there a easy way to make this work?
or is there a helper-script that I can submit data with?
best,

[1] https://listenbrainz.readthedocs.io/en/latest/dev/json.html#submission-json


#2

create a json blob such as the example and write this to json.txt https://listenbrainz.readthedocs.io/en/latest/dev/json.html#submission-json

You can then send this file using curl:
curl -d @json.txt -H “Authorization: token xxxxxx” --header “Content-Type:application/json” https://api.listenbrainz.org/1/submit-listens