xAP Plugin

Questions and comments specific to a particular plugin should go here.

xAP Plugin

Postby kgschlosser » Sun Apr 17, 2016 11:58 pm

xAP Plugin

New Version Added On 05/3/2016 1:24AM MST

******************************

THIS WILL BREAK BACKWARDS COMPATIBILITY

******************************

I added some cool features. and modified existing ones.

Modified:

how the socket connections are handled
a lot of code cleanup and optimization

the ignore and debug dialog is a lot different now, i did away with 2 of the tables and added the use of check boxes to add or remove the items. made for a cleaner looking panel as well as simplified it for the user. during this process tho i had to do away with the automatic refresh. i found it to be quite annoying when i was scrolling down the list and a refresh took place and it jumped me right back to the top. but it does have the refresh button as well as if you check/uncheck anything or press one of the buttons it will refresh

the ignore and debug lists are no longer stored in the xml config file for eg: they have been moved to a series of files in the xAP Plugin directory. it is very important that you keep the directory name the same because if you change it the files will not be saved. i have it saving the config settings as well as the ignore and debug lists, i have it saving the event list also. and it makes backups of all of the files and the data is appended (except for the config data). all of this only takes place if the data changes, if it hasn't nothing will be written (so the file size doesn't get out of hand). i have made the files very easy to understand and you will be able to manually add or remove information from the file if you want. the different saves are separated by 50 "*"'s

Added:

save to file (explained above)

client mode. this is a nice feature, you are able to use the xAP plugin to receive commands directed to it specifically, this will cause the triggering of an event based on the data you provided in the message. The Target that you need to use will be located in the send message for the plugin, it is basically your xAP name with :xAP-Client added to the end.
The message you have to send will be as follows:

Prefix=TestPrefix (prefix is mandatory)
Suffix=TestSuffix (optional)
Payload=TestPayload (optional)

now the payload data is evaluated in 2 ways. one is just a standard evaluation so if you do this
Payload=[False, None, True]
the Payload will be a list with those items in it

or if you do this

Payload='{eg.eventString}' (you have to add the single quotes as not to get a malformed data error)
it will evaluate for an EventGhost global variable

checking the UID for non HEX characters. when entering the UID the character that is not a hex value will be highlighted as soon as you type it if there aren't enough hexdigits for the version you have selected it will not allow you to apply or OK or change the version it will turn all characters red in the uid field. you have to either press cancel or finish the UID

and i honestly don't remember what else if have changed i think that is all so far.

in the future:
I am going to start work on caching of the data that comes in and out of EG it is only going to store the xAP broadcasts that have a target in them. the reason for this is i want to make a better send feature that will allow you to select the target from a dropdown and then it will show you what classes are available for that target and when the class is selected it will show available message items. now this i will set up so that it can be added to on the spot just in case the command you are looking for isn't listed. this is going to be a very large addition so it's going to take me a while to code it. but keep your eyes open for it

thanks again. let me know if something is not working right.

K

#######################################




Fixed a closing issue so EventGhost closes more quickly

Added: Having EventGhost report to it's config panel what more it's running in either xAP Hub mode or xAP Application mode as well is if it's not connected at all

Added: Automatic switching from Application Mode to Hub Mode*

*if the heartbeat goes past 2 intervals without seeing it's echo on the loopback port. this is useful if some other software hub that is running crashes or you shut it down. the current heartbeat interval is set to 60 seconds, so the xAP Server will restart after 120 seconds

****************
Now supports all xAP applications running on the same computer as EG

there was a goof or some kind of a hole that allowed my test platform to have 2 pieces of software bind on the same port.

allowing for what i thought was control through eventghost. and really wasn't that is why the xfx Viewer was not working

so that is now fixed.

i also redesigned the Ignore/Debug dialog. it's all contained into one dialog now. and the dialog is auto sizing based on the largest monitor resolution that is attached to the system.

it will also adjust the table sizes to accommodate for the smaller resolutions.

