Author Topic: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012  (Read 28639 times)

0 Members and 1 Guest are viewing this topic.

Wanilton

  • $upporter
  • Hero Member
  • *****
  • Posts: 559
  • Karma: 6
    • View Profile
    • XBMC Brazil Forum
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #60 on: January 11, 2013, 09:37:21 PM »
Events exist in voxcommando, and I use events for auto read info via tts with multiples languages in music, equal your idea. 

 :o :o :o
www.xbmcbrasil.net
XBMC  Brazilian Community Forum - Admin
Windows 8.1 - XBMC Gotham Custom Plus - Aeon MQ 5
My Room Entertaiment´s
About me

claymic

  • $upporter
  • Sr. Member
  • *****
  • Posts: 152
  • Karma: 0
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #61 on: January 11, 2013, 09:41:08 PM »
I tested now Wanilton, i only get the same event when i am playing something: "Player.OnPlay", for music, tvshow and movies.
Clayton
p.s oh, we can use the getNowPlaying later to see what is playing, by type. But with the script we can determine this very fast and without have to make many conditionals. We can see if we are playing a tvshow, movie or trailer for example.
« Last Edit: January 11, 2013, 10:16:30 PM by claymic »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #62 on: January 12, 2013, 09:09:39 AM »
I still have some work to do with the events.  Maybe they can be improved.

Clayton, I very much appreciate your help with the script.  I think it might come in handy, but only as an option because some users may not want a script that is always running in the background and executing a loop of code every 0.5 seconds.

It would be nice if there were a way for a script to stay resident in memory and wait to be called though, currently it seems that every time we call the script it needs to be loaded by xbmc so it is slightly slow sometimes.

If I am not able to improve the events generated by the json plugin then we can either try to make a configuration screen where the user can choose to use the event loop or not.  If that is too hard then we could make this a separate script available in the VC repository.  In any case, even if we don't use this feature it is interesting and helpful to see it and to be aware of new possibilities.  ;D ;D

claymic

  • $upporter
  • Sr. Member
  • *****
  • Posts: 152
  • Karma: 0
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #63 on: January 12, 2013, 09:11:46 AM »
Ok guys, now i made some more modifications in the and its done for you test, if you want of course.
Now the script run when you start the xbmc, because that you have to replace two files in the script.voxtolls, normally will be in this folder
C:\Users\your user name\AppData\Roaming\XBMC\addons\script.voxtools
Close the xbmc and then copy and paste this two files inside the folder
[attachment=1]
[attachment=2]
Now you can open the xbmc and play around with this.
Every time you start, stop or a file ended to play the vox will get a event like:
EpisodeStart
EpisodeStop
EpisodeEnd
Same thing for Movies, Album and Trailer
I made a poor group example for test.
[attachment=3]
Clayton

claymic

  • $upporter
  • Sr. Member
  • *****
  • Posts: 152
  • Karma: 0
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #64 on: January 12, 2013, 09:21:37 AM »
James
Code: [Select]
Clayton, I very much appreciate your help with the script.  I think it might come in handy, but only as an option because some users may not want a script that is always running in the background and executing a loop of code every 0.5 seconds.

It would be nice if there were a way for a script to stay resident in memory and wait to be called though, currently it seems that every time we call the script it needs to be loaded by xbmc so it is slightly slow sometimes.
Every script in the xbmc run in this way, with 0.500ms or whatever , the users dont see but they are running, there is no way to prevent a script to close without this. Of course we can manage the time and put any value we want. Every call inside the Vox will have the same time, no slow, since this execute first and outside. The script still running only for monitoring the player. I think that all the scripts in xbmc who need to monitor the player use this, its default for the xbmc.
I test here without any delay.
But if you can improve the events from Json, better. This will be awesome.
Clayton

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #65 on: January 12, 2013, 09:24:16 AM »
I am sure I can improve it.  but this is giving me another idea as well...  >:D  :biglaugh

I would suggest that you try a 1500 ms delay which should be fine for our purposes, instead of 500 ms.

