/somafm-song-history

Application that displays or saves SomaFM's song history.

Primary LanguageJava

somafm-song-history

Application that retrieves and prints SomaFM's recently played songs in the console, or save it to a database.

Please support SomaFM's awesome work here.

About

This project is developed for my personal use, but I'll be glad to help if you encounter any issue.

My goal is to build and browse a personal database of songs played by SomaFM, and as an ambient fan, especially Drone Zone.

As stated on this page:

SomaFM API is no longer available to third parties

Thus this application works by parsing SomaFM's "Recently Played Songs" page (example here).

Usage

Two arguments must be provided to the application: an action (display or save) and a channel (e.g. Groove Salad). The channel name is its public name, available on this page.

display mode

Configuration file

Prepare a configuration file in HOCON format:

config {
  somaFmBaseUrl = "https://somafm.com/"
  userAgent = "choose-a-user-agent"
  timezone = "choose-a-timezone"
}

Option 1: Docker

Run a container with the latest image:

docker run -it -v /absolute/path/to/application.conf:/application.conf alecigne/somafm-song-history "display" "Drone Zone"

The Docker image is hosted on DockerHub.

Option 2: Jar file

Download the jar (or build it from source), then run:

java -jar -Dconfig.file=/path/to/application.conf somafm-song-history.jar "display" "Drone Zone"

save mode

Database

If you use save mode, you will need a PostgreSQL database. This can be achieved using Docker and the PostgreSQL official image:

docker run \
--name somafm-song-history-db \
-e POSTGRES_PASSWORD=mysecretpassword \
-p 5432:5432 \
-d postgres

The default user is postgres.

Configuration file

Prepare a configuration file in HOCON format:

config {
  somaFmBaseUrl = "https://somafm.com/"
  userAgent = "choose-a-user-agent"
  timezone = "choose-a-timezone"
  db {
    url = "jdbc:postgresql://localhost:5432/postgres"
    user = "postgres"
    password = "mysecretpassword"
  }
}

Option 1: Docker

Run the container with your credentials of choice:

docker run -it -v /absolute/path/to/application.conf:/application.conf --net=host alecigne/somafm-song-history "display" "Drone Zone"

Note the --net=host option.

The Docker image is hosted on DockerHub.

Option 2: Jar file

Download the jar (or build it from source), then run:

java -jar -Dconfig.file=/path/to/application.conf somafm-song-history.jar "display" "Drone Zone"

(with Java 17)

Known bugs

Check them here.