summaryrefslogtreecommitdiff
path: root/domestic/make/make_image.py
blob: 2697633dc47bf7ff809205ebc08f1a8a602e8f81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from domestic.utility.status_message import *
from domestic.make.make_directories import *
from domestic.utility.get_filename import *
from domestic.global_state import *


def make_image(directories, data, show_image=True, success_message=None, image_type=None):
  filename = get_filename('png')
  username = state['session']['username']
  path = f'{state["root"]}/{username}/{directories[-1]}/{filename}'     
  directories_to_make = [username] + [f'{username}/{directory}' for directory in directories]
  make_directories(directories_to_make)

  if image_type is None or (image_type and state['options']['information-gathering']['save']['screenshot']) or (not image_type and state['options']['information-gathering']['save']['cam-screenshot']):
    data.save(path)

  if show_image:
    data.show()
  
  if success_message:
    if image_type is None or (image_type and state['options']['information-gathering']['save']['screenshot']) or (not image_type and state['options']['information-gathering']['save']['cam-screenshot']):
      status_message(f'Path: {path}\n{success_message}', 'success')
    else:
      status_message(success_message, 'success')