#!/bin/bash

old_meta=""
while :
do
    if [ "$(playerctl status)" = "Playing" ]
    then
        new_meta=$(playerctl metadata)
        if [ "$new_meta" != "$old_meta" ]
        then
            echo $new_meta > ~/.conky/music/meta
            old_meta=$new_meta
        fi
    else
        new_meta=''
        if [ -e ~/.conky/music/meta ]
        then
            rm ~/.conky/music/meta
        fi
    fi
    sleep 1
done 