claymic

  • $upporter
  • Sr. Member
  • *****
  • Posts: 152
  • Karma: 0
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #66 on: January 12, 2013, 09:30:06 AM »
The problem with the use of the values like 1500 its that we get the risk to not close the others instances opened. I put 500 there, but in the init of the main i put 2000, just to be sure that any old instance will be close after the script run again. But i will test.
I really like when you are enthusiastic with some ideas, this means that we will have some very good news soon ;D
Thanks for all James
Clayton

claymic

  • $upporter
  • Sr. Member
  • *****
  • Posts: 152
  • Karma: 0
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #67 on: January 12, 2013, 09:42:07 AM »
There is a strange behavior in the xbmc when its playing a audio file James. You can see in the script that i only send the event for Vox one time, but i can see in the .log that two events its sent. Strange, i dont figure out why. Xbmc bug ?

claymic

  • $upporter
  • Sr. Member
  • *****
  • Posts: 152
  • Karma: 0
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #68 on: January 12, 2013, 09:59:26 AM »
James,
How can i send a event for Vox with some params (args)?
Lets say i want to send this event: "MovieId"
in the script i can send with this: "event&&MovieId"
But if i want to send the event with the number of the movie for example, how can i do ?
lets say this:
"event&&MovieId,35"
I want to get the value 35 and use inside a action, so the MovieId will be my event, and 35 will be my arg.
its possible ?
Thanks
Clayton

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #69 on: January 12, 2013, 11:25:41 AM »
There is a strange behavior in the xbmc when its playing a audio file James. You can see in the script that i only send the event for Vox one time, but i can see in the .log that two events its sent. Strange, i dont figure out why. Xbmc bug ?
It seems to be a bug in XBMC, I get it too with the JSON notifications that are sent.  I wonder if they are aware.  If someone wants to check/open a ticket that would help me a lot.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #70 on: January 12, 2013, 11:49:37 AM »
James,
How can i send a event for Vox with some params (args)?
Lets say i want to send this event: "MovieId"
in the script i can send with this: "event&&MovieId"
But if i want to send the event with the number of the movie for example, how can i do ?
lets say this:
"event&&MovieId,35"
I want to get the value 35 and use inside a action, so the MovieId will be my event, and 35 will be my arg.
its possible ?
event&&Movie&&35

but you won't need to do this I am making good progress with events in the XJson plugin.  You just need to wait a few hours, or maybe a day. :)

claymic

  • $upporter
  • Sr. Member
  • *****
  • Posts: 152
  • Karma: 0
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #71 on: January 12, 2013, 12:13:27 PM »
James
Thanks, its just to learn.
I made this already event&&movie&&35
But, how i can use this in a action ? I tried with the payload and {1}, dont work.
Thanks for all your effort.
Clayton
p.s its more easy to me make a script to show you what i am trying to do, then try to explain what i want in my bad english :biglaugh

claymic

  • $upporter
  • Sr. Member
  • *****
  • Posts: 152
  • Karma: 0
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #72 on: January 12, 2013, 12:51:52 PM »
Ok, forgot that, its working. ;D

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #73 on: January 12, 2013, 01:29:52 PM »
yeah, I was going to say... "it SHOULD work!".

OK I have made enough progress that I can upload the next plugin for testing.

This one has improved events, but I am sure there is still a lot of work to do!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #74 on: January 12, 2013, 01:34:45 PM »
here is a sample command to announce songs:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="476" name="OnPlay Song" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>TTS.Stop</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["title", "album", "artist", "rating","playcount","genre"]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.ParseTokens</cmdType>
    <cmdString>Now Playing : {item.title}, by Artist {item.artist[[ &amp; ]]}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>XBMC.Player.OnPlay.song</event>
</command>

It always announces songs twice which is why I put the action:  TTS.Stop  at the beginning.

If you try to use TTS.speakSync this won't work and you will hear the announcement twice.

I need to figure out if this is a problem with XBMC or what...