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.

xAP interaction

Questions and comments specific to a particular plugin should go here.
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

and i think i am going to parse the data that is received and then return it as a dict and also have it as a dict for a payload that would be easiest for the end user to deal with i think.

then all the variables would be separated in a format like

eg.event.payload['Artist']
eg.event.payload[Album']
eg.event.payload['Track']


that sort of thing

and how would you like the actual event??

i am going to forgo setting a prefix i think and grab the sorce of the message (the device name/hostname) and use that as the prefix.

and maybe a suffix of 'Incoming.Message'

because for this to be able to be used properly it's going to have to be done in code.

i see another field i might be able to use as the suffix.

there is no name sore it but i am thinking it's a status of the device.

so i am seeing 'Now.Playing'

wow ok,

if i play something it throws out a message every second telling the amount of time that has played in the track

ok i am guessing i am going to cache the data and if it changes then post an event.

and i am going to use the devicename/hostname as the prefix and the class as the prefix (the class is Now.Playing or xAP-Audio.Transport.Event) and the payload will be a dictionary of the message contents

i am thinking that would be best
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

sorry bout the last post, sometimes it helps me to think if i type it out like that to form a game plan.


ok so here we are so far.

i have the receiving end of it done. i am thinking that was the hard part.

there is an option to generate events on the heartbeat data

there is also an option to put the host data as the prefix and the xAP event as the suffix

or to put the xAP Event as the prefix and the host data as the suffix.

here is a sample

ersp.SlimServer.DEVICEHOSTNAME:SqueezePlay.xAP-Audio.Playlist.Info
< Host Data >< xAP Event >
and
xAP-Audio.Playlist.Info.ersp.SlimServer.DEVICEHOSTNAME:SqueezePlay
< xAP Event >< Host Data >

and the payload will look like this

{'Album': "Aerosmith's Greatest Hits", 'Index': '1', 'uid': 'FF.042EDF80:0001', 'AlbumID': '7', 'Artist': 'Aerosmith', 'TrackID': '58', 'Duration': '4:27', 'Title': 'Dream On', 'source': 'ersp.SlimServer.DEVICEHOSTNAME:SqueezePlay', 'Tracks': '3', 'hop': '1', 'v': '13', 'Genre': 'Rock', 'Path': "file:////DC1/MediaPortal/My Music Library/Dad's Music/036 Dream On.mp3", 'class': 'xAP-Audio.Playlist.Info'}

i am going to keep the send box the same as the xPL if i can for the people that are already using xPL and want to make the change to xAP all they would have to do (if the message contents are the same) is edit the EG xml file and change out the plugin name and subclass for the xAP name and subclass

so that would be

plugins.xPL.sendxPL(blah blah blah)

to

plugins.xAP.sendxAP(blah blah blah)

or just do a find and replace and replace the xPL for xAP

just make sure you do it after the plugin load portion of the xml file (that should be close to the top of the file).

i will hopefully have this done in a few hours more.

K
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

ok everyone here it is,

i am not sure if you will be able to just swap out the plugin.xLP in the xml file. i am not 100% sure of the compatability between the xPL and xAP schema

so if you could give this a test run and let me know. that would be great. i believe i have the message formatting correct. but i do not know any of the message body contents or the schema.

if you could give this a go that would be great.

i added a feature called All xAP data and that will show everything that is being broadcast even if it is not intended for Eventghost but what i did was instead of opening up another port yet again i had it change the port that eventghost opens for monitoring data to its self to the xAP broadcast port and have it broadcast the heartbeat that you are listning for data to EG on that port. I am not sure if that is going to work. that all depends on the devices.

if you want to know device names for the target you will be able to locate them if you turn on the all data feature and watch the events. that will tell you who you can do what with based on the schema they are sending out.

all that kind of information is located in the payload.

the message formatting is completely different now, there was only one data segment sent before, and now there is 2. there is a header with data about Eventghost and where the following data is targeted to and then there is the message data which is the message body.

there are 2 defining lines for each oft those sections and i am not sure if i have them correct because the xAP protocol API does not explain what i am supposed to put where in relation to that, as far as sending a control command.

they only explain the data that is being received they also don't explain other than a simple line about the heartbeat and that the device is listning on port whatever... but they don't say if i have to send the data to that port for command or if i just broadcast it on the xAP port.

i now understand why the protocol died the API docs are terrible. and people gave up trying to figure it out.

with xPL everything was done via the broadcast port even tho it was listening on a different port. so i am hoping for the same and that's how i set it up

i did not cache the data to check for a change. so on the alldata it pops events a lot and i only have the LMS running, so i am sure if there are a lot of devices on the network you will probably see a huge amount.

if you have 100 squeeze players you will only get messages from the LMS and have to send messages to the LMS to control the different devices.

i don't know anything about how to control the devices through xAP for LMS i didn't hunt for any documentation on the 3rd party plugin for xAP to work on LMS

there is a logging feature in the plugin, if you are having a problem, please edit the log and turn on the DEBUG by entering True in place of the False should be line 41

run it with the logging turned on and then copy and paste the data to me in a file, do not put it on the forum, because this thing is going to throw out a lot of information.
and if you could turn off the log times that would be excellent.

if you have a problem with too much data wizzing by then disable the plugin after you see the problem. and you can select more than one item in the log for copy and paste.

click the first line. then hold down your left shift and click the last line, it will highlight the range
press ctrl+c and that just copied it

paste the file into a notepad txt file NOT WORDPAD!!!!!

and attach the file to a post

the script is attached in zip format with the folder already in the archive, so just unpack it right into the EventGhost/plugins folder. it will make the folder for the xAP plugin and put the file in it

start Eventghost and add the plugin, the plugin is located in the external section just above the xPL

have fun. and let me know what i need to fix or if there are any features you would like to have.

K

PS, the logging feature has a crap ton of lines to it, so as soon as i get this thing ironed out i will remove them and keep a copy with them in case someone has a problem.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

krambriw wrote:Anyway, this is the one I used a couple of years ago, it worked pretty nice
http://softsqueeze.sourceforge.net/


hey kambriw,

i just wanted to know that this player does not work with the new version of java and only work with like version 6 or something and you have to completely remove java 7 and delete any remnants of it, then hunt down 6 and install that (i decided not to go through all that LOL)

i found one that work well and doesn't need java it's called SqueezePlay but it's only the source and i tracked down a simple windows installer binary for it

https://code.google.com/archive/p/squee ... /downloads

K
If you like the work I have been doing then feel free to Image
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP interaction

Post by V_J »

Great work!
I'm unable to test it till at least this weekend though... Away from home due to some health issues.
kgschlosser wrote:i don't know anything about how to control the devices through xAP for LMS i didn't hunt for any documentation on the 3rd party plugin for xAP to work on LMS
That is a very small thing: if a message can be sent, then it is just the responsibility of the user to send a correct message. :)

