From 8415a652a6f06e5fe2e0ae3be405c7856508e612 Mon Sep 17 00:00:00 2001 From: Debayan Date: Sun, 13 Mar 2022 01:46:18 +0530 Subject: [PATCH 1/4] added screen recorder --- PA.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/PA.py b/PA.py index 52d2e72..5171741 100644 --- a/PA.py +++ b/PA.py @@ -26,6 +26,9 @@ import winshell as winshell # pip install winshell from geopy.geocoders import Nominatim # pip install geopy and pip install geocoder from geopy import distance +import cv2 +import psutil +import numpy as np engine = pyttsx3.init() @@ -65,6 +68,41 @@ def get_command(): return query +def screen_record(): #Screen Recording function + + user = psutil.users()[0].name #gets the user name + f_path = "C:\\Users\\" + user + "\\Desktop" + # f_path = input("Enter where u want to save the file") #can also have an option as to where the user wants to save the file + if os.path.exists(f_path): + save_file = os.path.join(f_path,"output.mp4") + else: + save_file ="output.mp4" #saves the file in the corresponding directory + + s_size = (1920,1080) + fps = 10.0 #determines how fast the slow the playback speed will be + + fcc = cv2.VideoWriter_fourcc(*"mp4v") + out = cv2.VideoWriter(save_file,fcc,fps,(s_size)) + + while 1: + + img = pyautogui.screenshot() + frm = np.array(img) + frm = cv2.cvtColor(frm,cv2.COLOR_BGR2RGB) + cv2.imshow("recorder",frm) + cv2.namedWindow("recorder",cv2.WINDOW_NORMAL) + cv2.resizeWindow("recorder", 800,800) + out.write(frm) + + key = cv2.waitKey(1) # q to close the window and stop recording + if key == 113: + break + + cv2.destroyAllWindows() + out.release() + + + if __name__ == '_main_': wish_user() while True: @@ -676,3 +714,7 @@ def send_whtmsg(): except Exception as e: pass + + elif 'screen recording' in query: + fun_talk('press q to stop and save recording') ## screen recorrder functionality + screen_record() \ No newline at end of file From c87162a4c82a898bbac35c1bf8e004611403ea6f Mon Sep 17 00:00:00 2001 From: Debayan Date: Wed, 30 Mar 2022 23:03:11 +0530 Subject: [PATCH 2/4] moved screenrecord function to a different file --- PA.py | 41 ++--------------------------------------- record.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 39 deletions(-) create mode 100644 record.py diff --git a/PA.py b/PA.py index 5171741..70e4f56 100644 --- a/PA.py +++ b/PA.py @@ -26,9 +26,7 @@ import winshell as winshell # pip install winshell from geopy.geocoders import Nominatim # pip install geopy and pip install geocoder from geopy import distance -import cv2 -import psutil -import numpy as np +import record engine = pyttsx3.init() @@ -68,41 +66,6 @@ def get_command(): return query -def screen_record(): #Screen Recording function - - user = psutil.users()[0].name #gets the user name - f_path = "C:\\Users\\" + user + "\\Desktop" - # f_path = input("Enter where u want to save the file") #can also have an option as to where the user wants to save the file - if os.path.exists(f_path): - save_file = os.path.join(f_path,"output.mp4") - else: - save_file ="output.mp4" #saves the file in the corresponding directory - - s_size = (1920,1080) - fps = 10.0 #determines how fast the slow the playback speed will be - - fcc = cv2.VideoWriter_fourcc(*"mp4v") - out = cv2.VideoWriter(save_file,fcc,fps,(s_size)) - - while 1: - - img = pyautogui.screenshot() - frm = np.array(img) - frm = cv2.cvtColor(frm,cv2.COLOR_BGR2RGB) - cv2.imshow("recorder",frm) - cv2.namedWindow("recorder",cv2.WINDOW_NORMAL) - cv2.resizeWindow("recorder", 800,800) - out.write(frm) - - key = cv2.waitKey(1) # q to close the window and stop recording - if key == 113: - break - - cv2.destroyAllWindows() - out.release() - - - if __name__ == '_main_': wish_user() while True: @@ -717,4 +680,4 @@ def send_whtmsg(): elif 'screen recording' in query: fun_talk('press q to stop and save recording') ## screen recorrder functionality - screen_record() \ No newline at end of file + record.screen_record() \ No newline at end of file diff --git a/record.py b/record.py new file mode 100644 index 0000000..ed6dfdb --- /dev/null +++ b/record.py @@ -0,0 +1,40 @@ +import cv2 +import psutil +import numpy as np +import os +import pyautogui + + + +def screen_record(): #Screen Recording function + + user = psutil.users()[0].name #gets the user name + f_path = "C:\\Users\\" + user + "\\Desktop" + # f_path = input("Enter where u want to save the file") #can also have an option as to where the user wants to save the file + if os.path.exists(f_path): + save_file = os.path.join(f_path,"output.mp4") + else: + save_file ="output.mp4" #saves the file in the corresponding directory + + s_size = (1920,1080) + fps = 10.0 #determines how fast the slow the playback speed will be + + fcc = cv2.VideoWriter_fourcc(*"mp4v") + out = cv2.VideoWriter(save_file,fcc,fps,(s_size)) + + while 1: + + img = pyautogui.screenshot() + frm = np.array(img) + frm = cv2.cvtColor(frm,cv2.COLOR_BGR2RGB) + cv2.imshow("recorder",frm) + cv2.namedWindow("recorder",cv2.WINDOW_NORMAL) + cv2.resizeWindow("recorder", 800,800) + out.write(frm) + + key = cv2.waitKey(1) # q to close the window and stop recording + if key == 113: + break + + cv2.destroyAllWindows() + out.release() \ No newline at end of file From 3c3497af0ac37cc487751e09328dfb2562e76c9f Mon Sep 17 00:00:00 2001 From: Debayan <55997552+Phoenix-031@users.noreply.github.com> Date: Wed, 6 Apr 2022 15:13:56 +0530 Subject: [PATCH 3/4] updated changes --- PA.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PA.py b/PA.py index a3a9d5b..a202bee 100644 --- a/PA.py +++ b/PA.py @@ -72,7 +72,7 @@ def get_command(): return query -if __name__ == '_main_': +if __name__ == '__main__': wish_user() while True: query = get_command().lower() From 2d2c0b84de47ce0b0ee979c8591c962c3ebb000b Mon Sep 17 00:00:00 2001 From: Debayan Date: Wed, 6 Apr 2022 15:31:55 +0530 Subject: [PATCH 4/4] updated PA.py file --- PA.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PA.py b/PA.py index a202bee..21d9ad4 100644 --- a/PA.py +++ b/PA.py @@ -26,6 +26,9 @@ import winshell as winshell # pip install winshell from geopy.geocoders import Nominatim # pip install geopy and pip install geocoder from geopy import distance +import turtle +import random +import snake_game import record engine = pyttsx3.init()