VoxCommando

VoxNastics (User Guides and Mods) => XML Exchange => Topic started by: 2exclusive on October 01, 2014, 09:47:08 PM

Title: Lookup NBA schedule and perform the following actions
Post by: 2exclusive on October 01, 2014, 09:47:08 PM
Not sure if someone did this already,but a good idea for sports fanatics.

Have VC navigate to the following URL:

http://www.nba.com/schedules/national_tv_schedule/

and scrape the source for date, time, teams playing and what channel.

For example

Ask VC "Are there any NBA games playing today?"
VC responds "checking...."
VC brings the following info "yes, Miami @ Chicago, 8:00pm on channel ESPN ....Would you like to set a reminder?"
I respond "yes"
VC responds "setting reminder"

Or

You can say "Is Chicago playing today ?"
Then it can search for Chicago for today's date.









Title: Re: Lookup NBA schedule and perform the following actions
Post by: 2exclusive on October 03, 2014, 05:32:41 PM
I guess no one likes sports?  ::confused

Title: Re: Lookup NBA schedule and perform the following actions
Post by: nime5ter on October 03, 2014, 05:48:53 PM
Ha. Well I know *we* don't care much about professional sports, but I can't speak for everyone. Haddood posted some nice FIFA xml back during ... um ... you know, world football season. Whatever that's called. :)

Are you looking for advice on how to go about this?

If you want to give it a go, we can offer some advice if/when you get stuck. Just post your xml.

Have you tested out the RegEx tool yet? http://voxcommando.com/forum/index.php?topic=1699.0
Title: Re: Lookup NBA schedule and perform the following actions
Post by: Haddood on October 03, 2014, 06:31:40 PM
I would love to jump on the project, however I do not have much time till mid November ... meanwhile I think the approach should be to use scrape command to read the page on the fly or convert it to xml. For the channels one can switch the logo url to text easily since there are not many of them ...
Title: Re: Lookup NBA schedule and perform the following actions
Post by: 2exclusive on October 03, 2014, 06:46:15 PM
ok, ill try my best to start it off. really new to this, so ill take a look at his past config see if i can make sense of any of it.
Title: Re: Lookup NBA schedule and perform the following actions
Post by: Haddood on October 03, 2014, 06:54:59 PM
looking at the source of the page ... here is the outline

scape the page

use regex to get matches from

<tr>
         <td class="dt">Sun, Oct 5</td>
         <td class="gm"><a href="/kings">Sacramento[/url] @ <a href="/raptors">Toronto[/url]
Preseason
            
         </td>
         <td class="tm">7:00 pm</td>
         <td class="ntv"><img border="0" src="http://i.cdn.turner.com/nba/nba/images/shrinkee_TSN2.gif"></td>
      </tr>


the challenge will be creating natural commands to convert today, tomorrow, this weekend ...etc.  to dates to filter the results take a look at nime5ter approach for the weather at this post http://voxcommando.com/forum/index.php?topic=1755.msg15262#msg15262

probably you can use the same py scripts

once this is solved same approach can be used develop command about results  ::) ::)
like
who won in NBA last game
what was the results of Raptores against Kings last game ...etc.

then we can do hockey and other sport  :P :P
Title: Re: Lookup NBA schedule and perform the following actions
Post by: 2exclusive on October 03, 2014, 06:59:01 PM
Nice, thanks for the start. Appreciated
Title: Re: Lookup NBA schedule and perform the following actions
Post by: nime5ter on October 04, 2014, 10:51:44 AM
Alright. Haddood inspired me with his suggestion to convert the scraped contents to xml.

Here is a command group for the NBA schedule. I don't have time to explain the details, but basically you can ask if there are any NBA games on today. If there aren't any, it will prompt you to ask if you want to see upcoming games. If you confirm that you do, it will tell you the next 5 upcoming games. You can also just ask to see the upcoming games directly.

I guess this is just for Americans, though? I don't know what time zone they're reporting, or whether those channel are relevant outside the U.S.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.3-->
<commandGroup open="True" name="NBA" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="287" name="scrape NBA schedule" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Delete</cmdType>
      <params>
        <param>nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>http://www.nba.com/schedules/national_tv_schedule/</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExSingle</cmdType>
      <params>
        <param>"dt"&gt;(.*?)&lt;/td&gt;.*?"gm"&gt;.*?href=".*?"&gt;(.*?)&lt;/a&gt;.@.&lt;a.*?"&gt;(.*?)&lt;/a.*?"tm"&gt;(.*?)&lt;/td.*?shrinkee_(.*?)\.gif</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.WriteLine</cmdType>
      <params>
        <param>nba.xml</param>
        <param>&lt;?xml version="1.0" encoding="utf-8"?&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Append</cmdType>
      <params>
        <param>nba.xml</param>
        <param>&lt;date&gt;{Match.{i}.1}&lt;/date&gt;&lt;game&gt;{Match.{i}.2} vs. {Match.{i}.3}&lt;/game&gt;&lt;time&gt;{Match.{i}.4}&lt;/time&gt;&lt;channel&gt;{Match.{i}.5}&lt;/channel&gt;{cr}</param>
      </params>
      <cmdRepeat>30</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>C:\Users\naomi\Desktop\sp 2\nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>\r\n&lt;date&gt; &lt;/date&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>nba.xml</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>VC.Loaded</event>
    <phrase>Update NBA schedule</phrase>
  </command>
  <command id="306" name="Show upcoming games" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>&lt;date&gt;(.*?)&lt;/date&gt;&lt;game&gt;(.*?)&lt;/game&gt;&lt;time&gt;(.*?)&lt;/time&gt;&lt;channel&gt;(.*?)&lt;/channel</param>
        <param><![CDATA[ ]]></param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Upcoming games are:</param>
        <param>6000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>{Match.{i}}</param>
      </params>
      <cmdRepeat>5</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <params>
        <param>Upcoming games are:</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{Match.{i}}</param>
      </params>
      <cmdRepeat>5</cmdRepeat>
    </action>
    <phrase>Show upcoming games</phrase>
  </command>
  <command id="325" name="Are there any N.B.A. games today?" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <params>
        <param>{DtCustom.MMM d}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>\s</param>
        <param>.</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>today</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>&lt;date&gt;\w.*?{var.today}&lt;/date&gt;(.*?)\n</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>Results.SetLastResult</cmdType>
          <params>
            <param>{Match.1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>game&gt;(.*?)&lt;/game&gt;&lt;time&gt;(.*?)&lt;/time&gt;&lt;channel&gt;(.*?)&lt;/channel</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Today's games:</param>
            <param>5000</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.AddText</cmdType>
          <params>
            <param>{Match.{i}.1} at {Match.{i}.2} on {Match.{i}.3}</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>Today's games are</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>{Match.{i}.1} at {Match.{i}.2}, on {Match.{i}.3}</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Sorry. No games today. Would you like to see upcoming games?</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>Sorry. No games today. Would you like to see upcoming games?</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.TellVox</cmdType>
          <params>
            <param>Show upcoming games</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Are there any games today?</phrase>
  </command>
</commandGroup>
Title: Re: Lookup NBA schedule and perform the following actions
Post by: nime5ter on October 04, 2014, 11:03:57 AM
By the way, currently I have it automatically scraping the NBA site when you first launch VC, or you can ask it to "update the schedule".

You can always change that schedule updating to work differently -- I was simply in a hurry.
Title: Re: Lookup NBA schedule and perform the following actions
Post by: Haddood on October 04, 2014, 06:09:44 PM
nime5ter ... We should develop a super hero character for you :)
Title: Re: Lookup NBA schedule and perform the following actions
Post by: 2exclusive on October 04, 2014, 07:09:28 PM
Yep, seriously
Title: Re: Lookup NBA schedule and perform the following actions
Post by: nime5ter on October 04, 2014, 08:41:49 PM
It ain't perfect, but it's pretty functional. You can have it list more than 5 upcoming games if you want. I think I set it to store something like 30 games total.
Title: Re: Lookup NBA schedule and perform the following actions
Post by: 2exclusive on October 06, 2014, 02:38:34 PM
Do you know how I can rename the dates after its done scraping. Example in the xml it's dated as sun, oct 5,.

