Skip to content

Commit

Permalink
Fix zoom modal window, fix zoom links, add zoom finished handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
F33RNI committed Mar 11, 2023
1 parent 9cd1998 commit 3b51f39
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
28 changes: 25 additions & 3 deletions BrowserHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,23 @@ def handler_loop(self):

# Zoom handlers
elif self.link_type == LINK_TYPE_ZOOM:
# Finished
if len(self.browser.find_elements(By.CLASS_NAME, 'zm-modal-body-title')) > 0 \
or len(self.browser.find_elements(By.CLASS_NAME, 'zm-modal2-body-title')) > 0:
# Finished?
is_finished = False
zm_modal_body_titles = self.browser.find_elements(By.CLASS_NAME, 'zm-modal-body-title')
zm_modal2_body_titles = self.browser.find_elements(By.CLASS_NAME, 'zm-modal2-body-title')
feedback_wrap_hideme_rows = self.browser.find_elements(By.CLASS_NAME, 'feedback-wrap hideme row')
error_messages = self.browser.find_elements(By.CLASS_NAME, 'error-message')
if len(zm_modal_body_titles) > 0:
html_ = str(zm_modal_body_titles[0].get_attribute('innerHTML')).lower()
if 'ended' in html_ or 'finished' in html_ or 'завершен' in html_:
is_finished = True
if len(zm_modal2_body_titles) > 0:
html_ = str(zm_modal2_body_titles[0].get_attribute('innerHTML')).lower()
if 'ended' in html_ or 'finished' in html_ or 'завершен' in html_:
is_finished = True
if len(feedback_wrap_hideme_rows) > 0 or len(error_messages) > 0:
is_finished = True
if is_finished:
logging.warning('Event finished! Closing browser...')
if self.browser is not None:
self.stop_browser_and_recording.emit(True)
Expand All @@ -264,6 +278,14 @@ def handler_loop(self):
if len(join_audio_by_voip_buttons) > 0:
join_audio_by_voip_buttons[0].click()

# Click OK on all zm modals
zm_modals = self.browser.find_elements(By.CLASS_NAME, 'zm-modal')
for zm_modal in zm_modals:
zm_modal_buttons = zm_modal.find_elements(By.TAG_NAME, 'button')
for zm_modal_button in zm_modal_buttons:
logging.info('Clicking on modal window button')
zm_modal_button.click()

###############
# Login stage #
###############
Expand Down
24 changes: 20 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import shutil
import signal
import sys
import webbrowser

import psutil
import requests
Expand All @@ -34,9 +35,9 @@
import LectureBuilder
import VideoAudioReader

WEBINAR_HACKER_VERSION = 'beta_4.0.1'
WEBINAR_HACKER_VERSION = 'beta_4.0.4'
WEBINAR_HACKER_VERSION_CHECK_URL = 'https://api.github.com/repos/F33RNI/Webinar-Hacker/releases/latest'
WEBINAR_HACKER_URL = 'https://github.com/F33RNI/Webinar-hacker'
WEBINAR_HACKER_URL = 'https://github.com/F33RNI/Webinar-hacker/releases/latest'

LOGGING_LEVEL = logging.INFO

Expand Down Expand Up @@ -276,9 +277,24 @@ def check_version(self):
# Check version
tag_name = request_result.json()['tag_name']
if tag_name is not None and len(tag_name) > 1 and tag_name != WEBINAR_HACKER_VERSION:
# Get changelog
changelog = ''
try:
changelog_raw = str(request_result.json()['body'])
changelog += changelog_raw.split('\r\n')[0].replace('#', '').strip()
changelog += '\n\n' + '\n'.join(changelog_raw.split('\r\n')[3:-2]).strip()
except:
pass

# Show update message
QMessageBox.information(self, 'New version available', 'Please download new version: '
+ tag_name + '\n' + WEBINAR_HACKER_URL)
+ tag_name + '\n' + WEBINAR_HACKER_URL + '\n\nChangelog:\n' + changelog)

# Open download page
try:
webbrowser.open(WEBINAR_HACKER_URL)
except:
pass

except Exception as e:
logging.warning(e)
Expand Down Expand Up @@ -647,7 +663,7 @@ def stop_browser(self, from_button: bool, from_zoom=False):
logging.info('Reconnecting...')
self.reconnects_counters[i][str(self.current_link_index)] = reconnected_times + 1
self.start_browser(False)
return
return
else:
logging.info('Reconnects disabled!')

Expand Down

0 comments on commit 3b51f39

Please sign in to comment.