From ca9627e70852f6b2e835660df870fe3ab405882d Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 1 Sep 2019 00:00:32 +0200 Subject: Initial import --- app-misc/ds-scripts/files/m3u | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 app-misc/ds-scripts/files/m3u (limited to 'app-misc/ds-scripts/files/m3u') diff --git a/app-misc/ds-scripts/files/m3u b/app-misc/ds-scripts/files/m3u new file mode 100755 index 0000000..e5496a5 --- /dev/null +++ b/app-misc/ds-scripts/files/m3u @@ -0,0 +1,48 @@ +#! /bin/bash + +if [ -z "$1" ] +then + echo "Usage: m3u [ -f encoding -p encoding ] [random]" + exit +fi + +if [ "$2" = "random" ] +then + prm="-Z -z" +else + prm="" +fi + +FSE=`cat /etc/m3u.conf | grep FSEncoding | sed s/'^[ \t]*FSEncoding[ \t]*=[ \t]*'//g | sed s/'[ \t]*'$//g` +PLE=`cat /etc/m3u.conf | grep PLEncoding | sed s/'^[ \t]*PLEncoding[ \t]*=[ \t]*'//g | sed s/'[ \t]*'$//g` + +pl=1 +while getopts 'f:p:' OPT; do + pl=`expr $pl + 2` + case $OPT in + f) + FSE=$OPTARG + ;; + p) + PLE=$OPTARG + ;; + esac +done + + +pl=`eval echo "\\$${pl}"` + +if [ -z "$FSE" -o -z "$PLE" ]; then + cmd="cat \"$pl\"" +else + cmd="cat \"$pl\" | iconv -f $PLE -t $FSE" +fi + +s=$(eval $cmd | grep -E "\.[mMoOwW][pPgGaA][23gGvV]" | sed s/ //g | sed s/'\\'/'\/'/g | sed s/^/\"/ | sed s/$/\"/ | perl -pi -e 's|\n| |gs' ) + +if [ -n "$prm" ] +then + eval mpg123 $prm "$s" +else + eval zinf "$s" +fi -- cgit v1.2.3