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.
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).
Goals for v0.3:
- Use a scheduler to retrieve history at regular intervals. History cannot be displayed in the console anymore.
- Expose a REST API of recently played songs.
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.
You will need a PostgreSQL database running. This can be achieved using Docker and the PostgreSQL official image:
docker run \
--name postgres-db \
-e POSTGRES_PASSWORD=mysecretpassword \
-p 5432:5432 \
-d postgres
The default user is postgres
.
Run the container with your credentials of choice:
docker run \
-e DB_URL="jdbc:postgresql://localhost:5432/postgres" \
-e DB_USER="postgres" \
-e DB_PASSWORD="mysecretpassword" \
--net=host \
alecigne/somafm-song-history "display" "Drone Zone"
The Docker image is hosted on DockerHub.
Download the Jar (or build it from source), then run:
DB_URL="jdbc:postgresql://localhost:5432/postgres" \
DB_USER="postgres" \
DB_PASSWORD="mysecretpassword" \
java -jar somafm-song-history-0.2.0.jar "display" "Drone Zone"
(with Java 17)
This version only displays the history in the console.
java -jar somafm-song-history-0.1.0.jar "Beat Blender"
(with Java 17)
The channel name is the public name, available on this page. Without a channel, the program will default to Drone Zone.
- On the day of transition from daylight saving time (DST) to standard
time, ambiguous local time values exist between 1:00 AM and 2:00 AM
since this hour happens “twice” locally. As SomaFM’s “song history”
webpage display local times only (example here), computing a correct
UTC broadcast time during this period becomes annoying
(e.g. deciding between DST and standard time for two tracks played
at 01:30 AM).
For the sake of simplicity, all broadcasts during this period are thus listed as being played in the DST timezone (one time correctly, and another time incorrectly during the “second 01:00 AM hour”). This will create a “void” of one hour in a UTC timeline.
Example: on 2021-11-07 at 01:00 AM #1 in Los Angeles, it was 2021-11-07 08:00 AM UTC. On 01:00 AM #2, it was 2021-11-07 09:00 AM UTC. However, no broadcasts will exist at this UTC hour.