Skip to main content

Export your scrobbling history form ListenBrainz

Project description

listenbrainz_export

Export your scrobbling history form ListenBrainz. ListenBrainz is a public/open-source alternative to RateYourMusic

Since the data is public, no API key/Authentication is required.

Installation

Requires python3.7+

To install with pip, run:

pip install git+https://github.com/seanbreckenridge/listenbrainz_export

Usage

Provide your listenbrainz username -- prints results to STDOUT

listenbrainz_export export seanbreckenridge > ./data.json

Can also only request a few pages:

listenbrainz_export export seanbreckenridge --pages 3

Or can request only recent listens:

listenbrainz_export export seanbreckenridge --days 30

listenbrainz_export.parse includes a model of the data and some functions to parse them into python objects, like:

>>> from listenbrainz_export.parse import iter_listens
>>> listens = list(iter_listens("data.json"))
>>> listens[12]
Listen(track_name='Skate', artist_name='Bruno Mars, Anderson .Paak & Silk Sonic', listened_at=datetime.datetime(2021, 11, 6, 19, 10, 49), inserted_at=datetime.datetime(2021, 11, 7, 2, 12, 31), recording_id='e60b9417-acfe-4796-a048-76208fb4a9ad', release_name='Skate - Single', metadata={'artist_msid': 'df6f6937-5de3-4e3c-bd74-1991ed92abd5', 'recording_msid': 'e60b9417-acfe-4796-a048-76208fb4a9ad', 'release_msid': 'dcf6d703-1e95-4e9c-8218-bb7c3b3bfa0b'}, username='seanbreckenridge')

I use this almost exclusively through my HPI; that locates my exports on disks and removes any duplicate scrobbles

This also includes a playing-now command, which prints the currently playing track, if any:

listenbrainz_export playing-now seanbreckenridge

That returns a JSON list, since you can have multiple songs playing at the same time).

The return code is 0 if there is a song playing, 1 if there is no song playing.

Tests

git clone 'https://github.com/seanbreckenridge/listenbrainz_export'
cd ./listenbrainz_export
pip install '.[testing]'
mypy ./listenbrainz_export
flake8 ./listenbrainz_export

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

listenbrainz_export-0.2.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

listenbrainz_export-0.2.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file listenbrainz_export-0.2.1.tar.gz.

File metadata

  • Download URL: listenbrainz_export-0.2.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for listenbrainz_export-0.2.1.tar.gz
Algorithm Hash digest
SHA256 fb7d67f8ebc1fa84554bde459ee99117f80dd153c24b52e4ba895673916b8b08
MD5 11cb26eedabc3ebebaa0d2b7ee9b845e
BLAKE2b-256 64c91af11c2ef367f6dbe689611d1a707edc713f57abd3490b88d74733a69b63

See more details on using hashes here.

File details

Details for the file listenbrainz_export-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for listenbrainz_export-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d615435e2249ec35fb04a2a72b04577d07ee3f5afe5c797b31ffc5dedee2eadc
MD5 28492cd91998584c678dac2072108a20
BLAKE2b-256 993897f4b099988eaf12c6433cbb385fb0c03660cec4b3c4a728b4163432cc29

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page