Example #1
0
def deleteSeqOrEp(seqOrEp):

    # Removes the sequence/episode locally
    log('seqOrEp[dir]: %s' % seqOrEp['dir'])
    if os.path.exists(seqOrEp['dir']):
        log('Sequence directory exists!')
        while True:
            try:
                shutil.rmtree(seqOrEp['dir'])
                break
            except OSError:
                sikuli.popup('Could not delete sequence directory.\nClose any application that could be'
                             ' accessing files from the %s sequence directory and try again.' % seqOrEp['name'])

    # Removes the sequence/episode from the remote location
    if seqOrEp['remote'] == '1':
        sshUtils = '%sassets/ssh/' % seqOrEp['testPath']
        putty = '%sputty.exe' % sshUtils
        key = '%sivo.ppk' % sshUtils
        ssh = '[email protected]'
        script = '%s%s.sh' % (sshUtils, seqOrEp['name'])

        if os.path.exists(script):
            cmd = "\"%s\" -ssh -i \"%s\" %s -m \"%s\"" % (putty, key, ssh, script)
            log('PUTTY cmd:\n%s' % cmd.replace('/', '\\'), 'debug')

            subprocess.Popen(cmd.replace('/', '\\'), shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            # log('Deleting the sequence remotely...', 'debug')
            sikuli.App.focus('Google Chrome') # make sure the putty window is out of the way
            wait(3)
        else:
            log('deleteSeqOrEp: Could not find the script to remove %s.' % seqOrEp['name'], 'error')
Example #2
0
def emptyDir(path):

    if countFiles(path, '*') != 0:
        try:
            shutil.rmtree(path)
            print 'emptyDir: Emptied %s' % path
        except OSError:
            sikuli.popup('Could not delete contents of Flix directory.\nClose any application that could be accessing files from it.')
Example #3
0
def deleteShow(showDir):
    """Deletes the given show directory

    :param showDir: Path to the show directory to be deleted
    :return: None
    """
    if os.path.exists(showDir):
        log("Show directory exists")
        while True:
            try:
                shutil.rmtree(showDir)
                break
            except OSError:
                sikuli.popup('Could not delete show directory.\nClose any application that could be'
                             ' accessing files from the following directory and try again: %s' % showDir)