#!/bin/sh

if [ "$1" == "" ]; then
    echo "Need token"
    exit
fi

if [ "$2" == "" ]; then
    echo "Need date YYYY-MM-DD"
    exit
fi

read Y M D <<< ${2//[-: ]/ }

$(wget -O tracks_$Y$M$D.gz https://ws.spotify.com/analytics/api/theorchardv2/tracks/$Y/$M/$D?oauth_token=$1)