I would like to change everything that's sun to Sunday, sat to Saturday, oct to October..etc.. This will sound better when vox reads it out
Title: Re: Lookup NBA schedule and perform the following actions
Post by: nime5ter on October 06, 2014, 02:50:59 PM
Yes. The easiest hacky way if you are a non-programmer is to use the Results.Replace action 7 times (http://voxcommando.com/mediawiki/index.php?title=Actions#Replace) :

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.3-->
<command id="306" name="Show upcoming games" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>File.Read</cmdType>
    <params>
      <param>nba.xml</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>Sun,</param>
      <param>Sunday,</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>Mon,</param>
      <param>Monday,</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>Tue,</param>
      <param>Tuesday,</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>Wed,</param>
      <param>Wednesday,</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>Thu,</param>
      <param>Thursday,</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>Fri,</param>
      <param>Friday,</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>Sat,</param>
      <param>Saturday,</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>&lt;date&gt;(.*?)&lt;/date&gt;&lt;game&gt;(.*?)&lt;/game&gt;&lt;time&gt;(.*?)&lt;/time&gt;&lt;channel&gt;(.*?)&lt;/channel</param>
      <param><![CDATA[ ]]></param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>Upcoming games are:</param>
      <param>6000</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.AddText</cmdType>
    <params>
      <param>{Match.{i}}</param>
    </params>
    <cmdRepeat>5</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.SpeakSync</cmdType>
    <params>
      <param>Upcoming games are:</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>{Match.{i}}</param>
    </params>
    <cmdRepeat>5</cmdRepeat>
  </action>
  <phrase>Show upcoming games</phrase>
</command>
Title: Re: Lookup NBA schedule and perform the following actions
Post by: nime5ter on October 06, 2014, 03:23:28 PM
OK, here is the whole command group again to replace the first version above.

I've added a self-executing command that replaces the day and month formats all at once, after scraping the NBA website.  This is a method that anyone can implement with a bit of practice:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.3-->
<commandGroup open="True" name="NBA" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="287" name="scrape NBA schedule" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Delete</cmdType>
      <params>
        <param>nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>http://www.nba.com/schedules/national_tv_schedule/</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExSingle</cmdType>
      <params>
        <param>"dt"&gt;(.*?)&lt;/td&gt;.*?"gm"&gt;.*?href=".*?"&gt;(.*?)&lt;/a&gt;.@.&lt;a.*?"&gt;(.*?)&lt;/a.*?"tm"&gt;(.*?)&lt;/td.*?shrinkee_(.*?)\.gif</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.WriteLine</cmdType>
      <params>
        <param>nba.xml</param>
        <param>&lt;?xml version="1.0" encoding="utf-8"?&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Append</cmdType>
      <params>
        <param>nba.xml</param>
        <param>&lt;date&gt;{Match.{i}.1}&lt;/date&gt;&lt;game&gt;{Match.{i}.2} vs. {Match.{i}.3}&lt;/game&gt;&lt;time&gt;{Match.{i}.4}&lt;/time&gt;&lt;channel&gt;{Match.{i}.5}&lt;/channel&gt;{cr}</param>
      </params>
      <cmdRepeat>30</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>\r\n&lt;date&gt; &lt;/date&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>nba.xml</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>cleanup</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>VC.Loaded</event>
    <phrase>Update NBA schedule</phrase>
  </command>
  <command id="306" name="Show upcoming games" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>&lt;date&gt;(.*?)&lt;/date&gt;&lt;game&gt;(.*?)&lt;/game&gt;&lt;time&gt;(.*?)&lt;/time&gt;&lt;channel&gt;(.*?)&lt;/channel</param>
        <param> - </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Upcoming games are:</param>
        <param>6000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>{Match.{i}}</param>
      </params>
      <cmdRepeat>5</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <params>
        <param>Upcoming games are:</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{Match.{i}}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Show upcoming games</phrase>
  </command>
  <command id="315" name="Clean up dates" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Sun,</param>
        <param>Sunday,</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Mon,</param>
        <param>Monday,</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Tue,</param>
        <param>Tuesday,</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Wed,</param>
        <param>Wednesday,</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Thu,</param>
        <param>Thursday,</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Fri,</param>
        <param>Friday,</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Sat,</param>
        <param>Saturday,</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Jan </param>
        <param>January </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Feb </param>
        <param>February </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Mar </param>
        <param>March </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Apr </param>
        <param>April </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Jun </param>
        <param>June </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Jul </param>
        <param>July </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Aug </param>
        <param>August </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Sep </param>
        <param>September </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Oct </param>
        <param>October </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Nov </param>
        <param>November </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>Dec </param>
        <param>December </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>nba.xml</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>cleanup</event>
  </command>
  <command id="325" name="Are there any N.B.A. games today?" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <params>
        <param>{DtCustom.MMMM d}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>\s</param>
        <param>.</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>today</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>nba.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>&lt;date&gt;\w.*?{var.today}&lt;/date&gt;(.*?)\n</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>Results.SetLastResult</cmdType>
          <params>
            <param>{Match.1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>game&gt;(.*?)&lt;/game&gt;&lt;time&gt;(.*?)&lt;/time&gt;&lt;channel&gt;(.*?)&lt;/channel</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Today's games:</param>
            <param>8000</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.AddText</cmdType>
          <params>
            <param>{Match.{i}.1} at {Match.{i}.2} on {Match.{i}.3}</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>Today's games are</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>{Match.{i}.1} at {Match.{i}.2}, on {Match.{i}.3}</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Sorry. No games today. Would you like to see upcoming games?</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>Sorry. No games today. Would you like to see upcoming games?</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.TellVox</cmdType>
          <params>
            <param>Show upcoming games</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Are there any games today?</phrase>
  </command>
</commandGroup>

My TTS voice actually interprets month abbreviations correctly and reads out the whole name of the month, but I guess that's not a universal feature.

Title: Re: Lookup NBA schedule and perform the following actions
Post by: 2exclusive on October 06, 2014, 05:56:09 PM
works perfect, thanks
Title: Re: Lookup NBA schedule and perform the following actions
Post by: gvanbrunt on October 07, 2014, 04:54:30 PM
This API may be cleaner:

http://developer.espn.com/docs/scores#using-the-api

I believe it has daily schedules. Not sure if it is ESPN only schedules.
Title: Re: Lookup NBA schedule and perform the following actions
Post by: gvanbrunt on October 07, 2014, 04:55:53 PM
scratch that. no public access...