last-fm-tools

command module
v0.0.0-...-5704353 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

Command-line tools that fetch a user's listening history from last.fm and perform analysis on it (e.g. what was I listening to last October?).

Usage

First, run update to fetch data from last.fm. This data is stored in a local SQLite database. Then, you can run the analysis commands top-artists and top-albums to get the top artists and albums for a given time period. Usage for these commands looks like:

$ last-fm-tools top-artists 2020-01 --user=foo
$ last-fm-tools top-albums 2020-01-01 2020-02-01 --user=foo --number=20

Configuration

Configuration options

  • api_key and secret come from [https://www.last.fm/api/account/create]. Note that last.fm doesn't save these values, so you'll need to put them somewhere safe (e.g. the config file mentioned below, or a password manager).
  • user is the last.fm username.
  • database is the path to the sqlite database file.
  • sendgrid_api_key (optional) is the API key for SendGrid, used for sending email reports
  • from (optional) is the email address to send reports from

These may be specified either as normal flags, or as configuration options in $HOME/.last-fm-tools.yaml, forex:

database: "$HOME/lastfm.db"
api_key: ""
secret: ""
sendgrid_api_key: ""
from: "[email protected]"

Building

This project uses bazel for building. It's the only required dependency. To build and run directly using Bazel:

$ bazel run //:last-fm-tools -- update --user=foo --database=$HOME/lastfm.db

To run tests:

$ bazel test //...

Updating dependencies

To update dependencies edit [go.mod], and then run Gazelle:

bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
bazel run //:gazelle

Documentation

Overview

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
internal
migration
Package migration is generated by Bazel.
Package migration is generated by Bazel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL