#!/usr/bin/env bash index=0; media-control stream | \ while IFS= read -r line; do \ musicapp=$(jq -e '.payload.isMusicApp' <<< $line); \ if [ "$musicapp" = true ]; then \ title=$(jq -e '.payload.title' <<< $line); \ artist=$(jq -e '.payload.artist' <<< $line); \ if [ "$title" >/dev/null != null ]; then \ eval "rocksky scrobble $title $artist"; \ echo "rocksky scrobble $title $artist"; \ echo "rocksky scrobble $title $artist" >> cronlog.txt; \ fi \ fi \ done