Skip to content

Commit 0b0908b

Browse files
committed
Remove not use dependency And add recording
Remove not use dependency And add recording
1 parent e1f4d34 commit 0b0908b

File tree

14 files changed

+59
-87
lines changed

14 files changed

+59
-87
lines changed

.idea/workspace.xml

Lines changed: 2 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ sphinx
66
sphinx-rtd-theme
77
Pyside6==6.8.1
88
qt-material
9+
mss

je_auto_control/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
package_manager
6161
from je_auto_control.utils.project.create_project_structure import \
6262
create_project_dir
63+
# Scheduler
64+
from je_auto_control.utils.scheduler.extend_apscheduler import SchedulerManager
6365
# Shell command
6466
from je_auto_control.utils.shell_process.shell_exec import ShellManager
6567
from je_auto_control.utils.shell_process.shell_exec import default_shell_manager
@@ -102,8 +104,7 @@
102104
# import screen
103105
from je_auto_control.wrapper.auto_control_screen import screen_size
104106
from je_auto_control.wrapper.auto_control_screen import screenshot
105-
# Scheduler
106-
from je_auto_control.utils.scheduler.extend_apscheduler import SchedulerManager
107+
107108
__all__ = [
108109
"click_mouse", "mouse_keys_table", "get_mouse_position", "press_mouse", "release_mouse",
109110
"mouse_scroll", "set_mouse_position", "special_mouse_keys_table",

je_auto_control/gui/main_widget.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

je_auto_control/gui/main_window.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

je_auto_control/linux_with_x11/core/utils/x11_linux_display.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
import os
1010
from Xlib.display import Display
1111

12-
1312
# get x system display
1413
display = Display(os.environ['DISPLAY'])
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import threading
2+
3+
import cv2
4+
import numpy as np
5+
from mss import mss
6+
7+
from je_auto_control.utils.logging.loggin_instance import autocontrol_logger
8+
9+
10+
class RecordingThread(threading.Thread):
11+
12+
def __init__(self, video_name: str = "autocontrol_recoding"):
13+
autocontrol_logger.info("Init RecordingThread")
14+
super().__init__()
15+
self.recoding_flag = True
16+
self.video_name = video_name
17+
18+
def set_recoding_flag(self, recoding_flag: bool):
19+
autocontrol_logger.info(f"RecordingThread set_recoding_flag recoding_flag: {recoding_flag}")
20+
self.recoding_flag = recoding_flag
21+
22+
def run(self):
23+
with mss() as sct:
24+
resolution = sct.monitors[0]
25+
self.video_name = self.video_name + '.mp4'
26+
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
27+
desired_fps = 20
28+
video_writer = cv2.VideoWriter(self.video_name, fourcc, desired_fps,
29+
(resolution['width'], resolution['height']))
30+
while self.recoding_flag:
31+
screen_image = sct.grab(resolution)
32+
image_rgb = cv2.cvtColor(np.array(screen_image), cv2.COLOR_BGRA2BGR)
33+
video_writer.write(image_rgb)
34+
else:
35+
video_writer.release()
File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import urllib.request
2+
import shutil
3+
4+
from je_auto_control.utils.logging.loggin_instance import autocontrol_logger
5+
6+
7+
def download_file(url: str, file_name: str):
8+
autocontrol_logger.info("file_download.py download_file"
9+
f" url: {url} "
10+
f" file_name: {file_name}")
11+
with urllib.request.urlopen(url) as response, open(file_name, 'wb') as out_file:
12+
shutil.copyfileobj(response, out_file)

je_auto_control/utils/logging/loggin_instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class AutoControlGUILoggingHandler(RotatingFileHandler):
1111
# redirect logging stderr output to queue
1212

1313
def __init__(self, filename: str = "AutoControlGUI.log", mode="w",
14-
maxBytes:int=1073741824, backupCount:int=0):
14+
maxBytes: int = 1073741824, backupCount: int = 0):
1515
super().__init__(filename=filename, mode=mode, maxBytes=maxBytes, backupCount=backupCount)
1616
self.formatter = formatter
1717
self.setLevel(logging.DEBUG)

0 commit comments

Comments
 (0)