Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

The Unix master generates a playlist

The Unix master wanted to create a playlist of music, so he wrote a small script.

files/2024/listings/generate-all.sh (Source)

#!/usr/bin/env sh
find /mnt/public/Music/Christmas/ ! \( \
   -ipath '*/Various/*' \
   -o -ipath '*/Other Artist To Skip/*' \
\) -name '*.mp3' | sed -r -e 's@^@file://@;' -e 's@ @%20@g;' | shuf > /mnt/public/Music/Christmas/all-christmas.m3u

These playlists work for VLC on a system with the correct paths mounted with nfs. But since the Unix master also wanted playlists that Jellyfin/Finamp could use, he farmed out the job to a Unix noob.

files/2024/listings/make-relative-playlist.sh (Source)

#!/bin/sh
# Startdate: 2024-10-17-5 09:52
# Purpose: facilitate converting an m3u playlist to relative paths for Jellyfin/Finamp to play well
# Usage:
#    < input.m3u make-relative-playlist.sh > input-relative.m3u
sed -r -e 's@file:///mnt/public/Music/@@g;'

Comments