Last active
February 20, 2017 15:40
-
-
Save LordAro/15242e42880aa8e6a9e21cf7fba0dd9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -eu | |
# Expects API_KEY from env | |
API_BASE="https://ury.org.uk/api/v2/" | |
MIXCLOUD_BASE="https://www.mixcloud.com" | |
function api_call() { | |
local url="${API_BASE}$1?api_key=${API_KEY}" | |
echo "$(curl -s $url)" | |
} | |
args=$(echo $@ | tr ' ' '+') | |
SHOW_ID=$(api_call "show/searchmeta/${args}" | jq -r '.payload[0].show_id') | |
SEASON_ID=$(api_call "show/${SHOW_ID}/allseasons" | jq -r '.payload[-1].season_id') | |
MIXCLOUDS=$(api_call "season/${SEASON_ID}/alltimeslots" | \ | |
jq -r ".payload[] | |
| select(.mixcloud_status | startswith(\"/\")) | |
| \"\(.title) - \(.first_time) - ${MIXCLOUD_BASE}\(.mixcloud_status)$\"") | |
echo $MIXCLOUDS | tr '$' '\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment