Author Topic: Speak/say selecteed movie name  (Read 40696 times)

0 Members and 1 Guest are viewing this topic.

Auri

  • $upporter
  • Sr. Member
  • *****
  • Posts: 150
  • Karma: 0
    • View Profile
Speak/say selecteed movie name
« on: January 30, 2011, 08:39:05 AM »
Hi everyone,

I've searched high and low to get voxcommando to say the selected movie name so that when I say "play movie X", voxcommando can say something like "Enjoy movie X"
I checked the HTTP commando's that are availble in xbmc on their wiki, but can't find a getfuntion that could return it.

Also is there a way to change voxcommando's TTS voice with a command and then let vox auto restart for it to go active ?
 
Kind regards
Challenge us at your own peril!

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Speak/say selecteed movie name
« Reply #1 on: January 30, 2011, 09:07:19 AM »
Hi everyone,

I've searched high and low to get voxcommando to say the selected movie name so that when I say "play movie X", voxcommando can say something like "Enjoy movie X"
I checked the HTTP commando's that are availble in xbmc on their wiki, but can't find a getfuntion that could return it.

Also is there a way to change voxcommando's TTS voice with a command and then let vox auto restart for it to go active ?
 
Kind regards

Hi Auri,

welcome to Voxcommando-Forum. Yes, there is  a way to do that. For begin, which version of VC do you have? When you have the version for xbmc you must edit the "play movie" command with Commmandtree-Editor. You can put a TTS.speak command with parameter - enjoy movie {lastresult} - when i have a little bit more time later, i will give you an example. I hope it is not so urgent ;)

Greetings Kalle
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Speak/say selecteed movie name
« Reply #2 on: January 30, 2011, 09:35:26 AM »
Actually the XBMC action PlayFile() will only return "OK" so lastResult will not work in this case.

Normally you would be able to use {1}.  For example if you say play artist The Beatles, then {1} will equal "The Beatles".  But in this case the movie name gets mapped to a filename and path, which you don't want to use with TTS!

I have attached a command that will tell you what is now playing in xbmc.  You can experiment with this command to get some fun results.  For example you can get the tagline instead of the title.  It is almost exactly the same as the "what song is this" command.

If you call this immediately after asking for the movie, it might not work.  You have to give xbmc a chance to queue it up and start playing.  We will soon be able to receive events from xbmc so it might be possible to trigger the TTS whenever a new file starts playing, but that might get tedious if it did it for every song.  We shall see.

0.872 (paid version) introduces events, and part of that will probably be a command to set a timer that will trigger then event when it goes off.
« Last Edit: January 30, 2011, 10:41:37 AM by jitterjames »

Auri

  • $upporter
  • Sr. Member
  • *****
  • Posts: 150
  • Karma: 0
    • View Profile
Re: Speak/say selecteed movie name
« Reply #3 on: January 30, 2011, 01:36:32 PM »
Hi Jitterjames and Kalle,

Thanks for your quick replies.

@kalle, that would have been awesome should it work, but like Jitter james pointed out, it would not return the actual movie name.
@jutterjames, thanks for your example but I already knew that, as I checked the "whats song is this", "what album is this" etc ... but it's not really what I want.

I did make a cool command with it though to give me a recap of the movie that is currently playing :

