command-line client for live365.com streams
authorThorsten Glaser <tg@mirbsd.org>
Sun, 29 Jul 2012 17:49:39 +0000 (17:49 +0000)
committerThorsten Glaser <tg@mirbsd.org>
Sun, 29 Jul 2012 17:49:39 +0000 (17:49 +0000)
‣ needs inline-editing for credentials
  • needs a user account on their site
  • works with free and VIP accounts both

only slightly edited from the source, not mirified

bash-ksh/L365 [new file with mode: 0644]

diff --git a/bash-ksh/L365 b/bash-ksh/L365
new file mode 100644 (file)
index 0000000..fb9778c
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/mksh
+# $MirOS: contrib/hosted/tg/L365,v 1.1 2012/07/29 17:48:01 tg Exp $
+#-
+# Player for music streams from live365.com (not affiliated).
+
+# Inline-edit this script to define your credentials:
+USERID='myusername'
+PASSWD='my!secret!'
+
+# Code follows.
+
+# disabled as mpg123 with live365 is too unreliable (lack of caching)
+#if [[ $1 = -m ]]; then
+       player='mplayer -cache 256'
+#      shift
+#else
+#      player=mpg123
+#fi
+
+STATION=$1
+
+cd /
+if ! T=$(mktemp -d /tmp/L365.XXXXXXXXXX) || [[ ! -d $T/. ]]; then
+       print -u2 Error creating temporary directory.
+       exit 255
+fi
+
+cd "$T"
+if ! curl --cookie-jar curlcookies --output curldump --location-trusted \
+    "http://www.live365.com/cgi-bin/login.cgi?url=http://www.live365.com/index.live&membername=${USERID}&password=${PASSWD}"; then
+       cd /
+       rm -rf "$T"
+       print -u2 Error logging in.
+       exit 2
+fi
+
+SANE=$(fgrep SaneID curlcookies | cut -f7)
+SESS=$(fgrep sessionid curlcookies | cut -f7 | sed "s/${USERID}%3A//")
+
+cd /
+rm -rf "$T"
+
+exec $player "http://www.live365.com/play/${STATION}?SaneID=${SANE}&membername=${USERID}&session=${SESS}"