/lastfm-archiver

create archives of lastfm scrobbles

Primary LanguagePythonMIT LicenseMIT

lastfm-archiver

made-with-python

This is a script that creates json archives of lastfm scrobbles.

It's your listening data and, well, what happens if/when LastFM goes away?

This requires a LastFM api_key, you can request one here. Naturally, a LastFM account is required.

Not currently available on PyPi, install from releases or read below for installation after cloning.


Usage

Usage: lastfm-archiver [OPTIONS] COMMAND [ARGS]...

  LastFM Archiver

Options:
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.

  --help                          Show this message and exit.

Commands:
  init  Initialize the archiver with a lastfm username, api key, and a path...
  run   Run archiving job.

Commands:

init

Usage: lastfm-archiver init [OPTIONS]

  Initialize the archiver with a lastfm username, api key, and a path to put
  archive json files. Also optionally specify the earliest year to look back
  (default 2010)

Options:
  --username TEXT
  --api-key TEXT
  --archive-path TEXT   (absolute) path to directory to store archive json
                        files  [default: /Users/damola/Library/Application
                        Support/lastfm-archiver/archive]

  --earliest-year TEXT  the earliest year to start fetching scrobbles from
                        [default: 2010]

  --help                Show this message and exit.

run

  Usage: lastfm-archiver run [OPTIONS]

  Run archiving job. Will fetch all years, skipping already archived years.
  Scrobbles for current year will be merged into the json archive for the
  current year.

Options:
  --help  Show this message and exit.

Configuration:

  • the script uses a config.ini file to store username and other settings (passed at init).
  • config.ini file location is determined by typer

Development

  • Built with typer. Thanks to it, I only write code and have messages, colors and everything else, for cheap.

  • Package management with poetry - follow the installation guide before running the commands listed.

poetry shell && poetry install - this installs all depencies as well as the script as defined in the pyproject.toml.

Installation

To install globally/user,

  • create a wheel file: poetry build
  • The wheel file (in dist/*.whl) can be installed using pip or better yet pipx.