added an automatic refresh to the tables. i set a 5 second timer on the refresh as to not have the data redrawing that noticeable.

there is still a refresh button for the impatient ones. and it automatically refreshes on adding or removing of items.

cleaned up the rest of the code and tried to stream line it a little more
i also made it so that all the keys for the dictionary in the payload all start with an uppercase.
the xAP protocol is not case sensitive but EG and python sure is.

so i wanted to make a standard out of it. on the EG side of things.

also added the ability to change the UID number (an electronic serial number of sorts) that way if you have more than one machine running this app you have the ability to separate them properly.

i may have changed more but i honestly can't remember

if there are any problems the complaint department is in the next thread over.

nah just ask i respond usually in the same day.

if there are any features that are wanted don't hesitate to ask.

or if you want to know how to pull data from the payload read this thread there is an example.

newest version is attached as usual

K

*************
New Version is in.
ok this was a biggie,

I added support for debugging per device, message type, and schema has a nice table to ad a remove the items from and it applys the changes real time. so if you press the OK it's saved and you will have to remove it.

it also saves the selections in the eventghost xml file. so no extra files needed.

i also added an ignore events feature just in case there are some events bugging the hell out of ya because they are flooding up the EG log

same deal. changes are shown real time but are saved when the OK button is pressed.

as far as the saving. if you press OK on either the debug or the ignore dialogs it will save them for that one session. you have to click the apply or ok for the plugin config to make the changes save for future loading of eventghost. i set it up that way because you may only want to have it running for the one session of EG

also if you go into the debug menu or the ignore menu upon first install of eventghost it will connect the server with whatever plugin config setting you currently have.

this version broke backwards compatibility i removed the allxAP from the plugin and it's config, so the alignment of the params is off, so if it does load but acts goofy, that's probably why

let me know what ya think

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Changes:

Cleaned Up a lot of code general housekeeping type things
Plugin Config Dialog no longer has view all xAP Data it has been changed to a Debug Mode so no need to edit files and restart EG

Corrected an issue with having more than one xAP software running on the same machine
the xAP plugin for EventGhost is now an xAP Hub, for Example: you are able to run EventGhost with the xAP plugin and the Logitech Media Server without the need for any additional software, there is one exception to this.
Exception:
xfx Hub and xfx Viewer are linked in a manner that breaks xAP Portocol definition, you are not able to run xfx viewer without having the xfx Hub running. and you cannot run 2 hubs on the same machine. that is why i saw the need to make the debugging something that can be changed without the restart of eventghost. i will add a toggling action to it in the future so there won't even be the need to open the config dialog.

I am sorry for this, i have a workaround in mind for it but it would require starting the xfx hub first and then EventGhost. I think i am going to add the xfx hub to the plugin and have a check box in the config as to which one you would like to use (if it is not installed have EventGhost launch the xfx Hub installer)

being that it is the only other xAP Hub available someone may want to be able to use the viewer and eventghost on the same computer. so i think it best to give the choice.

there are port leases that are assigned to any xAP applications that are running on the computer with eventghost acting as hub these leases expire after 2 times the heartbeat interval (as per xAP Protocol definition)

I also modified the send command dialog so that there are more lines showing for the message contents, i also included an example of sending the play command to the LMS

as usual file is attached to this post

K

**************
OK Here goes.

Attached file is a zip with the folder already in place. All you need to do is uncompress into your EventGhost/plugins folder, and restart EventGhost.

add the plugin it is labeled as xAP.

there are descriptions in the plugin configuration please do read them.

this plugin send and receives xAP for any schema.

works with xAP version 1.2 and 1.3
what version you would like to use is select-able

this is going to need some testing because i do not have the ability to send to EventGhost from a device. but there is an option to trigger an event on all xAP communication whether it is intended for EventGhost or not or to only trigger events for EventGhost (i am not sure if the latter will work)

