Skip to content

Instantly share code, notes, and snippets.

@cbuck
Last active October 7, 2015 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbuck/3106274 to your computer and use it in GitHub Desktop.
Save cbuck/3106274 to your computer and use it in GitHub Desktop.
get current album art from playing track from Rdio app.
set RdioArtworkFolder to ((path to home folder) as text) & "Pictures:Rdio:" as alias
set ArtworkFromRdio to ((path to home folder) as text) & "Pictures:Rdio:FromRdio:albumArt.tiff" as alias
set RdioArtwork to ((path to home folder) as text) & "Pictures:Rdio Artwork:FromRdio:albumArt.tiff"
set RdioBackground to ((path to home folder) as text) & "Pictures:Rdio Artwork:FromRdio:black_background.png"
set DefaultArtwork to ((path to home folder) as text) & "Pictures:RdioArtwork:Default:albumArt.tiff"
set DefaultBackground to ((path to home folder) as text) & "Pictures:Rdio:Default:transparent_background.png"
set displayArtwork to ((path to home folder) as text) & "Pictures:Rdio:albumArt.tiff"
set displayBackground to ((path to home folder) as text) & "Pictures:Rdio:background.png"
set FromRdioFolder to ((path to home folder) as text) & "Pictures:Rdio:FromRdio:"
set ArtworkFromRdio to FromRdioFolder & "albumArt.tiff" as alias
set RdioPlaying to "false" as text
set whichArt to "blank"
tell application "System Events"
if exists process "Rdio" then -- Rdio is running
tell application "Rdio"
set aTrackArtwork to artwork of current track
set RdioPlaying to "true" as text
end tell
if RdioPlaying is "true" then
tell current application
set fileRef to ¬
(open for access ArtworkFromRdio with write permission)
write aTrackArtwork to fileRef
close access fileRef
(* Convert to Tiff *)
tell application "Finder" to set creator type of ArtworkFromRdio to "????"
tell application "Image Events"
set theImage to open ArtworkFromRdio
save theImage as TIFF in RdioArtworkFolder with replacing
end tell
end tell
set whichArt to "Rdio"
end if
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment