<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Name="Configuration Tree" Expanded="True" Version="1366" Guid="{C6AD0FA1-358B-4D67-BE9A-D906541D786E}" Time="1266376656.23">
    <Autostart Name="Autostart" id="2" Expanded="True">
        <Plugin File="XBCDRC" Identifier="XBCDRC">
            gAJYAAAAAHEAiIZxAS4=
        </Plugin>
        <Action Name="init">
            EventGhost.PythonScript(u'import xml.dom.minidom                                                  #   Module used in xml parsing\neg.Bunch(remotePrefix=\'TEXT\')                                           #   Save the remote prefixthat is used in the plugin\ntry:\n##  Begin XML Remote Button Map Configuration Input\n    xmlDoc=xml.dom.minidom.parse("buttonMap.xml")                       #   Open the xml button map document\n    root=xmlDoc.childNodes[0]                                           #   Skip the first line of the XML file; Prolly a better way to do this...\n    remotes=root.childNodes\n    for remote in xmlDoc.getElementsByTagName(\'remote\'):                #   Traverse each remote node\n        prefixNode=remote.getElementsByTagName(\'eventPrefix\')           #   Retrieve remote\'s prefix to be used\n        prefix= prefixNode[0].childNodes[0].data.strip()                #       in the event name\n        for button in remote.getElementsByTagName(\'button\'):            #   Traverse each remote\'s button\n            codeNode=button.getElementsByTagName(\'code\')                #   Retrieve the event code\n            code=codeNode[0].firstChild.data.strip()                    #   Trim whitespace charachters from the parsed XML entry\n            eventNode=button.getElementsByTagName(\'event\')              #   Retrieve the event name\n            event=eventNode[0].firstChild.data.strip()                  #   Trim whitespace charachters from the parsed XML entry\n            xbcdrc_mapping = eg.result.thread.xbcdrc_mapping\n            xbcdrc_mapping[str(code)]=str(prefix+\'_\'+event)             #   Add code to mapping dictionary\n    #print xbcdrc_mapping                                               #   Debug: print map file generated from retrieved XML\n    #print eg.globals.xbcdrc_mapping                                     #   Debug: print xbcdrc map\n    eg.globals.xbcdrc_mapping=xbcdrc_mapping                            #   Stores the codes retrieved from the XML file in the xbcdrc plugin code dictionary\n    ##  END XML Remote Button Map Configuration Input\nexcept:\n    eg.PrintError(\'Button map file not found.\\n No additional button codes will be loaded at this time.\')')
        </Action>
        <Plugin File="XBMC" Identifier="XBMC">
            gAIpLg==
        </Plugin>
        <Plugin File="Speech" Identifier="Speech">
            gAIpLg==
        </Plugin>
    </Autostart>
    <Folder Name="RemoteLearning">
        <Macro Name="Learning Script">
            <Event Name="XBCDRC.UNKNOWN" />
            <Action Name="Learn">
                EventGhost.PythonScript(u'#print eg.event\n#print eg.event.payload\nimport StringIO, inspect, re\nimport xml.dom.minidom                                          #   Module used in xml parsing\nfrom xml.dom.minidom import Document\ninputRemote=\'XBox Remote\'                                       #   Default remote name I used.  I did this to be lazy for myself.  Change as you will.\ndoc = Document()                                                #   XML Document object\nRemoveFirstLine=1                                               #   Default value set to remove the first line of the XML file\ndef CleanText(s):                                               #   I did this just to remove the first line in the XML file\n    s=\'\'                                                        #       to make the document more closely resemble other ones I use.\n    count=0                                                     #       This function call is not neccissary, and probably shouldn\'t be used\n    for line in xmlText.split(\'\\n\'):                            #       as it really makes the xml invalid, in a way...\n        if count&gt;0:\n            if line.strip():\n                s += line + \'\\n\'\n        count = count+1\n    return s                        \n\ndef AddRemote(name, prefix):\n    doc = Document()\n    remoteNode=doc.createElement(\'remote\')                      #   Create an xml node named \'remote\'\n    remoteName=doc.createElement(\'name\')                        #   Create an xml node named \'name\'\n    remoteNameText=doc.createTextNode(name)                     #   Create a xml text node of \'name\'\n    remoteName.appendChild(remoteNameText)                      #   Add text node to name node\n    remoteNode.appendChild(remoteName)                          #   Add name node to remote node\n    remotePrefix=doc.createElement(\'eventPrefix\')               #   Create a xml node named \'eventPrefix\'\n    remotePrefixText=doc.createTextNode(prefix)                 #   Create a xml text node of \'prefix\'\n    remotePrefix.appendChild(remotePrefixText)                  #   Add text node to eventPrefix node\n    remoteNode.appendChild(remotePrefix)                        #   Add eventPrefix node to remote node\n    buttons=doc.createElement(\'buttons\')                        #   Create a xml node named \'buttons\'\n    remoteNode.appendChild(buttons)                             #   Add buttons node to remote node\n    return remoteNode\n    \ndef AddButton(buttonsNode, eventName):\n    doc = Document()                                            #   Create a new XML document\n    button = doc.createElement(\'button\')                        #   Create a button node\n    code = doc.createElement(\'code\')                            #   Create a code node\n    codeText=doc.createTextNode(eg.event.payload)               #   Create code text node\n    code.appendChild(codeText)                                  #   Insert text node to code node\n    event = doc.createElement(\'event\')                          #   Create event node\n    eventText = doc.createTextNode(eg.event.payload)            #   Create event text node where the text is \n                                                                #       the payload from the unknown code error\n    event.appendChild(eventText)                                #   Insert text node to event node\n    button.appendChild(event)                                   #   Add event node to button\n    button.appendChild(code)                                    #   Add code node to button\n    print \'debugging\'                                           #   Debug\n    print button.toxml()                                        #   Debug\n    buttonsNode.appendChild(button)                             #   Adds button node to buttons\n\n#    print buttonsNode.toprettyxml(indent=\'  \')                 #   Debug\ntry:                                                            #   Error handling for if keymap file exists\n    xmlDoc=xml.dom.minidom.parse("buttonMap.xml")               #   Open the xml button map document\n    root=xmlDoc.childNodes[0]\nexcept:\n    xmlDoc=doc.createElement(\'xml\')                             #   Create a new XML document with only a node of XML\n#remotes=root.childNodes\n#print eg.event.payload                                          #  Debug: event payload\nremoteFound=0                                                   #   Initialises remote as not being found\nfor remote in xmlDoc.getElementsByTagName(\'remote\'):            #   Traverse each remote node\n    nameNode=remote.getElementsByTagName(\'name\')                #   Retrieve remote\'s name to be used\n    name= nameNode[0].childNodes[0].data.strip()                #       in the event name\n    prefixNode=remote.getElementsByTagName(\'prefix\')            #   Retrieve remote\'s prefix to be used\n    prefix= nameNode[0].childNodes[0].data.strip()              #       in the event name\n    if inputRemote==name:                                       #   Check to see if a remote named \'name\' is found\n        remoteFound=1                                           #   Sets remote as being found\n        buttonsNode=remote.getElementsByTagName(\'buttons\')      #   Get the buttons node (the first one should be the only one used)\n        buttonsNode=buttonsNode[0]                              \n        AddButton(buttonsNode, prefix)                          #   Add a button to the buttons node in remote\nif remoteFound==0:                                              #   Checks to see if remote was not found\n    print \'Remote not found\'                                    #   Debug\n    NewRemote=AddRemote(inputRemote, inputRemote)               #   Add remote named as \'inputRemote\'\n    try:                                                        #   Test to see if this works.  If there was no file, an error is thrown...\n        remote=xmlDoc.getElementsByTagName(\'xml\')[0]\n    except:                                                     #   And here\'s the resolution of that error...\n        remote=xmlDoc  \n        RemoveFirstLine=0                                       #   Sets the first line of the xml to not be removed\n    remote.appendChild(NewRemote)                                #   Adds new remote to the XML file\n#    print remote.toxml()                                        #   Debug: prints the remote xml tree\n#print xmlDoc.toxml()                                            #   Output the contents of the XML file to screen\nxmlText = str(xmlDoc.toprettyxml(indent=\'\\t\'))\nif RemoveFirstLine==1:                                          #   If the first line is needed to be removed from the XML, this is done here.\n    xmlText=CleanText(xmlText)\nfile = open(\'buttonMap.xml\', \'w\')                               #   Open the XML button map file for writing\nfile.write(xmlText)                                             #   Write contents to the XML button map file\nfile.close()                                                    #   Close the file\n')
            </Action>
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(2), 2, True)
            </Action>
        </Macro>
        <Folder Name="OpenXML">
            <Macro Name="Python Script">
                <Action>
                    EventGhost.PythonScript(u'')
                </Action>
            </Macro>
        </Folder>
    </Folder>
    <Folder Name="XBMC">
        <Macro Name="Up">
            <Event Name="XBCDRC.UP" />
            <Action>
                XBMC.Up()
            </Action>
        </Macro>
        <Macro Name="Down">
            <Event Name="XBCDRC.DOWN" />
            <Action>
                XBMC.Down()
            </Action>
        </Macro>
        <Macro Name="Left">
            <Event Name="XBCDRC.LEFT" />
            <Action>
                XBMC.Left()
            </Action>
        </Macro>
        <Macro Name="Right">
            <Event Name="XBCDRC.RIGHT" />
            <Action>
                XBMC.Right()
            </Action>
        </Macro>
        <Macro Name="Page Up">
            <Event Name="XBCDRC.CH+" />
            <Action>
                XBMC.PageUp()
            </Action>
        </Macro>
        <Macro Name="Page Down">
            <Action>
                XBMC.PageDown()
            </Action>
        </Macro>
        <Macro Name="Select">
            <Event Name="XBCDRC.SELECT" />
            <Action>
                XBMC.Select()
            </Action>
        </Macro>
        <Macro Name="Previous Menu">
            <Action>
                XBMC.PreviousMenu()
            </Action>
        </Macro>
        <Macro Name="Context Menu">
            <Event Name="XBCDRC.MENU" />
            <Action>
                XBMC.ContextMenu()
            </Action>
        </Macro>
        <Macro Name="Play">
            <Event Name="XBCDRC.PLAY" />
            <Action>
                XBMC.Play()
            </Action>
        </Macro>
        <Macro Name="Pause">
            <Event Name="XBCDRC.PAUSE" />
            <Action>
                XBMC.Pause()
            </Action>
        </Macro>
        <Macro Name="Stop">
            <Event Name="XBCDRC.STOP" />
            <Action>
                XBMC.Stop()
            </Action>
        </Macro>
        <Macro Name="Fast Forward">
            <Event Name="XBCDRC.SKIP+" />
            <Action>
                XBMC.FastForward()
            </Action>
        </Macro>
        <Macro Name="Rewind">
            <Event Name="XBCDRC.SKIP-" />
            <Action>
                XBMC.Rewind()
            </Action>
        </Macro>
        <Macro Name="Skip Next">
            <Event Name="XBCDRC.6" />
            <Action>
                XBMC.SkipNext()
            </Action>
        </Macro>
        <Macro Name="Skip Previous">
            <Event Name="XBCDRC.4" />
            <Action>
                XBMC.SkipPrevious()
            </Action>
        </Macro>
        <Macro Name="Record">
            <Event Name="XBCDRC.REC" />
            <Action>
                XBMC.Record()
            </Action>
        </Macro>
        <Macro Name="Big Skip Backward">
            <Action>
                XBMC.BigSkipBackward()
            </Action>
        </Macro>
        <Macro Name="Big Skip Forward">
            <Action>
                XBMC.BigSkipForward()
            </Action>
        </Macro>
        <Macro Name="Small Skip Backward">
            <Action>
                XBMC.SmallSkipBackward()
            </Action>
        </Macro>
        <Macro Name="Small Skip Forward">
            <Action>
                XBMC.SmallSkipForward()
            </Action>
        </Macro>
        <Macro Name="Aspect Ratio">
            <Action>
                XBMC.AspectRatio()
            </Action>
        </Macro>
        <Macro Name="Codec Info">
            <Action>
                XBMC.CodecInfo()
            </Action>
        </Macro>
        <Macro Name="Full Screen">
            <Action>
                XBMC.FullScreen()
            </Action>
        </Macro>
        <Macro Name="Repeat">
            <Action>
                XBMC.Repeat()
            </Action>
        </Macro>
        <Macro Name="Show Subtitles">
            <Event Name="XBCDRC.CC" />
            <Action>
                XBMC.ShowSubtitles()
            </Action>
        </Macro>
        <Macro Name="Show OSD" Expanded="True">
            <Event Name="XBCDRC.MENU" />
            <Action>
                XBMC.OSD()
            </Action>
        </Macro>
        <Macro Name="Show Time" Expanded="True">
            <Action>
                XBMC.ShowTime()
            </Action>
        </Macro>
        <Macro Name="Volume Up">
            <Event Name="XBCDRC.VOL+" />
            <Action>
                XBMC.VolumeUp()
            </Action>
        </Macro>
        <Macro Name="Volume Down" Expanded="True">
            <Event Name="XBCDRC.VOL-" />
            <Action>
                XBMC.VolumeDown()
            </Action>
        </Macro>
        <Macro Name="Mute" Expanded="True">
            <Event Name="XBCDRC.MUTE" />
            <Action>
                XBMC.Mute()
            </Action>
        </Macro>
        <Macro Name="Scroll Up" Expanded="True">
            <Action>
                XBMC.ScrollUp()
            </Action>
        </Macro>
        <Macro Name="Scroll Down">
            <Action>
                XBMC.ScrollDown()
            </Action>
        </Macro>
        <Macro Name="Close">
            <Event Name="XBCDRC.BACK" />
            <Event Name="XBCDRC.EXIT" />
            <Action>
                XBMC.Close()
            </Action>
        </Macro>
        <Macro Name="Number 0" Expanded="True">
            <Action>
                XBMC.Number0()
            </Action>
        </Macro>
        <Macro Name="Number 1">
            <Action>
                XBMC.Number1()
            </Action>
        </Macro>
        <Macro Name="Number 2">
            <Action>
                XBMC.Number2()
            </Action>
        </Macro>
        <Macro Name="Number 3">
            <Action>
                XBMC.Number3()
            </Action>
        </Macro>
        <Macro Name="Number 4">
            <Action>
                XBMC.Number4()
            </Action>
        </Macro>
        <Macro Name="Number 5">
            <Action>
                XBMC.Number5()
            </Action>
        </Macro>
        <Macro Name="Number 6">
            <Action>
                XBMC.Number6()
            </Action>
        </Macro>
        <Macro Name="Number 7">
            <Action>
                XBMC.Number7()
            </Action>
        </Macro>
        <Macro Name="Number 8">
            <Action>
                XBMC.Number8()
            </Action>
        </Macro>
        <Macro Name="Number 9">
            <Action>
                XBMC.Number9()
            </Action>
        </Macro>
        <Macro Name="Playlist">
            <Event Name="XBCDRC.7" />
            <Action>
                XBMC.Playlist()
            </Action>
        </Macro>
        <Macro Name="Queue" Expanded="True">
            <Event Name="XBCDRC.0" />
            <Action>
                XBMC.Queue()
            </Action>
        </Macro>
        <Macro Name="Move Item Up" Expanded="True">
            <Event Name="XBCDRC.8" />
            <Action>
                XBMC.MoveItemUp()
            </Action>
        </Macro>
        <Macro Name="Move Item Down" Expanded="True">
            <Event Name="XBCDRC.9" />
            <Action>
                XBMC.MoveItemDown()
            </Action>
        </Macro>
        <Macro Name="Delete" Expanded="True">
            <Event Name="XBCDRC.DASH" />
            <Action>
                XBMC.Delete()
            </Action>
        </Macro>
        <Macro Name="Random" Expanded="True">
            <Action>
                XBMC.Random()
            </Action>
        </Macro>
        <Macro Name="Repeat">
            <Action>
                XBMC.Repeat()
            </Action>
        </Macro>
        <Macro Name="Party Mode">
            <Action>
                XBMC.PartyMode()
            </Action>
        </Macro>
        <Macro Name="Parent Dir">
            <Event Name="XBCDRC.EXIT" />
            <Event Name="XBCDRC.BACK" />
            <Action>
                XBMC.ParentDir()
            </Action>
        </Macro>
        <Macro Name="Info" Expanded="True">
            <Event Name="XBCDRC.INFO" />
            <Action>
                XBMC.Info()
            </Action>
        </Macro>
        <Macro Name="Take Screen Shot" Expanded="True">
            <Action>
                XBMC.TakeScreenShot()
            </Action>
        </Macro>
        <Macro Name="Eject Tray">
            <Action>
                XBMC.EjectTray()
            </Action>
        </Macro>
        <Macro Name="Play DVD">
            <Action>
                XBMC.PlayDVD()
            </Action>
        </Macro>
        <Macro Name="Show Home Screen">
            <Event Name="XBCDRC.1" />
            <Action>
                XBMC.Home()
            </Action>
        </Macro>
        <Macro Name="Show Videos Screen" Expanded="True">
            <Event Name="XBCDRC.2" />
            <Action>
                XBMC.MyVideos()
            </Action>
        </Macro>
        <Macro Name="Show Music Screen" Expanded="True">
            <Event Name="XBCDRC.3" />
            <Action>
                XBMC.MyMusic()
            </Action>
        </Macro>
        <Macro Name="Show Pictures Screen" Expanded="True">
            <Action>
                XBMC.MyPictures()
            </Action>
        </Macro>
        <Macro Name="Show Movies Screen">
            <Action>
                XBMC.MyMovies()
            </Action>
        </Macro>
        <Macro Name="Show TV Shows Screen">
            <Action>
                XBMC.MyTVShows()
            </Action>
        </Macro>
        <Macro Name="Show Weather Screen">
            <Action>
                XBMC.Weather()
            </Action>
        </Macro>
        <Macro Name="Show Settings Screen">
            <Action>
                XBMC.Settings()
            </Action>
        </Macro>
        <Macro Name="Show Favorites Screen">
            <Action>
                XBMC.Favorites()
            </Action>
        </Macro>
        <Macro Name="Show System Info Screen">
            <Event Name="XBCDRC.GUIDE" />
            <Action>
                XBMC.SystemInfo()
            </Action>
        </Macro>
        <Macro Name="Last FM Love" Expanded="True">
            <Action>
                XBMC.LastFMLove()
            </Action>
        </Macro>
        <Macro Name="Last FM Ban">
            <Action>
                XBMC.LastFMBan()
            </Action>
        </Macro>
        <Macro Name="Update Video Library">
            <Action>
                XBMC.UpdateVideoLibrary()
            </Action>
        </Macro>
        <Macro Name="Update Music Library">
            <Action>
                XBMC.UpdateMusicLibrary()
            </Action>
        </Macro>
        <Macro Name="Show Shutdown Menu">
            <Action>
                XBMC.ShutdownMenu()
            </Action>
        </Macro>
        <Macro Name="Quit XBMC">
            <Action>
                XBMC.Quit()
            </Action>
        </Macro>
        <Macro Name="Shutdown Computer">
            <Action>
                XBMC.Shutdown()
            </Action>
        </Macro>
        <Macro Name="Powerdown Computer">
            <Action>
                XBMC.Powerdown()
            </Action>
        </Macro>
        <Macro Name="Suspend Computer">
            <Action>
                XBMC.Suspend()
            </Action>
        </Macro>
        <Macro Name="Hibernate Computer">
            <Action>
                XBMC.Hibernate()
            </Action>
        </Macro>
        <Macro Name="Reset Computer">
            <Action>
                XBMC.Reset()
            </Action>
        </Macro>
        <Macro Name="Start Program: XBMC.exe">
            <Event Name="XBCDRC.DISPLAY" />
            <Action>
                System.Execute(u'C:\\Program Files\\XBMC\\XBMC.exe', u'-fs', 0, False, 2, u'C:\\Program Files\\XBMC')
            </Action>
            <Action>
                Window.FindWindow(u'XBMC.exe', None, None, None, None, None, False, 0.0, 0)
            </Action>
            <Action Enabled="False">
                EventGhost.Wait(5.0)
            </Action>
            <Action>
                Window.BringToFront()
            </Action>
            <Action>
                Window.SendKeys(u'\\', True)
            </Action>
        </Macro>
    </Folder>
</EventGhost>
