Skip to content

Instantly share code, notes, and snippets.

@ObjectBoxPC
Created June 5, 2025 09:25
Show Gist options
  • Save ObjectBoxPC/12e49f7939fb42dba2c062f62d8c5df8 to your computer and use it in GitHub Desktop.
Save ObjectBoxPC/12e49f7939fb42dba2c062f62d8c5df8 to your computer and use it in GitHub Desktop.
Convert and play a playlist originally created for Rockbox
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: $0 [playlist]" >&2
exit 1
fi
PLAYLIST_FILE=$1
if ! [ -f "$PLAYLIST_FILE" ]; then
echo "$PLAYLIST_FILE is not a file" >&2
exit 1
fi
STORAGE_ROOT=/example/path/to/microsd/mount
PLAYER=vlc
PLAYLIST_NAME=$(basename "$PLAYLIST_FILE" | sed 's/\.[^\.]*$//')
TEMP_PLAYLIST_FILE=$(mktemp -t "$PLAYLIST_NAME.XXXXXXXXXX.m3u8")
sed -e "s#/<microSD1>#$STORAGE_ROOT#" -e 's/^\xEF\xBB\xBF//' < "$PLAYLIST_FILE" > "$TEMP_PLAYLIST_FILE"
$PLAYER "$TEMP_PLAYLIST_FILE"
rm "$TEMP_PLAYLIST_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment