Author Topic: VC -> Eventghost & Payloads  (Read 9699 times)

0 Members and 1 Guest are viewing this topic.

stepppedup

  • $upporter
  • Jr. Member
  • *****
  • Posts: 48
  • Karma: 0
    • View Profile
VC -> Eventghost & Payloads
« on: March 31, 2011, 05:00:08 PM »
Hi all,

I've googled for this, read everything I could find on Eventghost and VoxCommando's websites, and other forums re:  eg payloads.  And I'm just confused.

Let's say I wanted to update two different playlists using Eventghost with information received from a payload from VoxCommando.  One belongs to Monica.  The other belongs to Chandler.

Everything's set up, and I'm able to see all commands back and forth between eg and vc.

VC hears "Add mp3 to Monica's list"

phrase = Monica
Action = Eventghost
Parameter = Filename of mp3
Payload:  Monica, Chandler.

Eventghost receives the info as  Filename of mp3 with a payload of Monica.  EG then can use eg.event.payload evaluations to determine the mp3 playlist for Monica and update it with the filename.

Or is that not how payloads work?


(Because I tried that, and tried using Monica, Monica's in the payload, but although the command was recognized with 94% accuracy, instead of turning bright blue during action, it remained greyed out, with nothing sent to EG.)




jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: VC -> Eventghost & Payloads
« Reply #1 on: March 31, 2011, 10:39:30 PM »
I'm pretty confused by that.  I wonder if you could rephrase, and maybe send the command that you are using.

What is "Filename of mp3" and where is it coming from?  Why do you say the Phrase is Monica.  Based on your sentence it seems more like you have

Phrase: "Add mp3 to"
Payload: Monica's, Chandler's
Phrase: "list"

then you could simply send an EventGhost action in your command and name it whatever you want (parameter).  The parameter would be the event generated, and the payload would be either "Monica's" or "Chandler's" depending on which one you said.  But where you are getting the filename from is a mystery to me, as is whatever you are doing on the EventGhost end of things.

Wanilton

  • $upporter
  • Hero Member
  • *****
  • Posts: 559
  • Karma: 6
    • View Profile
    • XBMC Brazil Forum
Re: VC -> Eventghost & Payloads
« Reply #2 on: March 31, 2011, 11:03:17 PM »
James,

Hello J, look repost number 3, in this post
http://voxcommando.com/forum/index.php?topic=412.0

Commands Files attached in this post by Stepppedup, there are many commands listed in 3 files,
where he explain use the command with eventghost.

Wanilton
« Last Edit: March 31, 2011, 11:06:45 PM by Wanilton »
www.xbmcbrasil.net
XBMC  Brazilian Community Forum - Admin
Windows 8.1 - XBMC Gotham Custom Plus - Aeon MQ 5
My Room Entertaiment´s
About me

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: VC -> Eventghost & Payloads
« Reply #3 on: April 01, 2011, 12:37:48 AM »
ok, thanks.  I had not seen the other post yet.

I have a better idea now of what is going on.  It's past my bedtime though.

 @Stepppedup.  If you have time tomorrow, and you have teamviewer, we can look at it together.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: VC -> Eventghost & Payloads
« Reply #4 on: April 01, 2011, 09:32:56 AM »

Payload:  Monica, Chandler.

Eventghost receives the info as  Filename of mp3 with a payload of Monica.  EG then can use eg.event.payload evaluations to determine the mp3 playlist for Monica and update it with the filename.

Or is that not how payloads work?


yes, this is how they work.

stepppedup

  • $upporter
  • Jr. Member
  • *****
  • Posts: 48
  • Karma: 0
    • View Profile
Re: VC -> Eventghost & Payloads
« Reply #5 on: April 01, 2011, 06:31:04 PM »
Huh - I must  have really been doing something stupid...if your offer of a quick session of teamviewer is available, I'd love to take you up on it - I'm available for the rest of the day.

Cheers!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: VC -> Eventghost & Payloads
« Reply #6 on: April 01, 2011, 11:28:06 PM »
ok, I have distilled it down into something fairly simple.

here's the code to paste into eventGhost
Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1486">
    <Macro Name="Test of Incoming" Expanded="True">
        <Event Name="Broadcast.addMp3" />
        <Action>
            EventGhost.PythonScript(u"filename= eg.event.payload[1]\n#path = 'G:\\\\G\\\\Music\\\\1 aaa playlists\\\\'+filename+'sPlaylist.m3u'\npath = 'D:\\\\'+filename+'sPlaylist.m3u'\neg.plugins.FileOperations.Write(2, u'{eg.event.payload[0]}', path, 2, 0, False, False, False, 'cp1252')\n")
        </Action>
    </Macro>
</EventGhost>

oh, and you'll need to edit the python script in eventGhost to adjust the path.

and I have attached the VC command.

stepppedup

  • $upporter
  • Jr. Member
  • *****
  • Posts: 48
  • Karma: 0
    • View Profile
Re: VC -> Eventghost & Payloads
« Reply #7 on: April 02, 2011, 09:09:34 PM »
Thanks for that - and taking to time to go over payloads with me!

I'm going to capture my understanding from a newbie perspective - maybe it will help others in the future.  Note - attached is the xml file used so you can follow along if you want.

This post will cover payloads within VoxCommando.  The next post will cover payloads between VoxCommando and EventGhost.

As you can see in the picture below, the payload list is a list of potential payloads.  If you say the phrase like in the picture, "Payload Monica", then the payload will be Monica.



Here's how you use those payloads within VoxCommando itself:
  • Note - the payload test is on the lower right - this is your friend - use it!
  • Payloads are delivered within the commands by the use of {1} and {2}.  Here's the command used in the example:  VOX OSD: {cr}{cr}Vox Payload 1 is {1} {cr}Vox Payload 2 is {2}.  {1} delivers the first payload.    




When we set the test payload to just Monica -here's our result:



When we set it to Monica and Chandler - here's our result:



Hopefully that helps you - Eventghost to follow shortly....




« Last Edit: April 02, 2011, 09:32:26 PM by stepppedup »

stepppedup

  • $upporter
  • Jr. Member
  • *****
  • Posts: 48
  • Karma: 0
    • View Profile
Re: VC -> Eventghost & Payloads
« Reply #8 on: April 02, 2011, 09:14:31 PM »
This covers how VoxCommando sends payloads to EventGhost.  Attached are the Eventghost and voxcommando xml files that were used in the production of the video, so you can follow along. 

Bonus information included is how to do "if then" statements within Python scripts within Eventghost.



Hope it helps!
« Last Edit: April 02, 2011, 09:31:24 PM by stepppedup »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: VC -> Eventghost & Payloads
« Reply #9 on: April 02, 2011, 10:44:23 PM »
Good work.  The zooming and the arrows that you add are very helpful. :D

Is there supposed to be another video somewhere?

I would like to add that you can add a payload manually to the eventGhost command using && after the eventName

Let's say you are using a payloadList   (Monica, Chandler)

if you create a command like this:

EventGhost    Some.EventName&&MyPayloadValue

the payload that you say (let's assume you say Monica) is automatically added to the EventGhost event that is sent.  But since there is already a payload "MyPayloadValue", the "Monica" gets added as the second payload.

What you will see in eventghost is the event  "Some.EventName"

and the event payload will show up as an array with 2 strings in it:  ["MyPayloadValue","Monica"]

It seems confusing at first, but it is actually quite simple once you understand it.  The EventGhost command is one of the only cases where the payload gets attached automatically.  If I remember correctly, all other commands require you to be explicit about what you want to do with the payload.

Also I should point out that in your example you are using payloadLists.  There are several types of payload available that all work more or less the same way.  PayloadLists, payloadRanges, payloadDictation, and payloadXML files.  They all have their uses.  The payloadXML files are used to store all your media names (Artists, Albums etc.), they can also be very handy if you want to map phrases to values.

stepppedup

  • $upporter
  • Jr. Member
  • *****
  • Posts: 48
  • Karma: 0
    • View Profile
Re: VC -> Eventghost & Payloads
« Reply #10 on: April 03, 2011, 12:32:47 AM »
Thanks!  And good catch - I went with only one video since my computer kept dying while it was trying to process the video.  That and I was eager to go try out the newest Cinema Experience in XBMC to watch Tron Legacy....