Author Topic: XBMC, EventGhost and Lights  (Read 10716 times)

0 Members and 1 Guest are viewing this topic.

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: XBMC, EventGhost and Lights
« Reply #15 on: November 06, 2014, 04:19:07 PM »
This is a meaningless statement which will accomplish nothing.

What are you asking?  Are you asking which group to put your new command in?

Why don't you tell us what you have done, and try to explain what is actually happening.  Maybe post your xml or some screenshots or a log or something.

Thanks for your response. The comment No longer working relates to previous comment that it was working and hence the reason for my question re location of new command. Yes I was asking which group.

I am trying to have the lights turn on at the end of the movie. Is the required log from Vox?

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!--C:\Users\Louis\Desktop\VcGrp_XBMC Notifications and Events.xml-->
<VoiceCommands version="">
    <!--this is an exported VoxCommando group-->
    <commandGroup open="False" name="XBMC Notifications and Events" enabled="True" prefix="" priority="0" requiredProcess="" description="">
        <command id="414" name="connect on focus" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XJson.Connect</cmdType>
                <params />
                <cmdRepeat>1</cmdRepeat>
            </action>
            <event>focused.XBMC</event>
        </command>
        <command id="501" name="connect" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XJson.Connect</cmdType>
                <params />
                <cmdRepeat>1</cmdRepeat>
            </action>
            <if ifBlockDisabled="False" ifNot="False">
                <ifType>LastActionSuccess</ifType>
                <ifParams>&amp;&amp;</ifParams>
                <then>
                    <action>
                        <cmdType>TTS.Speak</cmdType>
                        <params>
                            <param>Connected</param>
                        </params>
                        <cmdRepeat>1</cmdRepeat>
                    </action>
                </then>
                <else>
                    <action>
                        <cmdType>TTS.Speak</cmdType>
                        <params>
                            <param>Unable to establish connection</param>
                        </params>
                        <cmdRepeat>1</cmdRepeat>
                    </action>
                </else>
            </if>
            <phrase>connect</phrase>
        </command>
        <command id="506" name="disconnect" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XJson.Disconnect</cmdType>
                <params />
                <cmdRepeat>1</cmdRepeat>
            </action>
            <phrase>disconnect</phrase>
        </command>
        <command id="488" name="XBMC.Player.OnPlay.movie" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XJson.Raw</cmdType>
                <params>
                    <param>Player.GetItem</param>
                    <param>"playerid":1,  "properties": ["title","cast"]</param>
                </params>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <params>
                    <param>"name".*?"(.*)"</param>
                </params>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.MatchConcat</cmdType>
                <params>
                    <param>, </param>
                    <param>3</param>
                </params>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>XJson.ParseTokens</cmdType>
                <params>
                    <param>Now playing {item.title} starring {lastresult}</param>
                </params>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>XJson.SoftMute</cmdType>
                <params>
                    <param>60</param>
                </params>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <params>
                    <param>{LastResult}</param>
                </params>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>XJson.SoftUnMute</cmdType>
                <params />
                <cmdRepeat>1</cmdRepeat>
            </action>
            <event>XBMC.Player.OnPlay.movie</event>
        </command>
        <command id="515" name="XBMC.Player.OnStop.movie" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XJson.Raw</cmdType>
                <params>
                    <param>Player.Stop</param>
                    <param>"playerid":1,  "properties": ["title","cast"]</param>
                </params>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Scrape</cmdType>
                <params>
                    <param>http://192.168.1.300:25005/3?02621D1E3B0F11FF=I=3</param>
                </params>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <params>
                    <param>"name".*?"(.*)"</param>
                </params>
                <cmdRepeat>0</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.MatchConcat</cmdType>
                <params>
                    <param>, </param>
                    <param>3</param>
                </params>
                <cmdRepeat>0</cmdRepeat>
            </action>
            <action>
                <cmdType>XJson.ParseTokens</cmdType>
                <params>
                    <param>Now playing {item.title} starring {lastresult}</param>
                </params>
                <cmdRepeat>0</cmdRepeat>
            </action>
            <action>
                <cmdType>XJson.SoftMute</cmdType>
                <params>
                    <param>60</param>
                </params>
                <cmdRepeat>0</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <params>
                    <param>{LastResult}</param>
                </params>
                <cmdRepeat>0</cmdRepeat>
            </action>
            <action>
                <cmdType>XJson.SoftUnMute</cmdType>
                <params />
                <cmdRepeat>0</cmdRepeat>
            </action>
            <event>XBMC.Player.OnStop.movie</event>
        </command>
        <command id="463" name="XBMC.Player.OnSpeedChanged" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="this action is disabled by default!">
            <action>
                <cmdType>TTS.Speak</cmdType>
                <params>
                    <param>speed changed to {1}</param>
                </params>
                <cmdRepeat>0</cmdRepeat>
            </action>
            <event>XBMC.Player.OnSpeedChanged</event>
        </command>
    </commandGroup>
