Thursday, January 21, 2016

Spotify Wallpaper Changer

Like I said, I'm not a programmer.  A little background on that, I had one C++ class in college and I got a C-, ironically.  Pages of code to accomplish what others could perform in less than two dozen lines.  I'm not good at it.

Still I've managed to muddle my way through Tasker to create some profiles, this one being my favorite.  Some people want to change the world, I just want to change wallpapers to look cool.

I'll post the description, and what I *think* is going on, how to configure everything that you need to get there because I believe for the rest of you who are also not programmers can learn from them to build other profiles.

This basically will change your wallpaper to the album of your currently playing track in Spotify.  First, here is the end result we're going for (do not judge my taste of music :p );



















To get here, you need these apps;
Tasker
Spotify
Media Utilities (Beta)

First Media Utilities Setup;
Add "Spotify" to the available media apps it can use.  Then go into 'Settings' and uncheck everything except the boxes for "Attempt Direct Control" and "Make Album Art Available"

You will also need an Exit Task.  This will get you back to your default wallpaper when either a track is stopped or headphones unplugged.  I suspect this will also work if you don't include the Headset Plugged profile state.  I think I left that so it didn't launch every time something else called media, like an ad.

The exit task is it's own separate task, as opposed to an anon one in the profile because I use that for other wallpaper changing profiles.  That way i only have to change it in one place if I get tired of my default wallpaper.  Everyone should always have a default wallpaper task because you'll want it sooner or later.

What this does is, look for the headset plugged in, and the media state is playing.  Once that third condition is met (New Metadata), it copies the default Media Utility album art file (mu_coverart_current.jpg) to a new file.  It then sets that copied file as the wallpaper.  This will repeat every time the track changes.  When either music is paused, stopped, or the headphones are unplugged it will revert back to your default.

Sometimes when you pause, then skip to start the next track it slips.  I get around that by not pausing then skipping to the next track.

Anyway, here is your profile;

Profile: App Spotify Wallpaper (6)
State: Media Utilities State [ Configuration:New Metadata ]
State: Media Utilities State [ Configuration:Is Playing ]
State: Headset Plugged [ Type:Any ]
Enter: Anon (42)
A1: Copy File [ From:Pictures/mu_coverart/mu_coverart_current.jpg To:Pictures/coverart Use Root:Off ]
A2: Set Wallpaper [ Image:Pictures/coverart/mu_coverart_current.jpg Scale:Off Crop:Off ]

Exit: Wallpaper Reset (45)
A1: Set Wallpaper [ Image:zedge/wallpaper/Bamboo-wallpaper-8639973.jpg Scale:Off Crop:Off ] If [ %MTRACK !Set ]

These are changes from local files because I download my playlists.  If you are playing from the server you might have to add a Wait period of a second or two before the 'Set' command so it can get the album art.

You can download this profile here: Spotify Wallpaper Change

Enjoy!

No comments:

Post a Comment