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 (api is partially broken)

Questions and comments specific to a particular plugin should go here.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Spotify

Post 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.
sveflo
Posts: 4
Joined: Wed Nov 12, 2014 10:26 pm

Re: Spotify

Post 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 ? :)
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Spotify

Post 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'
sveflo
Posts: 4
Joined: Wed Nov 12, 2014 10:26 pm

Re: Spotify

Post 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!
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Spotify

Post 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
leothlon
Experienced User
Posts: 59
Joined: Tue Dec 17, 2013 6:29 pm

Re: Spotify

Post 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?
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Spotify

Post 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
niccoc1603
Posts: 3
Joined: Sun Dec 21, 2014 5:57 pm

Re: Spotify

Post by niccoc1603 »

Hello, I got a problem when trying to open spotify : "directory name not valid"

Running latest plugin version
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Spotify

Post 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/
niccoc1603
Posts: 3
Joined: Sun Dec 21, 2014 5:57 pm

Re: Spotify

Post 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)
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Spotify

Post 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
niccoc1603
Posts: 3
Joined: Sun Dec 21, 2014 5:57 pm

Re: Spotify

Post by niccoc1603 »

Thanks, well actually I managed to launch Spotify with standard App Launch action.

Is it possible to remotely perform searches?

Thanks
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Spotify

Post by krambriw »

No, is not supported and not possible to add with current library
opitmalt
Posts: 3
Joined: Wed Oct 02, 2013 5:11 pm

Re: Spotify

Post by opitmalt »

The latest version of the desktop Spotify client seems to have broken the plugin. Do you think a fix is possible?
Telorast
Posts: 46
Joined: Wed Feb 27, 2013 2:44 pm

Re: Spotify

Post 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.
Post Reply