Smart Google Play Music Liker/Disliker 1.0

Likes or dislikes a song in Google Play Music, but first checks to see if it's already been done

  1. Scottoo
    TL/DR: This project allows you to like or dislike a Google Play Music song by voice, from the lockscreen or any other method you can think of to call the tasks. It checks to see if the song has already been liked/disliked so it doesn't undo your previous rating.

    I use Google Play Music as my everyday music player. Unfortunately while you can control playback from the lockscreen, it doesn't allow you to like and dislike songs without opening the app and navigating to the correct screen. Here's a Tasker project I've created to do this from the lockscreen or by voice.

    You'll need:
    • Autoinput
    • Autovoice (if you want to activate the tasks by voice)
    • Autonotification (if you want to activate the tasks by tapping a notification)
    • A directory at /sdcard/gmscreenshot that contains a 40x40 image called masterscreenshot.png. This image should be completely black and is used to compare a cropped screenshot in taken in the Thumbs Up Action and Thumbs Down Action tasks to see if a song has already been liked or disliked
    • To find the X/Y Coordinates of the Like and Dislike buttons on your screen, as well as a spot in the bottom Google Play Music button bar without a button. To do this, you can go into Developer options and turn on 'Show pointer location'. If you have a Note 4, the coordinates in the tasks should work for you.
    The project contains 5 tasks. The most important two are the Thumbs Up Action and Thumbs Down Action tasks, which:
    • open Google Play Music
    • click near the bottom of the screen. If the app is on the screen that says "Listen Now" at the top, it takes you to the next screen with the thumbs icons. If you're already on that screen, the click does nothing.
    • take a screenshot and crop it so it's only looking at the middle of the thumbs up or down icon, which will be black if it's already been liked or disliked
    • compares the screenshot with a black screenshot - if there's a match, the song has already been liked/disliked so it won't do it again (which would undo your previous rating). If there's a match, a flash appears letting you know that the song has already been liked and doesn't do anything else
    • if the 2 images don't match (meaning the song hasn't been liked yet), it clicks the thumbs up/down icon then returns to the homescreen and locks the phone.
    The other 3 tasks have to do with the Autonotification notifications that you can tap to launch the tasks. If you're not going to use Autonotification to launch the thumbs actions you can delete these tasks.

    The project contains 5 profiles, which you only need if you're going to use my Autovoice or Autonotification solutions to launch these tasks:
    • one that displays the Thumbs up and thumbs down notifications when Google Play Music is playing
    • one that runs the Thumbs up action when the Thumbs up notification is clicked
    • an equivalent profile for clicking the thumbs down notification
    • one that runs the thumbs up action if it hears " Ok Google, thumbs up"
    • an equivalent profile for thumbs down.
    A few notes:
    • A few of the actions in the tasks use coordinates based on the Note 4's screen layout. If you use a different phone you'll need to adjust coordinates in actions 4 and 6 of the Thumbs Up Action and Thumbs Down Action tasks. Use the "Show pointer location" option in Developer options to find the right coordinates in your phone.
    • Instead of having a separate notifications to tap for like and dislike, you may be able to use a single notification and assign buttons for each task (I've done this on the thumbs up notification). On my non rooted Note 4 running Lollipop those buttons in the notification aren't visible unless you swipe down on it with 2 fingers which defeats the purpose a bit.
    • Depending on your OS and phone type you may have a better way of calling the thumbs up and thumbs down tasks than using Autonotification and Autovoice. In that case, you'd only need the Thumbs Up Action and Thumbs Down Action tasks from this project. (If you have a solution that works allow you to launch one of these with a single click on the lockscreen on a nonrooted Lollipop I'd love to hear it).
    • Special thanks to /u/Ratchet_Guy for coming up with the solution for checking whether a song was already liked.
    It seems to work fairly well at this point but I'd be happy to hear any feedback on how this could be improved.
    joaomgcd likes this.