summaryrefslogtreecommitdiffstats
path: root/app-misc/ds-scripts/files/m3u
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-09-01 00:00:32 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-09-01 00:00:32 +0200
commitca9627e70852f6b2e835660df870fe3ab405882d (patch)
tree0a008b1d5b16fa0679a195ed7b5662c7891f591c /app-misc/ds-scripts/files/m3u
downloaddarklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.gz
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.bz2
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.xz
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.zip
Initial import
Diffstat (limited to 'app-misc/ds-scripts/files/m3u')
-rwxr-xr-xapp-misc/ds-scripts/files/m3u48
1 files changed, 48 insertions, 0 deletions
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 ] <playlist.m3u> [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