Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Spotify: action depending on status

If you have a question or need help, this is the place to be.
Post Reply
Sheugel
Posts: 16
Joined: Sat Apr 25, 2009 5:30 pm

Spotify: action depending on status

Post by Sheugel »

Hi,
I would like to be able to make Eventghost execute (or not) an action depending on the status of Spotify, ie if it's playing or not.
The idea is to execute a slideshow if music is playing.
The trigger would be the idle event.
Could you help me out with that?
Thanks,
Sheugel
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Spotify: action depending on status

Post by krambriw »

Provided you have added my Spotify plugin to your configuration, you can use this simple script in a macro and add the idle event to it. You can just add your code for the slide show stuff.

Best regards, Walter

Code: Select all

p = eg.plugins.MySpotify.GetStatus()

if p.find('Not playing anything')<>-1:
    print 'do things when not playing'
    #add your code here
    #stop slide show
    
if p.find('Now playing')<>-1:
    print 'do things when playing'
    #add your code here
    #run slide show
Sheugel
Posts: 16
Joined: Sat Apr 25, 2009 5:30 pm

Re: Spotify: action depending on status

Post by Sheugel »

Hi,
Thanks, it's working but not entirely as... the plugin seems to be broken in the last version of Spotify (0.9.1.53). The logger displays "Spotify running! Not playing anything..." even when Spotify is actually playing something.
I tested with another PC running a previous version of Spotify, the plugin works but after the automatic upgrade of Spotify to the last version, the plugin doesn't work properly as mentioned hereabove...
Any help appreciated.
Sheugel
Posts: 16
Joined: Sat Apr 25, 2009 5:30 pm

Re: Spotify: action depending on status

Post by Sheugel »

Ok,
It seems the Spotify main window name has changed. Got it working by changing

Code: Select all

	def _parseWindowTitle(self):
		trackinfo = win32gui.GetWindowText(self._hwnd).split(" - ")
lines in pytify.py in Spotify plugin folder with

Code: Select all

	def _parseWindowTitle(self):
		trackinfo = win32gui.GetWindowText(self._hwnd).split("Spotify - ")
Thanks again,
Sheugel
Post Reply