I have also added the ability for you to specify a Vendor name if you like, I think the xAP protocol is pretty much dead but there are alot of devices that use it. I think that most of the Vendor specific controls for most devices out there are been removed so your devices should respond to any vendor name.

you have the option of how the events are triggered. Schema as the prefix and vendor/hostname as suffix or vice-versa.

the payload data is in a dictionary format so getting to the wanted information is very easy here is some example code

Code: Select all

if 'Artist' in eg.event.payload and eg.event.payload['Artist'] == 'Aerosmith':
    do something here



first bit of the if checks to make sure the key 'Artist' is in the dictionary as not to give you the nasty red errors and the second bit is the comparison

so that's pretty easy

i have included in the dict all header information
you should be able to derive the schema needed to send a command from reading the payload data

if you have a problem with the plugin open the __init__.py file in a text editor and change like 39 from DEBUG = False to DEBUG = True, then save it and restart EventGhost.

replicate the problem. then disable the plugin. this is important shut OFF the log times and then copy and paste the data grab a bunch of it from before and after the error along with the error.

DO NOT POST THE ERROR IN THE FORUM
copy and paste it into a text file NOT WORDPAD!!!!
save the file and then attach it to a forum post.

it could be a whole heap of information and there is no need for others to read through that or clog up this thread with it. and it's easier for me this way

Thanks again

K

Enjoy
Attachments
xAP.V1.5b.zip
(10.34 KiB) Downloaded 57 times
xAP.V1.3b.zip
(8.91 KiB) Downloaded 46 times
xAP.V1.2b.zip
(8.52 KiB) Downloaded 48 times
Last edited by kgschlosser on Tue May 03, 2016 7:23 am, edited 9 times in total.
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby V_J » Wed Apr 20, 2016 3:40 pm

I'm having problems loading the plugin... it gives a socket error. The output errors are in the attached file. Upon disabling, it just says that heartbeat has shut down.

I am running XFX hub on this computer as well as LMS. XFX Viewer shows that all devices are sending xap heartbeat messages...
Attachments
socket_error.txt
(617 Bytes) Downloaded 40 times
V_J
Experienced User
 
Posts: 155
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP Plugin

Postby kgschlosser » Wed Apr 20, 2016 3:53 pm

Only one usage of each socket address (protocol/network address/port)


hmmmm....


how to work around that.


not sure as to why the hub isn't working in my setup i had EG on a seperate computer and the LMS and player on another.

i am going to have to do more research on the protocol because i don't understand how it can listen on the port and have other things send on the same port. the hub was supposed to fix this, and i didn't think properly i run alot of rdp and forgot my eg was on a different box,
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby V_J » Wed Apr 20, 2016 6:07 pm

The xpl plugin works with a hub... I tested that one also. Perhaps the code there might help? :)
V_J
Experienced User
 
Posts: 155
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP Plugin

Postby kgschlosser » Thu Apr 21, 2016 4:40 am

ok here goes.....


I have been crackin at this for a good portion of the day and I have 1 of 2 successful things.


I have not busted out with the wireshark yet but i fell this is not really of the utmost importance.

I have successfully turned EG into an xAP hub

it works with LMS just fine, I have no others to test with other than the xfx Viewer. and that's the one that doesn't work

i believe the 2 communicate with one another outside of the xAP protocol. it states in the documents for the viewer that you have to have the xfx hub running for the viewer to work.

i think it's kind of bogus they went outside of the protocol definitions of how a hub works but i can't control someones choices.

be it as it may it is a lot nicer not to have to have another program running in order to have the xAP plugin running on the same box as another xAP application (other than xfx)

i may decide to code around the problem with the viewer so that if the xfx hub is started first and EG tries to bind to the port and can't it will switch to client mode.

right now it restarts the HUB portion every 30 seconds until you stop the program that is binding the port.

I am going to make an on the fly way of turning on the debug for a selected source (possibly a drop down menu of the sources)

as well as a mute events from a selected source and schema

