コード例 #1
0
ファイル: wx_Ui.py プロジェクト: ctac1412/screenshot
 def update_current_stack_log_session(self, screen_area):
     if len(screen_area) > 0:
         for item in screen_area:
             db = postgresql.open(db_query.connection_string())
             db.query(
                 "UPDATE screen_coordinates SET active = CASE active WHEN 0 THEN 1 WHEN 1 THEN 0 ELSE active END "
                 "where screen_area = " + str(item))
コード例 #2
0
def error_log(module_name, error_message):
    db = postgresql.open(db_query.connection_string())
    insert = db.prepare(
        "insert into error_log (module_name, error_message) values($1,$2)")
    insert(module_name, str(error_message))
    data = ({'error_message': error_message})
    requests.post(url='http://cru.im/errorlog', json=data)
    play_alarm_sound()
コード例 #3
0
def check_is_folder_exist():
    folder_name = os.path.join(IMAGES_FOLDER,
                               str(datetime.datetime.now().date()))
    if not os.path.exists(str(folder_name)):
        os.makedirs(str(folder_name))
    db = postgresql.open(db_query.connection_string())
    data = db.query(
        "select screen_area from screen_coordinates "
        "union select screen_area from opponent_screen_coordinates")
    for value in data:
        if not os.path.exists(
                str(folder_name) + "/" + str(value['screen_area'])):
            os.makedirs(str(folder_name) + "/" + str(value['screen_area']))
コード例 #4
0
ファイル: screen.py プロジェクト: thisispoker/screenshot
import datetime
import math
import postgresql
import requests
import image_processing
import session_log
import mouse
import introduction
import bar as metka
import postflop
import db_query
import remote_control

IMAGES_FOLDER = "images/"
FOLDER_NAME = IMAGES_FOLDER + str(datetime.datetime.now().date())
DB = postgresql.open(db_query.connection_string())
SCREEN_DATA = db_query.get_screen_data(DB)
DECK = db_query.get_cards(DB)
STACK_COLLECTION = db_query.get_stack_images(DB)
APP_STATE = False


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,
コード例 #5
0
ファイル: error_log.py プロジェクト: ctac1412/screenshot
def error_log(module_name, error_message):
    db = postgresql.open(db_query.connection_string())
    print('Error:' + error_message)
    insert = db.prepare("insert into error_log (module_name, error_message) values($1,$2)")
    insert(module_name, str(error_message))
    play_alarm_sound()
コード例 #6
0
ファイル: wx_Ui.py プロジェクト: ctac1412/screenshot
 def get_curren_value(self, screen_area):
     db = postgresql.open(db_query.connection_string())
     data = db.query(
         "select active from screen_coordinates where screen_area = " +
         str(screen_area))
     return data[0]['active']
コード例 #7
0
ファイル: wx_Ui.py プロジェクト: ctac1412/screenshot
 def truncate_screenshot_table(self):
     db = postgresql.open(db_query.connection_string())
     db.query("truncate screenshots restart identity")
コード例 #8
0
import pytest
import postgresql
import db_query
import session_log


@pytest.mark.parametrize(
    'screen_area, db',
    (['1', '2', '3', '4'], [postgresql.open(db_query.connection_string())]))
def test_get_hand_value(screen_area, db):
    print(session_log.get_hand_value(screen_area, db))