FWIW, if you need software players, there is a list here (some are older)
http://wiki.slimdevices.com/index.php/M ... e#Software
But I had no problems with SoftSqueeze on newer Java versions. Just synchronization with other players was not ok.
SqueezeSlave is also no longer developed, but SqueezeLite is
http://wiki.slimdevices.com/index.php/Squeezelite

There are also raspberry versions for player (picoreplayer) and server (max2play).

(I posted here, not to pollute the other thread :))

J├Ârg
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

The plugin is finished

Sending and receiving works

I created a new thread for it in the plugins section

K
If you like the work I have been doing then feel free to Image
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP interaction

Post by V_J »

I noticed, and looked at the source. :) Not getting everything, but I can't wait to try it... Will just be this weekend though...

Great work! 8)
Thanks!
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

there is a lot of logging crap in there that can be remove if all is functioning well. it's a first draft, i will go back and tidy up and change some things about to make it a little more streamlined

but it does work for receiving and sending.

i am going to add the feature that will store the previous event from a specific device and schema and if the same thing comes in again without any data changed there will be no event, it's a lot that it's triggering events and i was only running the one player.

on another note. when i publish the next version of the plugin i am going to include a program in the zip file that can optionally be installed.

since you can only have one device bind to a port there is an xAP software hub that was made, so if you want to run a software player on the same machine as eventghost you can with this hub software

and i will also include another program to view all of the different devices and all of the broadcasts.

it also tells you what broadcasts are incorrect good feature for learning the commands and schema.

it's what i used to get the sending right.
If you like the work I have been doing then feel free to Image
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP interaction

Post by V_J »

kgschlosser wrote:i am going to add the feature that will store the previous event from a specific device and schema and if the same thing comes in again without any data changed there will be no event, it's a lot that it's triggering events and i was only running the one player.
But if you run multiple players, the sender is different... and they should be different events...

kgschlosser wrote: on another note. when i publish the next version of the plugin i am going to include a program in the zip file that can optionally be installed.

since you can only have one device bind to a port there is an xAP software hub that was made, so if you want to run a software player on the same machine as eventghost you can with this hub software

and i will also include another program to view all of the different devices and all of the broadcasts.
I used this one xFx-Express hub and xFx Viewer.
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

what i will do is store the hostname of the device in a dict and then store the schema and message contents, so if the repeat data keeps on coming in it would have triggered the event initially and then it won't do it again the data has change.

and i have to do this on a per device per schema method, because a device will broadcast repeating data but across multiple schema so i will do somehting like

Code: Select all


if hostname in xAPstorage:
    if schema not in xAPstorage[hostname] or (schema in xAPstorage[hostname] and xAPstorage[hostname][schema ] != xAPMessage):
        xAPstorage[hostname][schema] = xAPmessage
        eg.TriggerEvent(blah blah blah)
K

and those are the 2 pieces of software i use myself, i am going to send them off with the plugin so that way a someone has it without having to do the research to find it.

K
If you like the work I have been doing then feel free to Image
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP interaction

Post by V_J »

kgschlosser wrote:what i will do is store the hostname of the device in a dict and then store the schema and message contents, so if the repeat data keeps on coming in it would have triggered the event initially and then it won't do it again the data has change.
Wouldn't this risk of making the dict very big? Imagine playing songs on multiple sqeezeboxes: they all send xap messages every second with the played back time. All of them would get stored as they have different contents.

Also, they send an xap message when key on a remote is pressed. Press the same key again and you would not get an event for the second keypress. Buttons such as next/previous track, or the cursor buttons are likely to be pressed in succession...

I personally don't think it is a problem that a same message triggers another event, I'd rather know everything the squeezebox send and then have the freedom to decide to ignore it.
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

no because if its the same schema with different data it overwrites the old data.
If you like the work I have been doing then feel free to Image
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP interaction

Post by V_J »

But if you press a button on the remote, it sends an xap message. For the same button press, this will have the same schema and the same data... But you still want a second buttonpress to be detectable...
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP interaction

Post by kgschlosser »

if you would like to close this thread that would be great since there is the new one with the plugin actually made..
If you like the work I have been doing then feel free to Image
V_J
Experienced User
Posts: 165
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP interaction

Post by V_J »

Sorry... the discussion on the repetition started here. I cannot close the thread, but will stop using it. :)
Post Reply