Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
anhatsingh committed Jul 28, 2021
1 parent 72e9f24 commit 318732b
Show file tree
Hide file tree
Showing 28 changed files with 45 additions and 452 deletions.
14 changes: 6 additions & 8 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
google:
username:
password:
username: [email protected]
password: Anhat@2001

meet:
minimum_participants_before_exiting_meet: 30
minimum_participants_before_exiting_meet: 20
link_to_search_for_in_whatsapp: meet.google.com

whatsapp:
groups_to_search_in:
- 2sem, Asec, ECL-119, Elec
- 2Sem, Asec, CYL-197, Chem
- 2sem, Asec,CSL-126,python
- CSE Sem II (A) ENL101
- Automation

obs:
record_meetings: 1
location_to_obs_shortcut: C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\OBS Studio\\OBS Studio (64bit).lnk
video_save_location: E:\\AnhatUser\\Videos\\

time:
time_in_minutes_to_search_for_messages_in_whatsapp: 15
time_in_seconds_to_wait_before_logout_checker_starts: 360
time_in_seconds_to_wait_before_logout_checker_starts: 900
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 21 additions & 37 deletions google_interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,19 @@ def login(self, username, passwd):
return 0


def joinMeet(self, possibleLink):
print(str(datetime.now()) + ": Meet: initiating meeting")

possibleLink.click()
window_after = self.driver.window_handles[1]
self.driver.switch_to_window(window_after)
def joinMeet(self, link):
self.driver.execute_script('window.open("'+link+'","_blank");')
self.driver.implicitly_wait(100)
time.sleep(3)
self.driver.switch_to_window(self.driver.window_handles[1])
time.sleep(1)


self.driver.find_element_by_css_selector('body').send_keys(self.keys.CONTROL + 'd')
print(str(datetime.now()) + ": Meet: mic turned off")
self.driver.find_element_by_css_selector('body').send_keys(self.keys.CONTROL + 'e')
print(str(datetime.now()) + ": Meet: camera turned off")
buttons = self.driver.find_elements_by_css_selector('.U26fgb.JRY2Pb.mUbCce.kpROve.uJNmj.QmxbVb.HNeRed.M9Bg4d')
buttons[0].click()
buttons[1].click()

#time.sleep(5)
print(str(datetime.now()) + ": Meet: joining now")
#time.sleep(5)
self.driver.find_element_by_css_selector('div.uArJ5e.UQuaGc.Y5sE8d.uyXBBb.xKiqt').click()
print(str(datetime.now()) + ": Meet: waiting to join")

Expand All @@ -60,46 +57,33 @@ def joinMeet(self, possibleLink):
try:
if(self.driver.find_element_by_css_selector('span.wnPUne.N0PJ8e')):
waitingToJoin = 0
time.sleep(2)
print(str(datetime.now()) + ": Meet: joining successful")
except:
print(str(datetime.now()) + ": Meet: waiting to join")

def changeMeetLayout(self):
self.driver.find_element_by_css_selector('.U26fgb.c7fp5b.FS4hgd.nByyte').click()
self.driver.find_elements_by_css_selector('.z80M1')[1].click()
self.driver.find_elements_by_css_selector('.E5wxQe')[3].click()


def checkForLogout(self, minParticipants, obs, wantToRecord):
def checkForLogout(self, minParticipants):
count = 0
try:
print(str(datetime.now()) + ": Meet: logout checker initiated")
time.sleep(20)
numOfParticipants = self.driver.find_element_by_css_selector('span.wnPUne.N0PJ8e').text
print(str(datetime.now()) + ": Meet: number of participants are " + numOfParticipants)

numOfParticipants = self.driver.find_element_by_css_selector('span.wnPUne.N0PJ8e').text
while(int(numOfParticipants) >= minParticipants):
numOfParticipants = self.driver.find_element_by_css_selector('span.wnPUne.N0PJ8e').text
print(str(datetime.now()) + ": Meet: number of participants are " + numOfParticipants)
numOfParticipants = self.driver.find_element_by_css_selector('span.wnPUne.N0PJ8e').text
time.sleep(5)

