Improved Spotify Widget

I was able to combine this preset with the lyric display python code mentioned here:
https://community.folivora.ai/t/touchbar-synced-lyric/10498
Here is the github link for the lyric preset portion linked above: https://github.com/ChenghaoMou/touchbar-lyric

It took a little of me fumbling around to get the python portion working but I'm really happy with how it turned out. At the end is me showing off the gesture from BetterTouchTool to change my volume by twisting a "knob" on my touchpad. Sorry for the low video quality and shaky cam.

on name_and_cover(trackName, iPath)
	tell application "BetterTouchTool"
		if iPath contains "offline" then
			update_touch_bar_widget "582B6183-8FDA-464A-81BC-A222636D5E19" text trackName
		else
			update_touch_bar_widget "582B6183-8FDA-464A-81BC-A222636D5E19" text trackName icon_path iPath
		end if
	end tell
end name_and_cover

set iconPath to "~/Library/Application Support/BetterTouchTool/spotify_cover.png"
if application "Spotify" is running then
	try
		tell application "Spotify"
			try
				set artworkURL to artwork url of current track
				do shell script "curl " & artworkURL & " -o ~/Library/Application\\ Support/BetterTouchTool/spotify_cover.png"
			on error number 6
				set iconPath to "offline"
			end try
			
			if player state is playing then
				set trackTitle to ((get name of current track) & " - " & (get artist of current track))
				if length of trackTitle is less than 27 then
				set lyrics to do shell script "/usr/local/bin/python3.7 -m touchbar_lyric"
					set displayTitle to trackTitle
					
					set displayTitle to displayTitle & "
" & lyrics
my name_and_cover(displayTitle, iconPath)
					
				else
					set lyrics to do shell script "/usr/local/bin/python3.7 -m touchbar_lyric"
					set displayTitle to text 1 thru 27 of trackTitle & "..."
					set displayTitle to displayTitle & "
" & lyrics
					my name_and_cover(displayTitle, iconPath)
				end if
			else
				my name_and_cover("||", "")
			end if
			
		end tell
	end try
else
	return ""
end if