Generates and manages static html of mpd currently playing music.

git clone git://watertao.xyz/programs/mpdhh.git

README (3725B)

mpdhh

mpd history html

Usage

mpdhh.sh 0 > Update data & site
mpdhh.sh 1 > stdout current track
mpdhh.sh 2 > update historia only
mpdhh.sh 3 > update analysis only
mpdhh.sh 4 > initiate directory tree

Disable site updates: export MPDHH_PUBLISH=“n” mpdhh.sh

Description

Generates and manages static html of mpd currently playing music.

Uses mpc to fetch current track from mpd, generates playlist, manages history and analyses. Static html file generation. With every mpd track change, db files are modified or generated, and html is rendered.

By default the html is rendered as hugo content files. This can be modified by editing the *tmpl.md files.

Although this program aspires for independence from hugo, it is so far only a yearning. Some bits in the sh script modify hugo meta. As I currently seek to migrate away from hugo, this is likely to be addressed upon that move. In the meatime, this is really a hugo only situation. It is a work in progress.

If you are a friend or person who somehow landed on this README file, and you do not have any idea what the shell I’m talking about with terms such as awk, sed, grep, shell, or mpd, feel free to explore, but only if you are bored. If you are a person running unix/linux based systems and comfortable on the command line, this is for you. I share this freely, without license, into the domain of the world, for people to learn from. Perhaps you wish to get your hands dirty with awk and have only dabbled. I’m one of five very strange people who write awk scripts as a hobby. I’ve learned form doing of course, but I’ve immensely gained from others sharing their work. That inspires me a lot. Sharing. Open source.

The music section of my site is managed entirely with mpdhh/hugo. It is run mostly from a pinephone running sxmo on postmarketos. It also runs happily on musl Void in a rather suckless environment.

Requirements

Notes

“example.com” is a hugo project dir. Doesn’t have to be hugo ( actually, it needs to be for now, see Description above ). mpdhh looks for and runs a ‘publish.sh’ file in the project dir. It is in this file one runs all the cms commands to update a website. A simple one-liner gets it done for a git managed hugo setup:

hugo && git add . && git commit && git push

This program assumes the following tree: (run mpdhh.sh 4 to create the tree)

project/
---- content/
-------- music/
------------ _index.[html|md]
------------ analysis/
---------------- _index.[html|md]
---------------- tracks/
-------------------- _index.[html/md]
-------------------- tracks.db
---------------- artists/
-------------------- _index.[html|md]
-------------------- artists.db
------------ db/
---------------- [date].db
------------ historia/
---------------- _index.[html|md]
---------------- db.index
---------------- [date_bin]/
-------------------- _index.[html|md]

Important hugo note: In light of mpdhh independence from hugo, the following menu bit needs to be injected into the project’s hugo config file (e.g. hugo.yaml) for the usage of “Analysis” menus:

menus:
 analysis:
   - name: Artists
     pageRef: /music/analysis/artists
   - name: Tracks
     pageRef: /music/analysis/tracks
 artists:
   - name: Artist
     pageRef: /music/analysis/artists/by-artist
   - name: Play Count
     pageRef: /music/analysis/artists/by-play-count
 tracks:
   - name: Artist
     pageRef: /music/analysis/tracks/by-artist
   - name: Track
     pageRef: /music/analysis/tracks/by-track
   - name: Play Count
     pageRef: /music/analysis/tracks/by-play-count