Page 11 of 12
Re: Spotify
Posted: Mon Mar 23, 2015 10:02 pm
by derelict
Is there any chance you've got the rest working as well ? "Stateless" play/pause is not working... i assume because the player state is unknown ?
Re: Spotify (api is partially broken)
Posted: Fri Jul 03, 2015 9:32 pm
by JeanClaudeVanDamme
I have the latest version of Spotify, Eventghost and your plugin. The play button works, but then as soon as something is playing it stops along with the Stop and Play/Pause.
I get the error in the attachment,. Any ideas?
Re: Spotify (api is partially broken)
Posted: Sun Jul 05, 2015 12:03 pm
by krambriw
Since long the api (pytify.py) that I'm using for the plugin is partially broken so I have stopped maintaining this plugin.
Instead, I recommend that you use player supporting Spotify. If you use Mopidy (
https://www.mopidy.com/), you can use my Mopidy plugin (
http://eventghost.net/forum/viewtopic.p ... idy#p32889)to control it from EG.
Re: Spotify (api is partially broken)
Posted: Sun Nov 13, 2016 6:53 am
by wezzix
Hi,
Spotify changed their window caption formatting and now uses a simple dash instead of \x96, and removed "Spotify - " from the title when playing.
Here is the required modification in pytify.py.
Core feature works as of 2016-11-13
Code: Select all
def _parseWindowTitle(self): # mkedit
trackinfo = win32gui.GetWindowText(self._hwnd)
if trackinfo == "Spotify" or trackinfo.find(" - ") == -1:
return {'artist': None, 'track': None}
artist, track = trackinfo.split(" - ")
return {'artist': artist, 'track': track}
Re: Spotify (api is partially broken)
Posted: Sat Sep 01, 2018 5:22 pm
by slattynan
I'm not having much luck with this plugin. Can anyone confirm its still working with the latest Spotify?
Re: Spotify (api is partially broken)
Posted: Sat Sep 01, 2018 8:51 pm
by kgschlosser
This plugin i do not think works correctly anymore. Spotify likes to change their API a lot and that is one of the reasons the author no longer supports the plugin. To much maintenance. I started work on a new one. I still have to finish it up. the Spotify API is enormous and it has taken me a long while to get to the point I am at with it. I think I am almost to the point of making the actions in EG. I have to double check on where I am at with it.
Re: Spotify (api is partially broken)
Posted: Sun Sep 02, 2018 11:10 am
by slattynan
As long as your jumping my requests to the top of the queue!
TBH, For what I need it for I can make do with keyboard shortcuts for the time being
Re: Spotify (api is partially broken)
Posted: Sun Oct 28, 2018 10:48 am
by slattynan
I can't get the send keystroke commands to control Spotify for some reason. Is there an obvious reason why it shouldn't work?

Re: Spotify (api is partially broken)
Posted: Mon Oct 29, 2018 4:59 am
by kgschlosser
it all depends on how the application is set up.
If you right click on the macro and click on copy.. then paste the data into a forum post it will be easier to see what is going on.
It is always a good idea to use the cross hairs at the top of the Find Window config dialog. and be sure to hover over the caption bar of the program.
The name Find Window for that action can be misleading. it does not mean Find an Application which is what most are lead to believe.
It acrually means Find a Window subclass. a Window class is almost any kind of widget or control that is displayed in an application including the Frame (Window as you would think it to be called) Each thing you see in the Frame is a separate entity.
This is the best example.
create a macro.
add the Find Window action to it.
in the program line key in NotePad.exe and make sure all other are empty/unchecked.
after that add the SendKeys action. and key in some goofy message.
open notepad to a blank document.
then go to EG and run the macro.
you will see nothing gets typed..
then I want you to go and edit the Find Window Action. put a check next to the Child Class and type in Edit.
then run the macro again.. and not you can see the typing hapening. The point to this is to show you that you need to single out exactly where you want to send the keystrokes to inside of an application. as an example. if the application has an OK button and you want to emulate clicking on it.. the mouse would suck to try to emulate properly to do this. because the application may not be in the same place on the screen. With the find window action you can single out that OK button. and then use the send keystrokes to press the enter key.
There is a hitch to this. any items that are custom drawn and do not have any Window class objects they will not be available for you to directly access like this. a great example is with internet browsers. More and More programs are not using the stock windows items.
this reminds me of something i wanted to work on, I wanted to code up a logger for doing specific tasks using the Find window action. it would build the macro for ya. this would be really handy if you have some kind of a nested control that disappears when you click on anytrhing else. a good example would be the start button.
One other thing. You do not need to bring the application/window to the foreground in order to send keys to it. i did notice that in your macro. it was after the send keys but this can be the finger in the pudding. it is always good practive to add a wait in between anything that is interacting with a window. Microsoft Windows has a very complex notification system that the command get sent through and it does take a moment for it to do it. this wait time is also going to be affected by the number of applications running as well as the speed of the computer. a good number to start off with in the wait is 0.10 or a tenth of a second. and adjust from there.
a macro that interacts with a window should look like this
FindWindow
SendKeys
Wait 0.10
MinimizeWindow
Wait 0.10
RestoreWindow
Wait 0.10
SendKeys
.....
Same thing goes with any mouse actions.
Re: Spotify (api is partially broken)
Posted: Sun Nov 04, 2018 11:03 am
by slattynan
Thanks for the explanation, that is much clearer now. I had overlooked the significance of addressing the correct window class.
Works fine now.
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc4">
<Macro Name="Play/Pause" XML_Guid="{5A5E586E-3BD5-434E-8152-8327716BCDA8}" Expanded="True">
<Event Name="MceRemote.Unknown.BBBBFBBBBBFABEAA8" XML_Guid="{036B371C-016C-452F-899E-0CCEF325448D}" />
<Event Name="MceRemote.Unknown.BAAABAAABBFABEAA8" XML_Guid="{CF3F8D8B-EFE7-4DFC-A26D-BE7D64BBFE44}" />
<Action XML_Guid="{21D764F3-F49C-42C0-BE81-CEB45BB56D5B}">
Window.FindWindow(u'Spotify.exe', None, u'Chrome_WidgetWin_0', u'Chrome Legacy Window', None, 1, False, 0.25, 0)
</Action>
<Action XML_Guid="{9CB79021-D1EB-4883-871F-823C171CC7CD}">
EventGhost.Wait(0.01)
</Action>
<Action XML_Guid="{0B7BF7C5-175F-45A2-9C95-ABB56EDF4B80}">
Window.SendKeys(u'{Space}', True, 2)
</Action>
<Action XML_Guid="{995555BD-AF67-4B63-9878-5CFD3F03B341}">
Window.BringToFront()
</Action>
</Macro>
</EventGhost>
Re: Spotify (api is partially broken)
Posted: Sun Nov 04, 2018 5:10 pm
by kgschlosser
YAY!!!
I really do need to write a help section for that action. I am getting really tired of explaining how to use the Find Window action. It comes up A LOT.
Re: Spotify (api is partially broken)
Posted: Sun Nov 04, 2018 5:11 pm
by kgschlosser
tell me. are you using an MCE remote and getting those events when you press the button?? the actual MCE remote that came with the receiver..
Re: Spotify (api is partially broken)
Posted: Sun Nov 04, 2018 6:35 pm
by slattynan
Nope, I brought the receiver 13 years ago, i don't even know where the original remote is!
I'm using a spare roku remote I had lying around. It's nice, small and had the most important buttons on it.
Sorry to add to your explanation woes, TBH I asked before I had properly tried to resolve for myself. I tend to work on the basis that if I can't find within my first couple of searches, its worth posting so that the next person can

Re: Spotify (api is partially broken)
Posted: Mon Nov 05, 2018 3:36 am
by kgschlosser
Nah it's ok. I could have went hunting for it as well and then posted a link. I figure the more times i key it out it will eventually end up in search results for people to find.
LOL.
I asked about the remote thing because it has the NEC rolling code deal just like the MCE remotes do. Can you do me a favor please???. I was wondering if you can do an IR learn for say the power button. and paste the raw pronto code to me. I want to see what protocol that is.
Re: Spotify (api is partially broken)
Posted: Mon Nov 05, 2018 8:43 pm
by slattynan
It uses the NEC1 protocol according to RMIR. My old Windows Media Center remote said it used Proton, but that may just have been my old XBOX360 remote which also worked.
The pertinent information from the rmdu file is :-
Protocol=00 5A
Protocol.name=NEC1
ProtocolParms=234 194 null
FixedData=20 A8 BC
Notes=Roku Video Player XDS remote upgrade. The learned signal showed a pair of EFCs (X, X-1) for each key. So made made an upgrade with only first EFC (X) and it worked\!\! NEC1 with device 234 and sub-device 194.
What tool can I use to capture the raw pronto code?