Author Topic: Auto update xlm files every morning  (Read 2045 times)

0 Members and 1 Guest are viewing this topic.

Minefield

  • Jr. Member
  • **
  • Posts: 17
  • Karma: 0
    • View Profile
Auto update xlm files every morning
« on: December 02, 2014, 06:11:28 AM »
I'm trying to automate the 'generate xml' command every morning to keep my media library up to date, but am having real problems.
I've set an 'VC.SetEventTimer' on VC start to trigger an event called 'trigger xml gen' at 5:00 everyday.
This event activates a command that.
1. opens XBMC
2. waits 5 minutes (vc.pause 300000) (this gives xbmc a chance to update it's media).
3 generates xml
4. quick restarts VC
5. sets the trigger again for the next morning (VC.SetEventTimer 23h 55m 00s)
6 closes XBMC

At 5.00 the event was triggered but 25 times (13 yesterday).  This means that all of the above steps were executed 25 times (taking over 2 hours).

I know I'm doing something fundamentally wrong but can't find a definitive set of instructions on how to automate the generating of the xml files.

Any help would ne appreciated. Thanks.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Auto update xlm files every morning
« Reply #1 on: December 02, 2014, 07:36:49 AM »
post your xml

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Auto update xlm files every morning
« Reply #2 on: December 02, 2014, 08:09:23 AM »
Hi Minefield, to help you it would be nice you post your command and also the voxLog.txt

I'm not sure if it is a good idea to use VC.Pause for such a long time. I think it is better to split your command in different parts.

Try this command group, but take a look if the path to xbmc and the generate XML command is correct.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.2.5-->
<commandGroup open="False" name="gen XBMC XML each day at 5:00 AM" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="303" name="set a timer to start xbmc at 5:00 AM " enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>5:00 AM</param>
        <param>open XBMC</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>VC.Loaded</event>
    <event>set the timer again</event>
  </command>
  <command id="304" name="open xbmc and set a timer to wait 5 minutes" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Launch.RawParam</cmdType>
      <params>
        <param>{path.pfx86}\XBMC\XBMC.exe</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>5m</param>
        <param>trigger XML gen</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>open XBMC</event>
  </command>
  <command id="305" name="gen XML" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>xMySql.GenerateAll</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>VC.TriggerEvent</cmdType>
          <params>
            <param>set the timer again</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.RestartQuick</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>XJson.ExecBuiltin</cmdType>
      <params>
        <param>quit</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>trigger XML gen</event>
  </command>
</commandGroup>
« Last Edit: December 02, 2014, 08:11:44 AM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Auto update xlm files every morning
« Reply #3 on: December 02, 2014, 02:13:32 PM »
If you are using xSQL to generate XML for XBMC (and most users should be using this method) then XBMC does not need to be running in order to generate XML.  It would be sufficient to run your command at 5AM and just generateXML without opening XBMC.  Presumably you use XBMC in the evening so your library should be up to date.  Of course it is possible that you have files being downloaded overnight or something like that.

Another solution that is much simpler is to have VC automatically update XML whenever XBMC has finished updating its library.  I am posting code below that will do just that.  Depending on how large your library is and how often XBMC updates the library, you might not want to use this method.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.2.5-->
<command id="209" name="XBMC AutoGenXml" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XSQL.GenerateAll</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Group.RefreshAll</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Update Media X M L</phrase>
  <event>XBMC.VideoLibrary.OnScanFinished</event>
</command>
« Last Edit: December 02, 2014, 02:15:56 PM by nime5ter »

Minefield

  • Jr. Member
  • **
  • Posts: 17
  • Karma: 0
    • View Profile
Re: Auto update xlm files every morning
« Reply #4 on: December 11, 2014, 10:45:16 AM »
Thanks guys the support.
Kalle, you're solution was far more elegant than mine, and more importantly it works.
James, I do have media arriving during the night, that's why I wanted it to index in the morning.