Author Topic: Ggcal plugin  (Read 5609 times)

0 Members and 1 Guest are viewing this topic.

StrikemanXL

  • $upporter
  • Jr. Member
  • *****
  • Posts: 13
  • Karma: 1
    • View Profile
Ggcal plugin
« on: July 02, 2013, 03:34:51 PM »
Hi guys. Iv just purchased vox commando because its so awesum :)
Iv set up gmail and xbmc ect just fine but Im having a little problem with Ggcal. It tells me there is an event but unlike Gmail that gives me a list of received mail ect I just get "TTS: 3 events " from my GgCal.GetToday action. 
Iv tried using the variables but its still come up the same :( Maybe Iv missed some thing in the Ggcal plugin setup? Thanks

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Ggcal plugin
« Reply #1 on: July 02, 2013, 03:57:46 PM »
Hello Extra Large Strikeman,

Welcome to VC.

That action results multiple results as "matches" which can be accessed as {Match.1} {Match.2} etc.  Same idea as multiple regex matches.

You have a few options on how to deal with these, but the simplest is to use Results.MatchConcat

here's an example:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="1078" name="TV this week" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>GgCal.GetRange</cmdType>
    <cmdString>0&amp;&amp;7&amp;&amp;TV</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.MatchConcat</cmdType>
    <cmdString>{CR}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.AddText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase optional="true">What's on</phrase>
  <phrase>TV this week</phrase>
</command>

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Ggcal plugin
« Reply #2 on: July 02, 2013, 04:02:01 PM »
Here's another way:

This one loops the action the correct number of times.  {#M} gives you the number of matches and {i} gives you the loop iteration number, so the first time the action is executed {i} is 1, then 2 etc.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="1089" name="TV this week (action loop)" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>GgCal.GetRange</cmdType>
    <cmdString>0&amp;&amp;7&amp;&amp;TV</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.AddText</cmdType>
    <cmdString>TV show: {Match.{i}}</cmdString>
    <cmdRepeat>{#M}</cmdRepeat>
  </action>
  <phrase optional="true">What's on</phrase>
  <phrase>TV this week</phrase>
</command>

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Ggcal plugin
« Reply #3 on: July 02, 2013, 04:14:56 PM »
and finally, the most powerful method using Results.MatchToEvent

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="calendar match events" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1116" name="TV this week (by events)" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>GgCal.GetRange</cmdType>
      <cmdString>0&amp;&amp;7&amp;&amp;TV</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>{LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchToEvent</cmdType>
      <cmdString>calevent&amp;&amp;4</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase optional="true">What's on</phrase>
    <phrase>TV this week</phrase>
  </command>
  <command id="1117" name="deal with calendar event" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <cmdString>{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <cmdString>(\d+)x(\d+)&amp;&amp;season $1, episode $2</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>{LastResult}&amp;&amp;-200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>{LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>calevent</event>
  </command>
</commandGroup>

This method allows you to do more complex macros for each element in the set of matches.  In this example, my TV calendar returns the shows as: Dexter 4x5 and so I can use regex replace to turn that into Dexter Season 4, Episode 5.

StrikemanXL

  • $upporter
  • Jr. Member
  • *****
  • Posts: 13
  • Karma: 1
    • View Profile
Re: Ggcal plugin
« Reply #4 on: July 02, 2013, 07:17:09 PM »
Easy as pie  ;D  Thanks mate.

02/07/2013 23:12:49   463   doCommand:Events this week (action loop)
02/07/2013 23:12:49   463   action repeat set to: 1
02/07/2013 23:12:49   464   Action:  GgCal.GetRange - 0&&7&&StrikemanXL
02/07/2013 23:12:49   780   action repeat set to: 1
02/07/2013 23:12:49   781   Action:  OSD.ShowText - 3 events
02/07/2013 23:12:49   813   action repeat set to: 3
02/07/2013 23:12:49   813   Action:  OSD.AddText - Calendar Events: Tuesday 20:18  Vox commando Rocks!!
02/07/2013 23:12:49   843   Action:  OSD.AddText - Calendar Events: Tuesday 22:18 ghgkhgkhghgk
02/07/2013 23:12:49   871   Action:  OSD.AddText - Calendar Events: Wednesday 09:30 google calendar :)
02/07/2013 23:12:49   900   action repeat set to: 3
02/07/2013 23:12:49   901   Action:  TTS.Speak - Tuesday 20:18  Vox commando Rocks!!
02/07/2013 23:12:49   943   Action:  TTS.Speak - Tuesday 22:18 ghgkhgkhghgk
02/07/2013 23:12:49   981   Action:  TTS.Speak - Wednesday 09:30 google calendar :)



SunDoWneR

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
    • www.en4ce.com
Re: Ggcal plugin
« Reply #5 on: October 15, 2013, 05:31:35 PM »
Hey,
I added quite a few calendars to Google calendar (e.g. The Walking dead form tvcountdown.com) and they show up under "more calendars" (if i guess the eng translation right).

I can get the events from "my calendars" but not from "more calendars".
Is there a workaround to get the "external" calendars?

Cheers Sunny

PS: Sorry for the endless seeming questions, but It's your fault, that you created such a nice prog ;) with many possibilities
 

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Ggcal plugin
« Reply #6 on: October 15, 2013, 06:54:23 PM »
Yes.  I know.  I am an idiot and a masochist.   :bonk

I have several calendars and use them without any problems.  I'm not familiar with  tvcountdown.com so I don't know what kind of calendars they are but if they are public calendars that belong to someone else, and not your calendars, then I guess that is the problem.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Ggcal plugin
« Reply #7 on: October 15, 2013, 07:18:24 PM »
I don't think that's the problem. At least, I just imported a tvcountdown.com calendar to my Google calendars and it showed up in my VC GgCal feeds as soon as I refreshed the list.
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: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Ggcal plugin
« Reply #8 on: October 15, 2013, 07:44:43 PM »
Yeah, me too. Works great.

SunDoWneR

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
    • www.en4ce.com
Re: Ggcal plugin
« Reply #9 on: October 15, 2013, 08:01:30 PM »
I also get a Connection Error, when i press the green "refresh" or "reconnect" arrows.
I also renamed the tvcountdown cals (e.g. "The walking dead", "Falling Skies" etc.)
In my "Feeds to Scan" List there is a tvcountdown.com calendar, which should be renamed, am I right?

cheers, Sunny

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Ggcal plugin
« Reply #10 on: October 15, 2013, 08:45:22 PM »
Connection error doesn't sound good.  That's a mystery.

Maybe you have too many calendars.  You can put all your TV shows into a single calendar.

I did not rename the tvcountdown.com calendar and it shows up in my feeds fine.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Ggcal plugin
« Reply #11 on: October 15, 2013, 09:12:55 PM »
I was able to recreate your connection error.  The problem comes from renaming someone else's feed.  Gooogle doesn't really rename it so it still shows up as the original feed name.  Now when you add another feed from the same service, it has the same "true" name as one that is already in your calendar, and I guess this is what is creating the error.

So just remove all the calendars (unsubscribe) from tvcountdown.com and then combine them all into a single calendar and don't rename it and you should be fine.

SunDoWneR

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
    • www.en4ce.com
Re: Ggcal plugin
« Reply #12 on: October 16, 2013, 05:51:51 AM »
schweet, works now =)

thx again!

SunDoWneR

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
    • www.en4ce.com
Re: Ggcal plugin
« Reply #13 on: October 16, 2013, 07:02:32 AM »
So ...

I'd like to have an eventlist for (e.g.) today from all of my calendars.
I came up with a pretty long, and slow, "actionlist" which works, but definetly can be optimized in one way or another.

- GgCal.GetDay:0&&CalendarName (Get the Evens from calendar X)
- Results.MatchConcat:{CR} (Concatenates all matches into a single string that is stored in {LastResult})
- Results.StoreLast:VarName (Stores my {Lastresult} into a variable)
- If (A)==(B) {var.VarName} is empty -> then do nothing
- else display {var.VarName}

If you want to have a summary of all calendars (in my case 8) for (e.g.) today this "actionlist" is getting pretty long.

Is there an other way to "string" them together?
I already tried to sepreate the calendars by comma (,) or | but it doesn't work.

Cheers, Sunny




jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Ggcal plugin
« Reply #14 on: October 16, 2013, 12:51:27 PM »
I think you are doing it the correct way.  You just have an unusually large number of calendars (I think).

By the way you can just copy your command from the tree editor and then paste it into a code block on the forum when composing your message.  Probably easier for you than doing screen captures, and MUCH easier for others who want to experiment with your command without having to recreate the whole thing by hand.