#!/bin/bash # convert m3u files to pretend json for webamp for i in *.m3u ; do cat $i | jc --m3u | jq . | grep -v "tvg-logo\|group-title\|runtime" | sed -e 's/"path"/url/g' -e 's/"display"/metaData:{title/g' -e 's/",/"},/g' > A-$i.txt ; done # prepare prefix and suffix so the for loop can used # copy this line to a file named prefix.txt #
# could not find a way to echo these lines without issues # look here for refrence # https://github.com/captbaritone/webamp/blob/master/examples/minimalMilkdrop/index.html # create html files for i in A-*.txt ; do cat prefix.txt $i suffix.txt > $i.html ; done # remove A- and triple extensions in the html files for i in *.html ; do mv "$i" "`echo $i | sed -e 's/A-//' -e 's/.m3u.txt//'`" ; done # optional: minify html files for i in *.html ; do minify -o out/$i $i ; done