News:

HOT TIP! In the command editor, you can ctrl-click and drag an item to create a copy of it.

Main Menu

Auto update xlm files every morning

Started by Minefield, December 02, 2014, 06:11:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Minefield

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


Kalle

#2
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.

<?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>
***********  get excited and make things  **********

jitterjames

#3
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.

<?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>

Minefield

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.