Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
Fix error when meet ended by host
Browse files Browse the repository at this point in the history
  • Loading branch information
pixincreate authored Apr 22, 2021
1 parent fc13491 commit d9d4d56
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions Source/Automeet.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,12 @@ def live_count(): # Print Live count of participants
pass


def end_class(): # Ends the current session
def end_class(did_host_end): # Ends the current session
live_count.max_count = 0
live_count.left_or_rec_stop = ""
time.sleep(10)
# Clicks leave call button
try:
driver.find_element_by_xpath("//div[@aria-label='Leave call']").click() # "class_name = U26fgb"
except NoSuchElementException:
driver.find_element_by_class_name("EIlDfe").click() # An empty click to make bottom bar visible
driver.implicitly_wait(2)
driver.find_element_by_xpath("//div[@aria-label='Leave call']").click()
except ElementNotInteractableException:
driver.find_element_by_class_name("EIlDfe").click() # An empty click to make bottom bar visible
driver.implicitly_wait(2)
driver.find_element_by_xpath("//div[@aria-label='Leave call']").click()
except StaleElementReferenceException:
if not did_host_end:
# Clicks leave call button
try:
driver.find_element_by_xpath("//div[@aria-label='Leave call']").click() # "class_name = U26fgb"
except NoSuchElementException:
Expand All @@ -270,6 +260,17 @@ def end_class(): # Ends the current session
driver.find_element_by_class_name("EIlDfe").click() # An empty click to make bottom bar visible
driver.implicitly_wait(2)
driver.find_element_by_xpath("//div[@aria-label='Leave call']").click()
except StaleElementReferenceException:
try:
driver.find_element_by_xpath("//div[@aria-label='Leave call']").click() # "class_name = U26fgb"
except NoSuchElementException:
driver.find_element_by_class_name("EIlDfe").click() # An empty click to make bottom bar visible
driver.implicitly_wait(2)
driver.find_element_by_xpath("//div[@aria-label='Leave call']").click()
except ElementNotInteractableException:
driver.find_element_by_class_name("EIlDfe").click() # An empty click to make bottom bar visible
driver.implicitly_wait(2)
driver.find_element_by_xpath("//div[@aria-label='Leave call']").click()

double_quotes = "\""
print("{:<120s}".format(f"{'The meeting ' + double_quotes + classTitle + double_quotes + ' ended now.'}\r"), end="", flush=True)
Expand Down Expand Up @@ -523,19 +524,23 @@ def exit_now(): # Exits the script
try:
if "Your host ended the meeting for everyone" in driver.find_element_by_class_name("CRFCdf"):
print('Meeting will end now as Host ended the meeting.', end='\r', flush=True)
end_class()
host_ended = 1
end_class(host_ended)
break
elif int(live_count.number_of_participants) <= int(live_count.max_count) // 4:
print('Meeting will end now as Number of People Reduced to 1/4th the total strength.', end='\r', flush=True)
end_class()
host_ended = 0
end_class(host_ended)
break
elif "Several participants left the meeting." in live_count.left_or_rec_stop:
print('Meeting will end now as Several participants left the meeting.', end='\r', flush=True)
end_class()
host_ended = 0
end_class(host_ended)
break
elif "stopped recording" in live_count.left_or_rec_stop:
print('Meeting will end now as the recording stopped.', end='\r', flush=True)
end_class()
host_ended = 0
end_class(host_ended)
break
else:
pass
Expand Down

0 comments on commit d9d4d56

Please sign in to comment.