# listenbrainz_export
Export your scrobbling history form [ListenBrainz](https://listenbrainz.org/). 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`](./listenbrainz_export/parse.py) includes a model of the data and some functions to parse them into python objects, like:
```python
>>> 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](https://github.com/seanbreckenridge/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
```bash
git clone 'https://github.com/seanbreckenridge/listenbrainz_export'
cd ./listenbrainz_export
pip install '.[testing]'
mypy ./listenbrainz_export
flake8 ./listenbrainz_export
```
Raw data
{
"_id": null,
"home_page": "https://github.com/seanbreckenridge/listenbrainz_export",
"name": "listenbrainz-export",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "music scrobble data",
"author": "Sean Breckenridge",
"author_email": "seanbrecke@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/64/c9/1af11c2ef367f6dbe689611d1a707edc713f57abd3490b88d74733a69b63/listenbrainz_export-0.2.1.tar.gz",
"platform": null,
"description": "# listenbrainz_export\n\nExport your scrobbling history form [ListenBrainz](https://listenbrainz.org/). ListenBrainz is a public/open-source alternative to RateYourMusic\n\nSince the data is public, no API key/Authentication is required.\n\n## Installation\n\nRequires `python3.7+`\n\nTo install with pip, run:\n\n pip install git+https://github.com/seanbreckenridge/listenbrainz_export\n\n## Usage\n\nProvide your listenbrainz username -- prints results to STDOUT\n\n```\nlistenbrainz_export export seanbreckenridge > ./data.json\n```\n\nCan also only request a few pages:\n\n```\nlistenbrainz_export export seanbreckenridge --pages 3\n```\n\nOr can request only recent listens:\n\n```\nlistenbrainz_export export seanbreckenridge --days 30\n```\n\n\n[`listenbrainz_export.parse`](./listenbrainz_export/parse.py) includes a model of the data and some functions to parse them into python objects, like:\n\n```python\n>>> from listenbrainz_export.parse import iter_listens\n>>> listens = list(iter_listens(\"data.json\"))\n>>> listens[12]\nListen(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')\n```\n\nI use this almost exclusively through my [HPI](https://github.com/seanbreckenridge/HPI); that locates my exports on disks and removes any duplicate scrobbles\n\nThis also includes a `playing-now` command, which prints the currently playing track, if any:\n\n```\nlistenbrainz_export playing-now seanbreckenridge\n```\n\nThat returns a JSON list, since you can have multiple songs playing at the same time).\n\nThe return code is 0 if there is a song playing, 1 if there is no song playing.\n\n### Tests\n\n```bash\ngit clone 'https://github.com/seanbreckenridge/listenbrainz_export'\ncd ./listenbrainz_export\npip install '.[testing]'\nmypy ./listenbrainz_export\nflake8 ./listenbrainz_export\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Export your scrobbling history form ListenBrainz",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/seanbreckenridge/listenbrainz_export"
},
"split_keywords": [
"music",
"scrobble",
"data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "993897f4b099988eaf12c6433cbb385fb0c03660cec4b3c4a728b4163432cc29",
"md5": "28492cd91998584c678dac2072108a20",
"sha256": "d615435e2249ec35fb04a2a72b04577d07ee3f5afe5c797b31ffc5dedee2eadc"
},
"downloads": -1,
"filename": "listenbrainz_export-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "28492cd91998584c678dac2072108a20",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6734,
"upload_time": "2023-08-10T15:18:32",
"upload_time_iso_8601": "2023-08-10T15:18:32.127489Z",
"url": "https://files.pythonhosted.org/packages/99/38/97f4b099988eaf12c6433cbb385fb0c03660cec4b3c4a728b4163432cc29/listenbrainz_export-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "64c91af11c2ef367f6dbe689611d1a707edc713f57abd3490b88d74733a69b63",
"md5": "11cb26eedabc3ebebaa0d2b7ee9b845e",
"sha256": "fb7d67f8ebc1fa84554bde459ee99117f80dd153c24b52e4ba895673916b8b08"
},
"downloads": -1,
"filename": "listenbrainz_export-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "11cb26eedabc3ebebaa0d2b7ee9b845e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5833,
"upload_time": "2023-08-10T15:18:33",
"upload_time_iso_8601": "2023-08-10T15:18:33.771254Z",
"url": "https://files.pythonhosted.org/packages/64/c9/1af11c2ef367f6dbe689611d1a707edc713f57abd3490b88d74733a69b63/listenbrainz_export-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-10 15:18:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "seanbreckenridge",
"github_project": "listenbrainz_export",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "listenbrainz-export"
}