that way you will have the ability to filter the crap ya don't want out.

i am going to do away with the disable heartbeats because that would be obsolete next to the mute events

i want to be able to store that information in the tree so it's going to be set up so that when the plugin starts (the actual hub portion) it will throw out an event and that you can use to load the items you want to mute. or i may spend more time and make the plugin config panel able to add the items to mute, in either case you would have to let the list populate before having anything show up in the list of items.

same goes for the per host on the fly debug if i do a drop down menu for it.

if anyone has any suggestions on how to set up a table to list all the available items and to be able to set it muted or unmuted that would be great.

otherwise i just have some code to clean up and i will post the new plugin shortly

K
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby kgschlosser » Thu Apr 21, 2016 6:42 am

new version is posted

K
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby kgschlosser » Thu Apr 21, 2016 11:44 pm

I am waiting on a reply from the dev of the xfx viewer, i explained that is plugin is a hub and that his software doesn't want to work unless the xfx Hub is running, so i asked how are the 2 attached to one another
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby kgschlosser » Sat Apr 23, 2016 12:50 am

new version is up
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby V_J » Sat Apr 23, 2016 6:42 am

It starts, but gives an error...
I had xfx hub running, then added xap to eventghost, got a few messages from the plugin, killed the xfx process and then it connected.
Not sure if related, but when I deleted the xap plugin from the tree, I lost remote desktop connection... :shock:
Attachments
error.txt
(660 Bytes) Downloaded 28 times
V_J
Experienced User
 
Posts: 155
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP Plugin

Postby kgschlosser » Sat Apr 23, 2016 10:47 am

uuuhhh yeah, only one program can bind to a port for listening, so if you had the xfx hub running that is why there was an error, well not really an error, but the starting of a 30 second timer to reconnect the server it's waiting for you to close the xfx hub.

this plugin now acts as an xAP hub, tho it does not correctly work with the xfx viewer, i am in conversation with the dev for the xfx viewer about it, because there is no other windows based hub available except this plugin and the xfx hub.

i am trying to iron that problem out, but i tested it against the LMS and it works fine with that.

there really isn't much out there for windows based xAP software to be honest so i am thinking that with the adition of the debugging mode i added and the ability to trim off the events ya don't want there really is no need to have the xfx stuff running.

but the viewer is a nice thing to have.

i have tested it as much as i can, it needs to be gone through for errors.

the debugging and ignore events happen real time without the need for closing the dialog, but if you do press the OK on the dialog, the settings are only saved for that instance of EG running.

if you click on the apply in the plugin config dialog the settings then get saved to the EG xml file so they will remain for every load of EG. and at any time it can be changed by going back into the debug/ignore and changing the items there.

i did not set this to have a "stay on top" for the debug/ignore and i forgot to change the plugin config that way also. so if you think that EG is frozen at any point and you opened up the debug/ignore dialog it's only because the dialog isn't in focus.

you have to go to your taskbar and click the icon for EG and it should show you both the EG and the debug/ignore dialog click the plugin dialog and presto, you can close it and continue on.

i have to do some poking around in one of my other plugins to see how i changed the always on top for the plugin config. that way it won'r respond that way. or i will move the debug/ignore to an action dialog instead, i really didn't want to move it to an action because it is more likely to get deleted from the tree thus erasing any saved debug\ignore's that are set.

if you come across any problems please extremely detailed description and screen shots if avail, as well as the exact error.

if there is something you would like to see as a feature in the plugin let me know. i think i pretty much have all bases covered but i am not as familiar with how this protocol works as you are.

i was thinking about adding a remote control feature for controlling the LMS in a limited fashion. all that would have to be entered is the target and there would be buttons for play, pause, stop, things of that nature.

maybe a dropdown to be able to select album/artist.

unfortunately there is no documentation for the xAP plugin for LMS and there is no detailed documentation for the standard xAP schema either so exactly what all the commands are i do not know.