</VoiceCommands>

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #16 on: November 06, 2014, 04:31:25 PM »
No, that's not a log. It looks like you simply exported the command group XBMC Notifications and Events.

[Edit: sorry, I misunderstood your question about the log; yes, James meant the VC log.]

Can you please post the xml of the command that you tried to make for turning on the lights when a movie ends?

[Edit: sorry, now I see it in this command group -- just the one command would have been fine.]

Also, can you please enable logging in VoxCommando, then try using the command that you made (i.e. give the command to start a movie in XBMC, watch it for a few seconds, then stop the movie). Then go find the log file in your VC directory, and attach that to your next post.

When James says that "no longer working" is not helpful, he means that we need information about your setup in order to diagnose what "not working" means. Not working could mean a lot of different things -- is the movie not stopping, is the light not turning on, is the event not being generated ...

This point about the pointlessness of "not working" is explained in "When you ask" and "Specific tips" of the Getting Support wiki page: http://voxcommando.com/mediawiki/index.php?title=Getting_support

The same page also explains what a log is (http://voxcommando.com/mediawiki/index.php?title=Log), and how to post the XML for a specific command on the forum (which is a lot faster an more useful than a screenshot of your command -- look at my forum signature, where there is also a link) -- as well as the general importance of doing these steps when you're having problems with a command.

Please read over that Getting Support wiki page, and also try to do as described above. Thanks.


« Last Edit: November 06, 2014, 04:51:35 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #17 on: November 06, 2014, 04:34:23 PM »
My point is that we don't know WHAT "is not working".  That is why we specifically tell you in the "getting help" section of the wiki to not say that:

http://voxcommando.com/mediawiki/index.php?title=Getting_support#Other_Specific_Tips

We don't know what is happening on your computer, so you have to tell us.  One way to help us to know what is happening is to explain the sequence of events.  What you do, and what VC does including what appears in the history window.  In this case we need to know, is the event is being fired at all, and if so, is the command associated with the event being executed, and if so, is the scrape action being executed.  Are there any errors shown etc.

Yes a VC log can sometimes be helpful: http://voxcommando.com/mediawiki/index.php?title=Log

It doesn't really matter what group you put your command into as long as the group is not disabled.

Your command should probably work except that you have an extra action in there that I do not understand.  Why are you calling player.Stop?  The player has already stopped, which is why the event was fired.  Even if you are going to call Player.Stop, why are you also passing the params: "playerid":1,  "properties": ["title","cast"]
« Last Edit: November 06, 2014, 04:37:40 PM by jitterjames »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #18 on: November 06, 2014, 05:16:30 PM »
In theory, the command to turn lights back on at the end of a movie needs just one action.

In the following example, I've added a completely gratuitous TTS message that you can delete.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.8-->
<command id="515" name="XBMC post movie lights back on" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://192.168.1.300:25005/3?02621D1E3B0F11FF=I=3</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>Thanks for watching. Hope you enjoyed the show.|Is it just me, or do we need some light in here?</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>XBMC.Player.OnStop.movie</event>
</command>

As James says, the command can go in any command group (an XBMC-related group makes the most sense), but should not go in a group that is usually kept disabled.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: XBMC, EventGhost and Lights
« Reply #19 on: November 07, 2014, 11:25:42 AM »
@nime5ster

Thanks. Will try.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #20 on: November 07, 2014, 11:48:55 AM »
If the command that I posted is not successfully turning on your lights when a movie stops playing in XBMC, the next steps are:

1. Enable logging in VC if it's not enabled, go through the movie playing scenario as you would in practice, then attach the log to your next post.
2. Provide us with more information about your system and what you are doing; for example --

 a) Is XBMC running on the same computer as VC?
 b) What version of XBMC are you running?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: XBMC, EventGhost and Lights
« Reply #21 on: November 09, 2014, 11:51:10 PM »
@nime5ter

Thanks. The lights are turning on. Really appreciate your help.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #22 on: November 10, 2014, 09:41:50 AM »
It is a shame we never found out what was going wrong.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #23 on: November 10, 2014, 10:40:19 AM »
I guess we'll never know ...  :biglaugh

I'll take the opportunity to remind folks that when you edit commands and create new commmands, you should save the command tree and exit the tree editor so that VoxCommando can rebuild edited command groups. Saving the tree is not enough.

Until that is done, your new commands "won't work". Sure, you can test them with "save and execute", but don't expect saying the voice command or an event to trigger them.