Code: [Select]
<VoiceCommands version="0.851">
    <commandGroup name="XBMC Get Movie Info" enabled="True">
        <command name="Get Movie Info" enabled="true" confirm="False" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XBMC.Send</cmdType>
                <cmdString>getcurrentlyplaying</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Title:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>You are currently watching {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <phrase>What movie is this</phrase>
        </command>
        <command name="Get Movie Info long" enabled="true" confirm="False" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XBMC.Send</cmdType>
                <cmdString>getcurrentlyplaying</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Title:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>You are currently watching {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Director:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>directed by {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Year:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>with it's cinema release in {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Studio:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>by {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Title:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>Enjoy {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <phrase>movie info, recap, movie recap</phrase>
        </command>
    </commandGroup>
</VoiceCommands>

The first one just tells me what movie is currently playing by name and second one tells me in a nice way what the movie name is, directed by, cinema release, etc ...
So yeah it's really fun to play with those commands and to read our results that get returned by XBMC's http api.

But the question still remains, is it possible to get vox to say the name of the movie that is currently selected (perhaps work arrounds with NFO or TXT files that are in the movies parent dir or something ?) I have cheked high and low and AFAIK there is no funtion in the xbmc http api that will return this, so am I right to assume that vox cannot do it ?  is the xbmc http api it's only source for data concerning actions in xbmc ?

Again thanks for the quick reply guys !

PS : this is so addictive, I stayed up till 5 in the morning last night, just by delving myself into this and loosing track of time.  That hasn't happend to me since the old days when I was scripting eggdrops on linux boxes, aaah good ol' days ;) THANK YOU FOR THIS !

Kind regards
« Last Edit: January 30, 2011, 01:41:09 PM by Auri »
Challenge us at your own peril!

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Speak/say selecteed movie name
« Reply #4 on: January 30, 2011, 01:51:32 PM »
Hi Jitterjames and Kalle,

Thanks for your quick replies.

@kalle, that would have been awesome should it work, but like Jitter james pointed out, it would not return the actual movie name.
@jutterjames, thanks for your example but I already knew that, as I checked the "whats song is this", "what album is this" etc ... but it's not really what I want.

I did make a cool command with it though to give me a recap of the movie that is currently playing :

Code: [Select]
<VoiceCommands version="0.851">
    <commandGroup name="XBMC Get Movie Info" enabled="True">
        <command name="Get Movie Info" enabled="true" confirm="False" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XBMC.Send</cmdType>
                <cmdString>getcurrentlyplaying</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Title:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>You are currently watching {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <phrase>What movie is this</phrase>
        </command>
        <command name="Get Movie Info long" enabled="true" confirm="False" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>XBMC.Send</cmdType>
                <cmdString>getcurrentlyplaying</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Title:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>You are currently watching {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Director:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>directed by {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Year:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>with it's cinema release in {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Studio:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>by {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>Results.RegEx</cmdType>
                <cmdString>Title:(.*)</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>TTS.SpeakSync</cmdType>
                <cmdString>Enjoy {match.1}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <phrase>movie info, recap, movie recap</phrase>
        </command>
    </commandGroup>
</VoiceCommands>

The first one just tells me what movie is currently playing by name and second one tells me in a nice way what the movie name is, directed by, cinema release, etc ...
So yeah it's really fun to play with those commands and to read our results that get returned by XBMC's http api.

But the question still remains, is it possible to get vox to say the name of the movie that is currently selected (perhaps work arrounds with NFO or TXT files that are in the movies parent dir or something ?) I have cheked high and low and AFAIK there is no funtion in the xbmc http api that will return this, so am I right to assume that vox cannot do it ?  is the xbmc http api it's only source for data concerning actions in xbmc ?

Again thanks for the quick reply guys !

PS : this is so addictive, I stayed up till 5 in the morning last night, just by delving myself into this and loosing track of time.  That hasn't happend to me since the old days when I was scripting eggdrops on linux boxes, aaah good ol' days ;) THANK YOU FOR THIS !

Kind regards

nice one command  8)
***********  get excited and make things  **********

Auri

  • $upporter
  • Sr. Member
  • *****
  • Posts: 150
  • Karma: 0
    • View Profile
Re: Speak/say selecteed movie name
« Reply #5 on: January 30, 2011, 02:20:13 PM »
Thanks,

If anyone would wonder why  I did
Code: [Select]
<cmdType>Results.RegEx</cmdType>
 <cmdString>Title:(.*)</cmdString>

Every time and return {match.1} is because when I did
Code: [Select]
<cmdType>Results.RegEx</cmdType>
 <cmdString>:(.*)</cmdString>
and return {match.1}, {match.2}, {match.3}, etc ... it would not always match what I wanted vox to say cause sometimes {match.5} would be director and in other time it would be studio or genre or rating .... depending on the outcome from xbmc's http api.

Anyways just wanted to share that also.

BTW : as stated in my original post -> "Also is there a way to change voxcommando's TTS voice with a command and then let vox auto restart for it to go active ?" I found the answer myself using TTS.SetVoiceName had a small brain fart while I was typing that question ;)


Silently hoping jitterjames will reply with something awesome that would fix my problem of saying the selected movie name ;)
« Last Edit: January 30, 2011, 02:26:48 PM by Auri »
Challenge us at your own peril!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Speak/say selecteed movie name
« Reply #6 on: January 30, 2011, 03:44:08 PM »
I don't know what you want.  What do you mean when you say "selected movie" or how it is different from the movie that you are requesting in your voice command.

In your original post you wrote
Quote
when I say "play movie X", voxcommando can say something like "Enjoy movie X"

and I answered that. You just need to add the attached xml example that I sent [which uses the regex expression Title:(.*) ]  to your command after the part that actually plays the movie.  As I said, you may need to get it to pause first to give xbmc time to actually start playing the movie.

I'm obviously not understanding what you want to do though, so maybe you can try to explain it to me in a different way.

Auri

  • $upporter
  • Sr. Member
  • *****
  • Posts: 150
  • Karma: 0
    • View Profile
Re: Speak/say selecteed movie name
« Reply #7 on: January 30, 2011, 04:01:15 PM »
Hi Jitterjames

I'll explain myself abit better and tell you the whole story.  I'm sorry that I sounded like I didn't read your reply because I did, it's just not what I want (and I should explain bettery sorry :D)

Here is the script that I want :

I use XBMC with an addon called "Cinema Experience".
It's an awesome addon should you be intrested you cand get it here : http://forum.xbmc.org/showthread.php?t=87563

Now, What I did was map the keyboard keys CTRL+D once I'm in the movie information so that when I press CTRL+D the addon Cinema Experience will start and will do all kinds of awesome stuff before my film starts (like THX intro's, Double digital intro's, play trailers from apple etc) just like in a real cinema basicly.

I then made a command in VC that would sendkey ^D so that it would emulate the CTRL+D to start the script and thus start all the fancy eyecandy before the actual movie begins.

now what I really want is when I say my command "play cinema" and VC executes the sendkey ^D I would like to have a TTS.Speak that would say "ENJOY <Movie name that is going to start after the Cinema Experience script>"

So although your reply was correct, and you didn't know the whole story, how would one go about getting this scenario done ?

I hope I explained it clear enough now, if not I apologise and try will again ;)
Challenge us at your own peril!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Speak/say selecteed movie name
« Reply #8 on: January 30, 2011, 04:19:56 PM »
ok, yes, lol you might have left a few key bits of information out of your original post!  :bonk

