dougscripts.com

Spotify

March 4 2015 - 7:06 pm

Spotify Artwork

Remember that script I posted a while back that exports the currently playing iTunes track's artwork?

Well, this one works with Spotify's desktop app:

tell application "Spotify"

try

if player state is not stopped then

set alb to (get album of current track)

set rawData to (get artwork of current track)

else

return

end if

on error

display dialog "Problem getting track info." buttons {"OK"}

return

end try

end tell

try

set baseLoc to choose folder

on error

return

end try

set newPath to ((baseLoc as text) & (my replaceChars(alb, ":", "_")) & ".tiff") as text

try

set fileRef to (open for access newPath with write permission)

write rawData to fileRef starting at 0

tell me to close access fileRef

on error m number n

log n

log m

try

tell me to close access fileRef

end try

end try

on replaceChars(txt, srch, repl)

set text item delimiters to srch

set item_list to every text item of txt

set text item delimiters to repl

set txt to item_list as string

set text item delimiters to ""

return txt

end replaceChars

Spotify has a pretty basic sdef but you can get some info from the current track, including artwork.

Site contents © 2001 - 2019 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not interrupt the one doing it.