From e1fe3c7c3ef7efcc82c537a647cfab6e65d532fb Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 20 Dec 2015 12:44:58 +0100 Subject: initial commit --- soundcloud | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 soundcloud diff --git a/soundcloud b/soundcloud new file mode 100755 index 0000000..9e827cc --- /dev/null +++ b/soundcloud @@ -0,0 +1,82 @@ +#! /bin/sh + +# Url Page -> Eff Play +play_stream() { + echo "play: $1" + mpv "$(get_streams "$1" | head -1)" + play_stream "$(next_stream "$1")" +} + +# Url Page -> Url Page +next_stream() { + get_related "$1" | head -1 +} + +# Url Page -> Streams +get_streams() {( + streams_url=$(streams_url "$(get "$1")") + get "$streams_url" | jq -r 'to_entries[] | "\(.key) \(.value)"' | grep -v ^preview | awk '{print$2}' +)} + +# Url Page -> [Url Page] +get_related() {( + page_url=$1 + track_path=${page_url#https://soundcloud.com} + related_url=$1/recommended + related=$(get "$related_url") + echo "$related" | sed -n 's/