#!/bin/bash
d="06"
cl=(AU BR CA DE ES GB IT MX US)
token="BQCFZfJnAXtKsO8YrtGJGd8KMKJGFY6YOkCf3ivFMKBE0GOual-KQuGUqiqQDQ3jFJhI8sPsOCSrOMMORHY"
for c in "${cl[@]}"
do
  flnm="streams_202012${d}_${c}.json"
  u="curl --location --request GET 'https://provider-api.spotify.com/v1/analytics/sonybmgmusicentertainment/enhanced/streams/2020/12/$d/$c' --header 'Authorization: Bearer ${token}' --output ${flnm}.gz"
  echo $u
  #eval $u
  eval "gzip -dv ${flnm}.gz"
  eval "aws s3 cp ${flnm} s3://sme-data-decompressed/spotify/streams/v4/report_date=2020-12-${d}/report_licensor=sme/ && rm ${flnm}"
done
