<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Name="Configuration Tree" Expanded="True" Version="1462" Guid="{88243FD0-14F1-49BB-873F-FDA16BBA4A1B}" Time="1289829615.21">
    <Autostart Name="Autostart" Expanded="True">
        <Plugin File="DirectoryWatcher" Identifier="DirectoryWatcher">
            gAJYFQAAAEM6XHRlbXAyXDEuIENvbXBsZXRlZHEAiYZxAS4=
        </Plugin>
        <Plugin File="DirectoryWatcher" Identifier="DirectoryWatcher2">
            gAJYEwAAAEM6XHRlbXAyXDMuIENsZWFuZWRxAImGcQEu
        </Plugin>
    </Autostart>
    <Folder Name="1.0" Expanded="True">
        <Macro Name="Download Completed" Expanded="True">
            <Event Name="DirectoryWatcher.Created" />
            <Action Name="Make a copy">
                EventGhost.PythonScript(u'import shutil\nimport string\nimport os\n\nsourcePath = \'\'.join(eg.event.payload)\ndestPath = \'C:\\\\temp2\\\\2. To be cleaned\\\\\'\nIGNORE_PATTERNS = (\'*.txt\',\'*.nfo\',\'*.tbn\',\'.png\',\'*.jpg\',\'*sample*\')\n\ndestPath += string.split(sourcePath, \'\\\\\')[3]\n\nif (os.path.isdir(sourcePath) == False):\n    if ((sourcePath.find(\'.txt\') == -1) and\n    (sourcePath.find(\'.nfo\') == -1) and\n    (sourcePath.find(\'.tbn\') == -1) and\n    (sourcePath.find(\'.png\') == -1) and\n    (sourcePath.find(\'.jpg\') == -1)):\n        os.mkdir(destPath)\n        print "Copying file form " + sourcePath + " to " + destPath\n        shutil.copy2(sourcePath, destPath)\n    else:\n        print "Skipping file " + sourcePath\nelse:   \n    if (sourcePath.find(\'sample\') == -1):\n        print "Copying folder form " + sourcePath + " to " + destPath\n        shutil.copytree(sourcePath, destPath, ignore=shutil.ignore_patterns(*IGNORE_PATTERNS))\n    else:\n        print "Skipping folder " + sourcePath')
            </Action>
            <Action Name="Rename files">
                System.Execute(u'C:\\Program Files (x86)\\theRenamer\\theRenamer.exe', u'-fetchmovie', 1, True, 2, u'')
            </Action>
            <Action Name="Delete leftover">
                EventGhost.PythonScript(u'import shutil\nimport string\nimport os\n\nsourcePath = \'\'.join(eg.event.payload)\ndestPath = \'C:\\\\temp2\\\\2. To be cleaned\\\\\'\n\ndestPath += string.split(sourcePath, \'\\\\\')[3]\n\nprint "Deleting folder " + destPath\n\nshutil.rmtree(destPath);')
            </Action>
        </Macro>
        <Macro Name="File Ready to be scraped" Expanded="True">
            <Event Name="DirectoryWatcher2.Created" />
            <Action Name="Scrape for info">
                System.Execute(u'C:\\Users\\cyril.monpellier\\AppData\\Ember Media Manager\\Ember Media Manager.exe', u'-newauto -all', 1, True, 2, u'C:\\Users\\cyril.monpellier\\AppData\\Ember Media Manager\\')
            </Action>
            <Action Name="Move to NAS">
                EventGhost.PythonScript(u'import shutil\nimport string\nimport os\n\nsourcePath = \'\'.join(eg.event.payload)\ndestPath = \'\\\\NAS\\\\Volume_1\\\\Movies\'\n\ndestPath += string.split(sourcePath, \'\\\\\')[3]\n\nshutil.copytree(sourcePath, destPath)\nprint "Moved " + sourcePath + " to NAS!"')
            </Action>
        </Macro>
    </Folder>
</EventGhost>
