Example #1
0
def thumb_image(screenshot_name): #https://stackoverflow.com/questions/1197172/how-can-i-take-a-screenshot-image-of-a-website-using-python
    thumb_name = screenshot_name[:-4] 
    screenshot_path = os.path.join(config[group]['screenshot_dir'], screenshot_name)
    thumb_path = os.path.join(config[group]['screenshot_dir'], thumb_name + "_thumb.png")

    result = Popen(' '.join(['convert',  screenshot_path, '-filter', 'Lanczos', '-thumbnail', '%sx%s' % (500,500), thumb_path]), shell=True, stdout=PIPE).stdout.read()
    if len(result) > 0 and not result.isspace():
        raise Exception(result)
Example #2
0
def execute_command(command):
    """Runs a shell command. If there's an error, raise it as an exception.
    
    Args:
        command: The shell command to run.
    """
    result = Popen(command, shell=True, stdout=PIPE).stdout.read()
    if len(result) > 0 and not result.isspace():
        raise Exception(result)
Example #3
0
def crop_image(screenshot_name): #https://stackoverflow.com/questions/1197172/how-can-i-take-a-screenshot-image-of-a-website-using-python
    
    crop_name = screenshot_name[:-4] 
    screenshot_path = os.path.join(config[group]['screenshot_dir'], screenshot_name)
    crop_path = os.path.join(config[group]['screenshot_dir'], crop_name + "_crop.png")

    result = Popen(' '.join(['convert',  screenshot_path, '-gravity', 'North', '-crop', '%sx%s+0+0' % (800,800), '+repage', crop_path]), shell=True, stdout=PIPE).stdout.read()
    if len(result) > 0 and not result.isspace():
        raise Exception(result)
Example #4
0
 def execute_command(command):
     result = Popen(command, shell=True, stdout=PIPE).stdout.read()
     if len(result) > 0 and not result.isspace():
         raise Exception(result)
Example #5
0
def executeCommand(command):
    """ Executes the screenshot command """
    result = Popen(command, shell=True, stdout=PIPE).stdout.read()
    if len(result) > 0 and not result.isspace():
        raise Exception(f"Failed to execute command with result : {result}")
Example #6
0
def execute_command(command):
    result = Popen(command, shell=True, stdout=PIPE).stdout.read()
    if len(result) > 0 and not result.isspace():
        raise Exception(result)
Example #7
0
def execute_command(command):
	print "Executing: " + command
	result = Popen(command, shell=True, stdout=PIPE).stdout.read()
	if len(result) > 0 and not result.isspace():
		#raise Exception(result)
		print(result)