@yuuiko would you be able to paste the script to the now playing widget specific to Spotify from AquaTouch? For some reason, the song title and artist would show up for about 5 seconds then disappear from the touch bar completely. I began to fiddle with the script, but have gone in over my head.. If I could get the original script from the preset to copy in that'd be super helpful.
Sorry for the late reply and thanks for the bump!! I missed this one...
I've had some users with the same issue and I took a quick look, from that it seems the fault is on spotify, it appears to only be reporting the song in the first few seconds then returns a blank
It was a quick look though and I'm very busy right now so I didn't get to go much deeper
If you get anything workin do let me know!
set haserror to false
if application "Spotify" is running then
try
tell application "Spotify"
try
if player state is playing then
set sName to (get name of current track)
set sArtist to (get artist of current track)
--return sArtist
if sArtist is not "" then
set nowPlaying to sName & " — " & sArtist
else
set nowPlaying to sName
end if
set artworkURL to artwork url of current track
set fileName to ((((path to application support folder from user domain) as text) & "BetterTouchTool:" as text) & "spotify_cover.png")
set sNamePlist to ""
set sArtistPlist to ""
set plistfile_path to ((((path to application support folder from user domain) as text) & "BetterTouchTool:" as text) & "spotify_playing.plist")
set returnText to "{\"text\":\"" & nowPlaying & "\",\"font_color\":\"0,251,170,255\",\"icon_path\":\"" & (POSIX path of fileName as text) & "\" }"
-- read the plist file
tell application "System Events"
try
if file plistfile_path exists then
tell property list file plistfile_path
tell contents
set sNamePlist to value of property list item "sName"
set sArtistPlist to value of property list item "sArtist"
end tell
end tell
end if
if (sName is sNamePlist) and (sArtist is sArtistPlist) then
--return "Found it!"
return returnText
end if
on error
set haserror to true
end try
end tell
if (sName is not sNamePlist) or (sArtist is not sArtistPlist) then
tell application "System Events"
try
-- create an empty property list dictionary item
set the parent_dictionary to make new property list item with properties {kind:record}
-- create new property list file using the empty dictionary list item as contents
set this_plistfile to ¬
make new property list file with properties {contents:parent_dictionary, name:plistfile_path}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"sName", value:sName}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"sArtist", value:sArtist}
on error
set haserror to true
end try
end tell
do shell script "curl " & artworkURL & " -o ~/Library/Application\\ Support/BetterTouchTool/spotify_cover.png"
return returnText
--return nowPlaying
end if
else
--display infomation while paused
return "{\"text\":\"" & nowPlaying & "\",\"font_color\":\"120,120,120,255\",\"icon_path\":\"" & (POSIX path of fileName as text) & "\" }"
--return returnText & " — Paused"
end if
on error
set haserror to true
end try
end tell
end try
else
return "Spotify"
end if
if haserror is true then
try
if sArtist is not "" then
return "{\"text\":\"" & sName & " — " & sArtist & "\",\"font_color\":\"0,251,170,255\"}"
else
return "{\"text\":\"" & sName & "\",\"font_color\":\"0,251,170,255\"}"
end if
on error
return "Spotify"
end try
end if
Has it been modified?
I'm still suffering from this problem.
No, not yet sorry. Been swimming in assessments latley so haven't gotten the chance for AQT updates... A break might be coming soon but I'm not sure