i do know if you have actual squeeze boxes you can put text onto the display if you wanted.

if you have a list of commands for this kind of thing please forward it to me. it would help alot.


K
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby kgschlosser » Sat Apr 23, 2016 11:06 am

sorry didn't see that you attached a copy of the error, i have removed the disable heartbeats it was kinda pointless to have it now anyways, with the ignore feature and all.

that error would only happen if you had the show heartbeats un checked.

i removed it so no worries. i removed it from the plugin config panel as well.

but i kept the startup param in place so the plugin wouldn't have to be removed and reinstalled.

it's just a holding container at this point.

i attached the fixed version here when i get more done to it i will post as a version release
Attachments
xAP.V1.0.1b.zip
(7.6 KiB) Downloaded 38 times
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby kgschlosser » Sat Apr 23, 2016 12:26 pm

cool, i found a manual and a whole bunch of xAP examples for the xAP plugin.

I am thinking what i am going to do is to make a separate plugin for LMS but i have to add a means to send the events over to the LMS plugin. it shouldn't be that difficult.
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby V_J » Sat Apr 23, 2016 12:52 pm

Yes, I had heartbeat unchecked (I left it all to default settings). Will try the new one tomorrow (today not possible). Thanks!!!

There is a squeezebox plugin for eg that uses the commandline interface, by krambriw. Check to make sure you don't duplicate things too much. :)
V_J
Experienced User
 
Posts: 155
Joined: Tue Mar 04, 2014 9:00 am

Re: xAP Plugin

Postby kgschlosser » Sat Apr 23, 2016 4:04 pm

ok here is every command that is possible for the LMS using xAP

i have put them into dict format

you have to replace the None with the target

it is set up so that you can grab the dict item (remember to use deepcopy to get the item)

replace index #2 with the target

and then do a *varname right into the sendxAP action

you have to put the * in front to pass each index as a parameter

i will post alittle sample code

Code: Select all

from copy import deepcopy as dc

