2016-12-26, 15:50
Hi,
I just found this thread and wonder if the plugin might be a solution for my problem. I did not try it out yet and hope, somebody of you can tell me if this is the one to look into further, or maybe another plugin could do the job, or none at all. I hope it is OK to ask this before actually investing too much time, just to finally figure it's the wrong solution ...
I'm currently running Kodi on a Raspberry Pi3, using the OSMC distribution (I think it's near enough to OpenElec, not so sure about the fine details though). In addition, I'm running FHEM on the Pi, a Perl based open source home automation software (I'm not sure if it is ok to post foreign links here, you can just google for "fhem wiki" - it is in German though). This allows me to combine different wireless home automation systems (in my case Homematic on 868MHz and FS20 on 433MHz), my Logitech Harmony remote control, and Kodi. One thing I made and like a lot is a wall button (using FS20) that automatically turns on my receiver, switches its audio input to the PI3, starts a Spotify plugin on Kodi, and plays one of my playlists (using my Spotify Premium account). After it's started, the same button can be used to switch to the next track (context sensitive programming).
Currently I'm using the Spotimc plugin for this purpose - the only one usable enough at the time when I set this up. It actually works - the only problem is that Spotimc does not give you direct access to certain functions, like playing a certain playlist. I think this has to do with the old library instead of the api. What would be required is a direct, xml or json based access to these functions. My current implementation code for above mention button using Spotimc under FHEM is
As you can see, this is basically constructed upon navigating around in the Spotify user interface and knowing where things are (playlist tab, relative location of the playlist in question, etc). No Spotify funtion is used directly, everything is done using Kodi instructions. Also,time delays need to be added to make sure nothing is lost - eg, the 13 seconds to make sure Spotimc actually is listening to navigation commands. Such a construction is of course suboptimal - sometimes navigation commands are lost (rarely though, as it is over LAN and not just infrared), sometimes the playlist arrangement changes and the wrong one is selected, etc. So, I look for a replacement that allows me to send direct commands. To my understanding, the main issue is Spotify itself not wanting the community to use such interfaces, in order to hinder the development of open source developments, but I'm not sure if this really is the case. Anyway, would this - or some other - plugin be a better solution for my problem?
Thanks in advance,
Andy
I just found this thread and wonder if the plugin might be a solution for my problem. I did not try it out yet and hope, somebody of you can tell me if this is the one to look into further, or maybe another plugin could do the job, or none at all. I hope it is OK to ask this before actually investing too much time, just to finally figure it's the wrong solution ...
I'm currently running Kodi on a Raspberry Pi3, using the OSMC distribution (I think it's near enough to OpenElec, not so sure about the fine details though). In addition, I'm running FHEM on the Pi, a Perl based open source home automation software (I'm not sure if it is ok to post foreign links here, you can just google for "fhem wiki" - it is in German though). This allows me to combine different wireless home automation systems (in my case Homematic on 868MHz and FS20 on 433MHz), my Logitech Harmony remote control, and Kodi. One thing I made and like a lot is a wall button (using FS20) that automatically turns on my receiver, switches its audio input to the PI3, starts a Spotify plugin on Kodi, and plays one of my playlists (using my Spotify Premium account). After it's started, the same button can be used to switch to the next track (context sensitive programming).
Currently I'm using the Spotimc plugin for this purpose - the only one usable enough at the time when I set this up. It actually works - the only problem is that Spotimc does not give you direct access to certain functions, like playing a certain playlist. I think this has to do with the old library instead of the api. What would be required is a direct, xml or json based access to these functions. My current implementation code for above mention button using Spotimc under FHEM is
Code:
Button1r.on {
if (ReadingsVal("kodi","playStatus","") eq "playing") # if already playing, work as switch-to-next-track
{
fhem("set kodi next");
} else
{
fhem('set hub activity Streaming'); # Logitech Harmony is set to teh Streaming activity
fhem('set kodi addon script.audio.spotimc "" ""'); # Start plugin and wait until it probably is initialized
sleep(13);
fhem("set kodi up"); # Navigate to playlist tab and select, then wait 3 seconds
fhem("set kodi right");
fhem("set kodi select");
sleep(3);
fhem("set kodi down"); # Select playlist and wait 2 seconds
fhem("set kodi down");
fhem("set kodi down");
fhem("set kodi down");
fhem("set kodi down");
fhem("set kodi down");
fhem("set kodi right");
fhem("set kodi select");
sleep(2);
fhem("set kodi select"); # start playlist and wait to seconds
sleep(2);
fhem("set kodi next"); # Switch to next track (random shuffling) to avoid always starting with the first track
}
}
As you can see, this is basically constructed upon navigating around in the Spotify user interface and knowing where things are (playlist tab, relative location of the playlist in question, etc). No Spotify funtion is used directly, everything is done using Kodi instructions. Also,time delays need to be added to make sure nothing is lost - eg, the 13 seconds to make sure Spotimc actually is listening to navigation commands. Such a construction is of course suboptimal - sometimes navigation commands are lost (rarely though, as it is over LAN and not just infrared), sometimes the playlist arrangement changes and the wrong one is selected, etc. So, I look for a replacement that allows me to send direct commands. To my understanding, the main issue is Spotify itself not wanting the community to use such interfaces, in order to hinder the development of open source developments, but I'm not sure if this really is the case. Anyway, would this - or some other - plugin be a better solution for my problem?
Thanks in advance,
Andy