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

Commit

Permalink
v1.1: Оптимизировал код и немного изменил его структуру.
Browse files Browse the repository at this point in the history
  • Loading branch information
mooronsi committed Nov 26, 2020
1 parent eb6fbdf commit b7ea76c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/
# Distribution / packaging
.Python
.idea/
release/
build/
develop-eggs/
dist/
Expand Down
34 changes: 20 additions & 14 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ def join(driver) -> None:
driver.close()


def meeting_loop(url, end_time) -> None:
""" Функция запуска браузера и ожидания конца встречи """

driver = wd.Chrome(options=options)
driver.get(url)
join(driver)

while True:
if end_time[0] == dt.now().hour and end_time[1] == dt.now().minute:
driver.close()
print("Встреча законилась.")

break

sleep(20)


def main() -> None:
""" Основная функция с планировщиком """

Expand All @@ -77,23 +94,12 @@ def main() -> None:
while True:
for item in schedule:
if item['start'][0] == dt.now().isoweekday():
if item['start'][1] == dt.now().hour and item['start'][2] == dt.now().minute and dt.now().second == 0:
url = item['url']
end_time = item['end']

sleep(1)

if item['start'][1] == dt.now().hour and item['start'][2] == dt.now().minute:
print("Выполняется вход...")

driver = wd.Chrome(options=options)
driver.get(url)
join(driver)
meeting_loop(url=item['url'], end_time=item['end'])

while True:
if end_time[0] == dt.now().hour and end_time[1] == dt.now().minute and dt.now().second == 0:
driver.close()
print("Встреча законилась.")
break
sleep(20)


if __name__ == '__main__':
Expand Down

0 comments on commit b7ea76c

Please sign in to comment.