Coder Social home page Coder Social logo

seanbreckenridge / listenbrainz_export Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 39 KB

Export your scrobbling history from ListenBrainz

Home Page: https://pypi.org/project/listenbrainz-export/

License: MIT License

Python 100.00%
scrobbling music data data-export

listenbrainz_export's Introduction

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

listenbrainz_export's People

Contributors

seanbreckenridge avatar sopoforic avatar

Stargazers

 avatar

Watchers

 avatar  avatar

listenbrainz_export's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.