« Last Edit: November 10, 2014, 10:44:05 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: XBMC, EventGhost and Lights
« Reply #24 on: November 10, 2014, 11:59:35 AM »
Ok. I was still trying to discover why my first command worked turning on the lights and then did not work. The working command was on my test computer (lights turning on) and was then transferred to my HTPC (lights not turning on). I changed the code to that which I posted and again that did not turn the lights on. After that I requested your help. On seeing and testing @nime5ter's post, I realized that it was similar to the one I first tried. That prompted me to recheck my original command which no longer turned the lights on (still on my HTPC). On comparing nime5ster's with my original, I noticed an error in the url with scrape. This might have resulted when I transferred the command from my test computer to my HTPC. Making the url adjustment in my original command resulted in the lights turning on also. Thanks for your help and please accept my apology for taking up your time with this issue.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #25 on: November 10, 2014, 01:16:40 PM »
Thanks for the update, lja.

We like to know how problems end up being resolved because if other users are having similar issues it gives them ideas about what to check in their own commands.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: XBMC, EventGhost and Lights
« Reply #26 on: March 18, 2015, 12:41:57 AM »
Looking for some help please:

VC:2.142
Kodi: Helix rc1
Kodi on same computer as Vox

Situation: Upgraded Kodi

Goal: To turn lights off at end of movie
Results with present setup: Lights are turned on at end of intro not at end of movie

Present
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="515" name="KODI post movie lights back on" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://192.168.1.100:25005/3?02621D1E3B0F11FF=I=3</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>Thanks for watching. This has been a Galaxy Home Cinema Presentation. Hope you enjoyed the show.</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>KODI.Player.OnStop.movie</event>
</command>


Also tried this:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<commandGroup open="False" name="KODI movie time " enabled="False" prefix="" priority="0" requiredProcess="" description="">
  <command id="1196" name="Set movie now playing variable" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>movieNowPlaying</param>
        <param>true</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>KODI.Player.OnPlay.movie</event>
  </command>
  <command id="1197" name="End of movie, turn lights back up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{var.movieNowPlaying}&amp;&amp;true</ifParams>
      <then>
        <action>
          <cmdType>Scrape</cmdType>
          <params>
            <param>http://192.168.1.100:25005/3?02621D1E3B0F11FF=I=3</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>I hope you enjoyed the show.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>movieNowPlaying</param>
            <param>false</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <event>KODI.Player.OnStop.movie</event>
  </command>
</commandGroup>

Thanks for any help
« Last Edit: March 18, 2015, 12:15:33 PM by lja »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #27 on: March 18, 2015, 10:23:42 AM »
Kodi's event system is not very sophisticated.  It generates movie stop events any time any kind of video stops playing.  However we do have access to the ID of the movie that has stopped.  In the case of outros and youtube videos etc. which are not part of your movie library the ID will appear as No ID so we can use this to tell whether it is really a movie that has stopped playing.

So if the payload {1} for this event is equal to NoID then we don't do anything, otherwise we turn the lights on.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="515" name="KODI post movie lights back on" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{1}&amp;&amp;no ID</ifParams>
    <then />
    <else>
      <action>
        <cmdType>Scrape</cmdType>
        <params>
          <param>http://192.168.1.100:25005/3?02621D1E3B0F11FF=I=3</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>Thanks for watching. This has been a Galaxy Home Cinema Presentation. Hope you enjoyed the show.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <event>KODI.Player.OnStop.movie</event>
</command>

This should work any time you stop playing a movie and it won't matter if you are using cinema experience or just playing the movie normally.

There are at least 3 other possible methods you could use to solve this problem depending on your needs, but this is the simplest to implement.
« Last Edit: March 18, 2015, 10:38:17 AM by jitterjames »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: XBMC, EventGhost and Lights
« Reply #28 on: March 18, 2015, 10:51:04 AM »
@lja - As a side note, this may not matter if you don't ordinarily use a voice command to start watching your movies; however, if you'd like for that voice command to work correctly, you can fix the command pretty easily.

Based on the log you posted, somehow the correct action was edited in your Show Movie command, changing the proper syntax for payload {1} to just 1.

This means KODI will always play the movie with ID 1 in your library after the intro. For it to play the movie you've asked for, the command needs to use payload {1}.

It seems that currently your Show Movie command has a line:

XJson.Raw --> Addons.ExecuteAddon "wait": false, "addonid": "script.cinema.experience", "params": [ "movieid=1" ]

That should be:

XJson.Raw --> Addons.ExecuteAddon "wait": false, "addonid": "script.cinema.experience", "params": [ "movieid={1}" ]
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: XBMC, EventGhost and Lights
« Reply #29 on: March 18, 2015, 03:20:42 PM »
@jitterjames

Thanks for the explanation and example. Will try it.