You originally said that you were asking for the movie by name, but I'm guessing that in fact you are browsing movies by various means.

This will probably depend almost entirely on the cinema experience plugin.  Most likely it is not possible.  I am not aware of any method to know what is currently on the screen, or what item is highlighted through the http interface to xbmc.  Most likely the only way this would be possible would be to modify the plugin.  Maybe you can talk to the makers of Cinema experience and ask them what might be possible, in terms of either generating a udp broadcast or possibly saving a small text file somewhere that vox could read.  Or maybe they'll have a whole other idea that would work better.

If you can get them on board, I'll be happy to make whatever code changes I can to read the files or whatever, if it is a reasonable amount of work.

If I get a chance I'll install that plugin and play around with it a bit, but I'm a bit swamped with other stuff right now.

Auri

  • $upporter
  • Sr. Member
  • *****
  • Posts: 150
  • Karma: 0
    • View Profile
Re: Speak/say selecteed movie name
« Reply #9 on: January 30, 2011, 04:23:58 PM »
Cool James ;)

I'll see if I can get a hold of the people at "Cinema Experience"

Keep up the good work.

Regards
Challenge us at your own peril!

Auri

  • $upporter
  • Sr. Member
  • *****
  • Posts: 150
  • Karma: 0
    • View Profile
Re: Speak/say selecteed movie name
« Reply #10 on: January 31, 2011, 11:11:14 AM »
Hey James,

I send a PM to one of the coders of Cinema Experience on the XBMC forums asking him for some help or insight into getting the results I want.

While I'm waiting for his answer I was thinking about the XBMC log files.

Could vox commando read/parse the XBMC log for specific strings of text ? Or would that be to complex or not maintainable ?

Regards
Auri
Challenge us at your own peril!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Speak/say selecteed movie name
« Reply #11 on: January 31, 2011, 11:25:50 AM »
it doesn't sound terribly practical but it might work.  First step would be to take a look at your log files and see if there is even any userful information being deposited there when you initiate the cinema experience.  (i.e. what goes into the log just prior to the point in time when you would like to hear TTS).  Personally I think this particular idea is a lot of work to achieve something not-so critical.  On the other hand, exploring ideas like this can often lead to solutions that are more useful elsewhere so I'm willing to entertain it.

Auri

  • $upporter
  • Sr. Member
  • *****
  • Posts: 150
  • Karma: 0
    • View Profile
Re: Speak/say selecteed movie name
« Reply #12 on: January 31, 2011, 11:54:24 AM »
I'm currently at work, but when I'm home I'll check my XBMC log to see if anything remotely comes close to some log entries we can use.
Also I'm still awaiting the reply from one of the addon coders.

I asked him if they could dump the info in an XML or TXT upon execution of the addon, if they can do that (or perhaps have somewhere in place already that is unknown to me) it would make life really easy :D

Also thanks for keeping an open mind for things like this !
Challenge us at your own peril!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Speak/say selecteed movie name
« Reply #13 on: January 31, 2011, 12:38:53 PM »
xbmc generates some events via UDP already and VoxCommando will be tapping into this very soon.  An example of an event would be, when you start playing a new movie etc. it will send out an event with the title of the movie.  If they could somehow use that system that would be far, far better than writing to a file.  I would 100% support that method.  the file thing is a hack that will only work for some users, and it's really not ideal.

Auri

  • $upporter
  • Sr. Member
  • *****
  • Posts: 150
  • Karma: 0
    • View Profile
Re: Speak/say selecteed movie name
« Reply #14 on: January 31, 2011, 01:18:39 PM »
Agreed.

Any idea when VoxCommando will start using those events ?

Is it http://forum.xbmc.org/showthread.php?t=68263 (JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC ) ? Or is that something totally different ? (think I read somewhere you were gonna drop the HTTP api and go for the JSON-RPC, might have misinterpet that though)
Challenge us at your own peril!