LMSCOMMANDS = {
            'xAPBSC.Cmd': {
                     'StateOff': ['output.state.1', 'xAPBSC.Cmd', None, 'ID=*\nState=Off'],
                     'StateOn' : ['output.state.1', 'xAPBSC.Cmd', None, 'ID=*\nState=On'],
                     'Response': ['output.state', 'xAPBSC.Event']
                     },
            'xAPBSC.Query': {
                     'Request' : ['request', 'xAPBSC.Cmd', None, ''],
                     'Response': ['output.state', 'xAPBSC.Info']
                     },
            'Audio.Transport': {
                     'Pause'   : ['Audio.Transport', 'xAP-Audio.Transport', None, 'Command=Pause'],
                     'Play'    : ['Audio.Transport', 'xAP-Audio.Transport', None, 'Command=Play'],
                     'Stop'    : ['Audio.Transport', 'xAP-Audio.Transport', None, 'Command=Stop'],
                     'Next'    : ['Audio.Transport', 'xAP-Audio.Transport', None, 'Command=Next'],
                     'Prev'    : ['Audio.Transport', 'xAP-Audio.Transport', None, 'Command=Prev'],
                     'Response': ['Audio.Transport', 'xAP-Audio.Transport.Event']
                     },
            'Audio.Seek': {
                     'Seek'    : ['Audio.Seek', 'xAP-Audio.Transport', None, 'Seek='],
                     'Response': ['Audio.Transport', 'xAP-Audio.Transport.Event']
                     },
            'Audio.Mixer': {
                     'Volume'  : ['Audio.Mixer', 'xAP-Audio.Audio', None, 'Volume='],
                     'Balance' : ['Audio.Mixer', 'xAP-Audio.Audio', None, 'Balance='],
                     'Bass'    : ['Audio.Mixer', 'xAP-Audio.Audio', None, 'Bass='],
                     'Treble'  : ['Audio.Mixer', 'xAP-Audio.Audio', None, 'Treble='],
                     'Response': ['Audio.Mixer', 'xAP-Audio.Event']
                     },
            'Audio.Mute': {         
                     'MuteOn'  : ['Audio.Mute', 'xAP-Audio.Audio', None, 'Mute=On'],
                     'MuteOff' : ['Audio.Mute', 'xAP-Audio.Audio', None, 'Mute=Off'],
                     'MuteTog' : ['Audio.Mute', 'xAP-Audio.Audio', None, 'Mute=Toggle'],
                     'Response': ['Audio.Mute', 'xAP-Audio.Event']
                     },
            'Schedule.Sleep': {
                     'Sleep' : ['Schedule.Sleep', 'xAP-Audio.Schedule', None, 'Sleep='],
                     'Response': ['Schedule.Sleep', 'xAP-Audio.Schedule.Event']
                     },
            'Schedule.Alarm': {
                     'Enable'  : ['Schedule.Alarm', 'xAP-Audio.Schedule', None, 'Command=EnableAll'],
                     'Disable' : ['Schedule.Alarm', 'xAP-Audio.Schedule', None, 'Command=DisableAll'],
                     'Response': ['Schedule.Alarm', 'xAP-Audio.Schedule.Event']
                     },
            'Audio.Query': {
                     'Mode'    : ['Audio.Query', 'xAP-Audio.Query', None, 'Query=Mode'],
                     'Sleep'   : ['Audio.Query', 'xAP-Audio.Query', None, 'Query=Sleep'],
                     'Power'   : ['Audio.Query', 'xAP-Audio.Query', None, 'Query=Power'],
                     'Volume'  : ['Audio.Query', 'xAP-Audio.Query', None, 'Query=Volume'],
                     'Balance' : ['Audio.Query', 'xAP-Audio.Query', None, 'Query=Balance'],
                     'Bass'    : ['Audio.Query', 'xAP-Audio.Query', None, 'Query=Bass'],
                     'Treble'  : ['Audio.Query', 'xAP-Audio.Query', None, 'Query=Treble'],
                     'Response': ['Audio.Notification', ' xAP-Audio.Query']
                      },
            'Track.Query': {
                     'Time'    : ['Track.Query', 'xAP-Audio.Query', None, 'Query=Time'],
                     'Genre'   : ['Track.Query', 'xAP-Audio.Query', None, 'Query=Genre'],
                     'Artist'  : ['Track.Query', 'xAP-Audio.Query', None, 'Query=Artist'],
                     'Album'   : ['Track.Query', 'xAP-Audio.Query', None, 'Query=Album'],
                     'Title'   : ['Track.Query', 'xAP-Audio.Query', None, 'Query=Title'],
                     'Duration': ['Track.Query', 'xAP-Audio.Query', None, 'Query=Duration'],
                     'Path'    : ['Track.Query', 'xAP-Audio.Query', None, 'Query=Path'],
                     'Response': ['Track.Notification', 'xAP-Audio.Query']
                      },
            'Playlist.Query': {
                     'Index'   : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Index'],
                     'Genre'   : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Genre'],
                     'Artist'  : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Artist'],
                     'Album'   : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Album'],
                     'Title'   : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Title'],
                     'Duration': ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Duration'],
                     'Path'    : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Path'],
                     'Tracks'  : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Tracks'],
                     'Shuffle' : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Shuffle'],
                     'Repeat'  : ['Playlist.Query', 'xAP-Audio.Query', None, 'Query=Repeat'],
                     'Response': ['Playlist.Notification', 'xAP-Audio.Query']
                     },
            'Display.Text': {
                     'Delete'  : ['Display.Text', 'xAP-OSD.Display', None, 'Type=Delete\nTag='],
                      'Query'   : ['Display.Query', 'xAP-OSD.Display', None, ''],
                     'Show'    : ['Display.Text', 'xAP-OSD.Display', None, ''],
                      'Line'    : ['Line1=', 'Line2=', 'Line3=', 'Line4=', 'Line5=', 'Line6=', 'Line7=', 'Line8=', 'Line9='],
                     'Duration': 'Duration=',
                      'TTL'     : 'TTL=',
                      'Align1'  : {
                            'Left'     : 'Align1=Left',
                           'Centre'   : 'Align1=Centre',
                             'Center'   : 'Align1=Center'
                             },
                       'Align2'  : {
                            'Left'     : 'Align2=Left',
                            'Centre'   : 'Align2=Centre',
                             'Center'   : 'Align2=Center'
                           },
                       'Type'    : {
                             'Queue'    : 'Type=Queue',
                             'Immediate': 'Type=Immediate',
                            'Permanent': 'Type=Permanent'
                             },
                     'Tag'     : 'Tag=',
                     'Bright'  : {
                            'PowerOn'  : 'Brightness=PowerOn',
                            'PowerOff' : 'Brightness=PowerOff',
                             'Idle'     : 'Brightness=Idle',
                             'Off'      : 'Brightness=Off',
                           'Dimmest'  : 'Brightness=Dimmest',
                             'Dim'      : 'Brightness=Dim',
                             'Bright'   : 'Brightness=Bright',
                             'Brightest': 'Brightness=Brightest',
                             '0'        : 'Brightness=0',
                             '1'        : 'Brightness=1',
                           '2'        : 'Brightness=2',
                             '3'        : 'Brightness=3',
                            '4'        : 'Brightness=4'
                             },
                       'Size'    : {
                           'Small'    : 'Size=Small',
                           'Medium'   : 'Size=Medium',
                           'Large'    : 'Size=Large',
                            'S'        : 'Size=S',
                             'M'        : 'Size=M',
                             'L'        : 'Size=L'
                             },
                     'Priority': 'Priority=',
                       'Screen'  : {
                            '1'        : 'Screen=1',
                             '2'        : 'Screen=2'
                            },
                     'Response': ['Display.Notification', 'xAP-OSD.Display.Query']
                       },
            'Playlist.Track': {
                         'Play'    : ['Playlist.Track', 'xAP-Audio.Playlist', None, 'Command=Play\nTrack='],
                     'Append'  : ['Playlist.Track', 'xAP-Audio.Playlist', None, 'Command=Append\nTrack='],
                         'Delete'  : ['Playlist.Track', 'xAP-Audio.Playlist', None, 'Command=Delete\nTrack='],
                     'Index'   : ['Playlist.Track', 'xAP-Audio.Playlist', None, 'Command=Index\nTrack='],
                         'Response': ['Playlist.Track', 'xAP-Audio.Playlist.Event']
                     },
            'Playlist.Move': {
                     'Move'    : ['Playlist.Move', 'xAP-Audio.Playlist', None, ''],
                     'From'    : 'From=',
                     'To'      : 'To=',
                     'Response': ['Playlist.Move', 'xAP-Audio.Playlist.Event']
                     },
            'Playlist.Edit': {
                     'Load'    : ['Playlist.Edit', 'xAP-Audio.Playlist', None, 'Edit=Load\nPlaylist='],
                     'Add'     : ['Playlist.Edit', 'xAP-Audio.Playlist', None, 'Edit=Add\nPlaylist='],
                     'Clear'   : ['Playlist.Edit', 'xAP-Audio.Playlist', None, 'Edit=Clear'],
                     'Response': ['Playlist.Edit', 'xAP-Audio.Playlist.Event']
                     },
            'Playlist.Albumn': {
                     'Command' : ['Playlist.Album', 'xAP-Audio.Playlist', None, ''],
                     'Load'    : 'Command=Load',
                     'Append'  : 'Command=Append',
                     'Artist'  : 'Artist=',
                     'Genre'   : 'Genre=',
                     'Album'   : 'Album=',
                     'Response': ['Playlist.Album', 'xAP-Audio.Playlist.Event']
                     },
            'Playlist.Shuffle': {
                     'On'      : ['Playlist.Shuffle', 'xAP-Audio.Playlist', None, 'Shuffle=On'],
                     'Off'     : ['Playlist.Shuffle', 'xAP-Audio.Playlist', None, 'Shuffle=Off'],
                     'Response': ['Playlist.Shuffle', 'xAP-Audio.Playlist.Event']
                     },
            'Playlist.Repeat': {
                     'Stop'    : ['Playlist.Repeat', 'xAP-Audio.Playlist', None, 'Repeat=Stop'],
                     'Track'   : ['Playlist.Repeat', 'xAP-Audio.Playlist', None, 'Repeat=Track'],
                     'Playlist': ['Playlist.Repeat', 'xAP-Audio.Playlist', None, 'Repeat=Playlist'],
                     'Response': ['Playlist.Repeat', 'xAP-Audio.Playlist.Event']
                     },
            'Button.Command' : {
                     'Button'  : ['Button.Command', 'Slim.Button', None, 'Button='],
                     'Response': ['Button.Command', 'Button.Event']
                     },
            'IR.Command' : {
                     'Code'    : ['IR.Command', 'Slim.IR', None, 'Code='],
                     'Response': ['IR.Command', 'IR.Event']
                     },
            'Server.Command': {
                     'Rescan'  : ['Server.Command', 'Slim.Server', None, 'Command=Rescan'],
                     'Playlist': ['Server.Command', 'Slim.Server', None, 'Command=Rescan Playlists'],
                     'Wipecach': ['Server.Command', 'Slim.Server', None, 'Command=Wipecach'],
                     'Response': ['Server.Notification', 'Slim.Server']
                                                      },
            'Player.Query': {
                     'Count'   : ['Player.Query', 'Slim.Server', None, 'Command=Count\nPlayerindex='],
                     'Name'    : ['Player.Query', 'Slim.Server', None, 'Command=Name\nPlayerindex='],
                     'Address' : ['Player.Query', 'Slim.Server', None, 'Command=Address\nPlayerindex='],
                     'Response': ['Player.Notification', 'Slim.Server']
                                                       }
            }

args = dc(LMSCOMMANDS['Audio.Transport']['Play'])

args[2] = 'ersp.SlimServer.SOMEHOSTNAME:PLAYERNAME'

eg.plugins.xAP.sendxAP(*args)




this setup should work but it also has a complete listing of the commands the class (schema) the message header (type)

i also included in the Response key for each of the commands the header(type) and class (schema) for the response from the LMS

now i do not know all of the message body contents for the responses,

but i am sure in time i will get them sorted out for the LMS

K
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: xAP Plugin

Postby kgschlosser » Sat Apr 23, 2016 4:15 pm

the CLI is good if the LMS is on the same box that EG is running.

this is going to provide a way to send the commands without having to have them on the same machine, as well as populate a remote control dialog as well, album art and all

if krambriw would like to join the 2 for a complete LMS package we could do that. give the user the choice in one plugin.

took me a few hours to make that command list, so now i am going to move on to making the remote, i already have the polling for the LMS plugin sorted, so upon loading it checks for the LMS plugin and if it's there and the host starts with esrp.SlimServer it will forward the payload data via a hidden action to the LMS plugin for processing and to do what it wants with it.


i just set up a try except routine on start to try and reference the action in the xAP plugin and if it can't to set the variable to False

and then if it sees that beginning bits of the Source match up it tries to use that variable to pass the data and again if it's false it will throw an exception which is just passed

ya know now that i am thinking i am going to put the function for the LMS right into there instead of only checking at start, that way if the plugin gets added it will run without the need to either restart EG or have to go into the config for the xAP and do a plugin restart that way.

K
A loved one and Time, The 2 things that can never be replaced.

Family, The only thing you don't get to choose in life.
User avatar
kgschlosser
Site Admin
 
Posts: 1280
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Next

Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 2 guests