def save_element(screen_area, element_name, db): element_area = db_query.get_element_area(screen_area, element_name, db) for item in db_query.get_element_data(element_area, db): image_name = str(math.floor(time.time())) + ".png" image_path = os.path.join(IMAGES_FOLDER, str(datetime.datetime.now().date()), str(item['screen_area']), image_name) image_processing.imaging(item['x_coordinate'], item['y_coordinate'], item['width'], item['height'], image_path, item['screen_area'], db) return element_area
def save_flop_image(screen_area, image_name, folder_name, db): for value in db_query.get_flop_data( db_query.get_flop_area(screen_area, db), db): image_path = os.path.join(folder_name, str(db_query.get_flop_area(screen_area, db)), image_name) image_processing.imaging(value['x_coordinate'], value['y_coordinate'], value['width'], value['height'], image_path, value['screen_area'], db)
def save_opponent_stack_image(screen_area, folder_name, opponent_area, db): image_name = int(math.floor(time.time())) for val in db_query.get_opponent_stack_data(screen_area, opponent_area, db): image_path = folder_name + "/" + str( val['screen_area']) + "/" + str(image_name) + ".png" image_processing.imaging(val['x_coordinate'], val['y_coordinate'], val['width'], val['height'], image_path, str(val['screen_area']), db) image_name += 1
def save_opponent_card_image(screen_area, folder_name, db): image_name = int(math.floor(time.time())) opponent_area = [] for val in db_query.get_opponent_card_data(screen_area, db): image_path = folder_name + "/" + str( val['screen_area']) + "/" + str(image_name) + ".png" image_processing.imaging(val['x_coordinate'], val['y_coordinate'], val['width'], val['height'], image_path, val['screen_area'], db) image_name += 1 opponent_area.append(val['opponent_area']) return opponent_area
def check_is_fold(screen_area, x_coordinate, y_coordinate, width, height, image_path, db): last_hand = session_log.get_last_row_from_log_session(screen_area, db)[0]['hand'] last_hand = last_hand[:4] image_processing.imaging(x_coordinate, y_coordinate, width, height, image_path, screen_area, db) cur_hand = image_processing.search_cards(screen_area, db_query.get_cards(db), 4, db) if last_hand != cur_hand: folder_name = IMAGES_FOLDER + '/' + str(datetime.datetime.now().date()) image_name = str(math.floor(time.time())) + ".png" session_log.update_action_log_session('end', str(screen_area), db) current_stack.save_stack_image(screen_area, image_name, folder_name, db) check_conditions_before_insert(cur_hand, int(screen_area), db_query.get_stack_images(db), image_name, folder_name, db) get_decision(screen_area, db) return True
def save_stack_image(screen_area, image_name, folder_name, db): try: for val in db_query.get_stack_data( db_query.get_stack_area(screen_area, db), db): image_path = os.path.join( folder_name, str(db_query.get_stack_area(screen_area, db)), image_name) image_processing.imaging(val['x_coordinate'], val['y_coordinate'], val['width'], val['height'], image_path, str(val['screen_area']), db) except Exception as e: error_log.error_log('saveStackImage', str(e)) print(e)
def save_bar_image(screen_area, image_name, folder_name, db): try: folder_name = folder_name + str(datetime.datetime.now().date()) for value in db_query.get_bar_data( db_query.get_bar_area(screen_area, db), db): image_path = folder_name + "/" + str( db_query.get_bar_area(str(screen_area), db)) + "/" + image_name + ".png" image_processing.imaging(value['x_coordinate'], value['y_coordinate'], value['width'], value['height'], image_path, value['screen_area'], db) except Exception as e: error_log.error_log('red_mark', str(e))
def save_bank_stack_image(screen_area, db): try: image_name = str(math.floor(time.time())) + ".png" folder_name = 'images/' + str(datetime.datetime.now().date()) for val in db_query.get_stack_data( db_query.get_bank_stack_area(screen_area, db), db): image_path = os.path.join( folder_name, str(db_query.get_bank_stack_area(screen_area, db)), image_name) image_processing.imaging(val['x_coordinate'], val['y_coordinate'], val['width'], val['height'], image_path, val['screen_area'], db) except Exception as e: error_log.error_log('saveAllinStackImage', str(e)) print(e)
def start(): global APP_STATE if not APP_STATE: APP_STATE = remote_control.get_app_state() for item in SCREEN_DATA: mouse.move_mouse(item['x_mouse'], item['y_mouse']) if metka.search_bar(item['screen_area'], DB): image_name = str(math.floor(time.time())) + ".png" image_path = os.path.join(IMAGES_FOLDER, str(datetime.datetime.now().date()), str(item['screen_area']), image_name) last_row_action = session_log.get_last_row_action_from_log_session( item['screen_area'], DB) if last_row_action in ('push', 'fold', 'end'): image_processing.imaging(item['x_coordinate'], item['y_coordinate'], item['width'], item['height'], image_path, item['screen_area'], DB) hand = image_processing.search_cards(item['screen_area'], DECK, 4, DB) introduction.check_conditions_before_insert( hand, item['screen_area'], STACK_COLLECTION, image_name, FOLDER_NAME, DB) introduction.get_decision(item['screen_area'], DB) elif last_row_action in ('open', 'call', 'check'): introduction.action_after_open( item['x_coordinate'], item['y_coordinate'], item['width'], item['height'], image_path, item['screen_area'], last_row_action, image_name, FOLDER_NAME, DECK, STACK_COLLECTION, DB) elif last_row_action == 'cbet': postflop.action_after_cbet(item['x_coordinate'], item['y_coordinate'], item['width'], item['height'], image_path, item['screen_area'], DECK, STACK_COLLECTION, DB) elif last_row_action in ('turn_cbet', 'river_cbet'): postflop.action_after_turn_cbet(item['x_coordinate'], item['y_coordinate'], item['width'], item['height'], image_path, item['screen_area'], DECK, STACK_COLLECTION, DB) elif last_row_action == 'cc_postflop': postflop.action_after_cc_postflop(item['screen_area'], DECK, item['x_coordinate'], item['y_coordinate'], item['width'], item['height'], image_path, STACK_COLLECTION, DB) elif last_row_action == 'value_bet': postflop.action_after_value_bet(item['screen_area'], item['x_coordinate'], item['y_coordinate'], item['width'], item['height'], image_path, DB) else: hand = session_log.get_last_row_from_log_session( item['screen_area'], DB) if image_processing.check_current_hand(item['screen_area'], hand[0]['hand'], DB): introduction.get_decision(str(item['screen_area']), DB) else: session_log.update_action_log_session( 'end', str(item['screen_area']), DB)