Page 10 of 12

Re: Spotify

Posted: Fri Nov 14, 2014 6:19 am
by krambriw
how to send it
Depends highly on what your control system is expecting? Like what it supports and what format the message must have. You have to more specific.
There are several plugins available for network communication.

What is your use case? Is this private use or commercial. I do not support commercial projects in this forum.

Re: Spotify

Posted: Fri Nov 14, 2014 10:20 am
by sveflo
This is for home use

The format i want is plain text, the control system accepts plain text via TCP/ip /Telnet

i only need to send the song title as plain text via TCP/IP - Telnet to my control prosessor and from there i know what to do, it is a Crestron control prosessor

Thankyou for the help

EDIT - Got it working and can now send the track and artist information :)

Are there a function to exctract the Album cover art URL ? :)

Re: Spotify

Posted: Fri Nov 14, 2014 2:13 pm
by krambriw
Try to add this plugin to your configuration
http://eventghost.net/forum/viewtopic.p ... 105#p32851

Then try this script instead (modify it so it fits with the port and ip etc of your target machine

Code: Select all

pl = eg.event.payload
artist = pl[0]
track = pl[1]
#Add code to send artist/track to your control system...
eg.plugins.BroadcastListener.Broadcast(
    artist+' - '+track,
    u'payload',
    u'192.168.10.11',
    33334
)
When a track is changed in Spotify, the event triggers the macro with the script and the message is sent out via TCP/IP. As example I get this

Code: Select all

15:09:14   Broadcast.Sting - Practical Arrangement 'payload'

Re: Spotify

Posted: Mon Nov 17, 2014 7:15 am
by sveflo
Hi, thanks for the help! got it working just fine now, but is there a possibility to extract the URL for the album cover image?

Thanks again!

Re: Spotify

Posted: Mon Nov 17, 2014 1:29 pm
by krambriw
There is unfortunately no support to get the images from the current api I'm using for the Spotify plugin. The closest I have found is described in this topic.
http://eventghost.net/forum/viewtopic.p ... over#p8734

If you can find where the images are stored by Spotify (I think they are downloaded locally somewhere when the track is played) you could eventually create a similar script that triggers and sends it.

Best regards

Re: Spotify

Posted: Mon Nov 24, 2014 11:38 am
by leothlon
I was just browsing the spotify api pages and it seems they have added alot of functionalities nowdays.
So i was woundering if it still not possible to play spesific playlist and such without having to emulate a load of keypresses and stuff?

Re: Spotify

Posted: Wed Nov 26, 2014 5:28 am
by krambriw
Sure, the Spotify api is providing much more then the library I am using for this Spotify plugin. Unfortunately, I have not seen that one updated with new functions. As mentioned before, the python support for Windows seems not to be the highest priority, at least I have not found a way to make alternative libraries work. So instead, I jumped on the Mopidy track.
Mopidy is an excellent player that also handles Spotify and supports more features. Mopidy runs under Linux, for instance in a virtual machine or on a Raspberry Pi. Check out the plugin I wrote here
http://eventghost.net/forum/viewtopic.php?f=9&t=6360

Re: Spotify

Posted: Sun Dec 21, 2014 6:00 pm
by niccoc1603
Hello, I got a problem when trying to open spotify : "directory name not valid"

Running latest plugin version

Re: Spotify

Posted: Mon Dec 22, 2014 7:28 am
by krambriw
Yes, this is a known problem if you run windows 7 64 bit or later. There is an updated version where this should be fixed and I would be interested if you can try it. Also, run EG as 'Administrator' to give EG necessary control of the Spotify application.

You find the current latest version here:
http://sto.hopto.org/Release/Spotify/Current%20version/

Re: Spotify

Posted: Mon Dec 22, 2014 11:49 am
by niccoc1603
Hmm I get this error at EG startup with this version
Error starting plugin: Spotify
Traceback (most recent call last) (1669):
File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginInstanceInfo.py", line 177, in Start
self.instance.__start__(*self.args)
TypeError: __start__() takes exactly 2 arguments (1 given)

Re: Spotify

Posted: Mon Dec 22, 2014 1:41 pm
by krambriw
1) Open the configuration dialog of the plugin

2) Check that the proposed path to Spotify application looks ok

3) Click OK, now the plugin should start correctly

4) Save the EG config

Re: Spotify

Posted: Wed Dec 24, 2014 10:54 am
by niccoc1603
Thanks, well actually I managed to launch Spotify with standard App Launch action.

Is it possible to remotely perform searches?

Thanks

Re: Spotify

Posted: Thu Dec 25, 2014 11:27 am
by krambriw
No, is not supported and not possible to add with current library

Re: Spotify

Posted: Sat Mar 14, 2015 8:49 am
by opitmalt
The latest version of the desktop Spotify client seems to have broken the plugin. Do you think a fix is possible?

Re: Spotify

Posted: Sat Mar 14, 2015 11:30 am
by Telorast
It's an easy fix. If you don't want to wait for a new version you can open "\EventGhost\plugins\Spotify\__init__.py" then scroll down to row 205. You'll see this code:

Code: Select all

    def findSpotifyWindow(self):
        try:
            self._hwnd = win32gui.FindWindow("SpotifyShadow", None)
            if self._hwnd > 0:
                self.bFound = True
            else:
                self.bFound = False
        except:
       	    self.bFound = False
Replace the SpotifyShadow with SpotifyMainWindow so it looks like this:

Code: Select all

    def findSpotifyWindow(self):
        try:
            self._hwnd = win32gui.FindWindow("SpotifyMainWindow", None)
            if self._hwnd > 0:
                self.bFound = True
            else:
                self.bFound = False
        except:
       	    self.bFound = False
Restart EventGhost and it should be working again. It won't report what's playing but at least you can control the player.