print(str(datetime.now()) + ": Meet: participants (" + numOfParticipants + ") less than the minimum required to attend meet (" + str(minParticipants) + ")")

if(wantToRecord):
obs.startOrStopRecording(0)
print(str(datetime.now()) + ": Meet: exiting meeting")
self.driver.close()

window_after = self.driver.window_handles[0]
self.driver.switch_to_window(window_after)

self.driver.close()
time.sleep(2)

print(str(datetime.now()) + ": Meet: exit successful")
print(str(datetime.now()) + ": Whatsapp: reinitiating link checker")
self.driver.switch_to_window(self.driver.window_handles[0])

except:
print(str(datetime.now()) + ": Meet: error finding number of participants (" + str(count) + ")")
count += 1
time.sleep(5)
if(count <= 20):
print(str(datetime.now()) + ": Meet: reinitiating logout checker")
self.checkForLogout(minParticipants, obs, wantToRecord)
self.checkForLogout(minParticipants)
else:
print(str(datetime.now()) + ": Meet: unable to initiate logout checker, contact dev")

35 changes: 0 additions & 35 deletions init_selenium.py

This file was deleted.

38 changes: 0 additions & 38 deletions introduction.py

This file was deleted.

File renamed without changes.
77 changes: 0 additions & 77 deletions main.py

This file was deleted.

File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions readme.md

This file was deleted.

49 changes: 18 additions & 31 deletions recording_interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,31 @@
import time
from datetime import datetime


class obsHandler:

def __init__(self, locationToObsShortcut):
self.location = locationToObsShortcut

def focusOnObs(self):
obsWindow = gw.getWindowsWithTitle('OBS')[0]
#obsWindow.maximize()
obsWindow.activate()
def focusOnObs(self):
time.sleep(2)
obsWindow = gw.getWindowsWithTitle('OBS')[0]
pyautogui.hotkey('win', '5')
obsWindow.resizeTo(1095, 794)
obsWindow.moveTo(0,0)
time.sleep(2)

def focusOn(self, keyword):
meetWindow = gw.getWindowsWithTitle(keyword)[0]
meetWindow.activate()
meetWindow.maximize()
def focusOnMeet(self):
pyautogui.hotkey('win', '7')

def openObs(self):
print(str(datetime.now()) + ": OBS: starting obs")
os.startfile(self.location)
#se_ret = shell.ShellExecuteEx(fMask=0x140, lpFile=r"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\OBS Studio\\OBS Studio (64bit).lnk", nShow=1)
#win32event.WaitForSingleObject(se_ret['hProcess'], -1)
def openObs(self):
#os.startfile(self.location)
pyautogui.hotkey('win', '5')
time.sleep(3)

def startOrStopRecording(self, state):
if(state):
print(str(datetime.now()) + ": OBS: getting obs")
self.focusOnObs()
time.sleep(5)
pyautogui.click(1050, 620)
print(str(datetime.now()) + ": OBS: recording started")
time.sleep(1)

if(not state):
print(str(datetime.now()) + ": OBS: getting obs")
self.focusOnObs()
time.sleep(5)
pyautogui.click(1050, 620)
print(str(datetime.now()) + ": OBS: recording stopped")

print(str(datetime.now()) + ": OBS: going back to meet")
self.focusOn("Meet")
def startOrStopRecording(self, returnName=False):
self.focusOnObs()
pyautogui.click(1050, 620)
self.focusOnMeet()
if(returnName):
return datetime.now()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions test.py

This file was deleted.

Binary file removed v2/chromedriver.exe
Binary file not shown.
20 changes: 0 additions & 20 deletions v2/config.yml

This file was deleted.

Loading

0 comments on commit 318732b

Please sign in to comment.