Generates and manages static html of mpd currently playing music.

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

commit 2ad80e3d533763ef9417b0e1065820ef3199fbbc
parent af10d7ad17d0d2e6d7d64a9d6110fa6afda269e3
Author: Jeff <dev@watertao.xyz>
Date:   Mon, 25 Mar 2024 22:15:07 -0700

README update and variable tweaks

Diffstat:
MREADME | 40+++++++++++++++++++++++++++++++++-------
Mmpdhh.sh | 12+++++++-----
2 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/README b/README @@ -1,19 +1,45 @@ -mpdhh - mpd history html +mpdhh +----- -mpc's current track from mpd, generates playlist, manages history and -analyses. Static html file generation. With every track change, db files -are modified or generated if need be, and html is rendered. +mpd history html -By default the html is rendered as hugo content files. This can be -modified by editing the *tmpl.md files. -Requirements: +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 + + +Function +-------- + +Generates and manages static html of mpd currently playing playlists. + +Uses mpc to fetch current track from mpd, generates playlist, manages history and analyses. Static html file generation. With every track change, db files are modified or generated if need be, and html is rendered. + +By default the html is rendered as hugo content files. This can be modified by editing the *tmpl.md files. + + +Requirements +------------ + mpd mpc posix compliant shell tools: awk/sed/grep/sort hugo or full html markup needed + +Notes +----- + note: watertao.xyz is hugo project bin. Doesn't have to be hugo. Can be whatever. diff --git a/mpdhh.sh b/mpdhh.sh @@ -2,8 +2,10 @@ # Important customization: mpdhh_bin=~/progs/mpdhh -hugo_proj="watertao.xyz" +proj_name="watertao.xyz" work_bin="${HOME}/w/proj" + +proj_bin="${work_bin}/${proj_name}" publish_sh="publish.sh" # All else, modify to your liking @@ -11,7 +13,7 @@ artists="artists" tracks="tracks" index_md_name="_index.html" music_bin_proj_local="content/music" -music_bin="${work_bin}/${hugo_proj}/${music_bin_proj_local}" +music_bin="${proj_bin}/${music_bin_proj_local}" db_bin="${music_bin}/db" historia_bin="${music_bin}/historia" db_index_file="${historia_bin}/db.index" @@ -538,7 +540,7 @@ publish_site(){ # Must change to hugo project bin to run hugo command (in publish.sh) cur_bin="$(pwd)" - cd "${work_bin}/${hugo_proj}" + cd "$proj_bin" [ -f ./"${publish_sh}" ] && sh ./"${publish_sh}" "${commit_msg}" cd "$cur_bin" } @@ -565,14 +567,14 @@ get_date_vars(){ site_git_merge(){ printf "Git fetch && merge...\n" cur_bin="$(pwd)" - cd "${work_bin}/${hugo_proj}" && \ + cd "$proj_bin" && \ git fetch && git merge cd "$cur_bin" } bin_struct(){ # Make the bins - [ ! -d "$work_bin" ] && printf "Please create proj bin, then continue. Exiting.\n" && exit 0 + [ ! -d "$proj_bin" ] && printf "Please create proj bin, then continue. Exiting.\n" && exit 0 __bin_struct "$music_bin" __bin_struct "$db_bin" __bin_struct "$historia_bin"