mirror of
https://github.com/MetaProvide/talked.git
synced 2025-01-10 19:47:46 +00:00
Add support for NC25 (#54)
This commit is contained in:
parent
7a7df5c973
commit
6a34c04253
5 changed files with 967 additions and 661 deletions
|
@ -2,6 +2,12 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 0.5.0 - 2023-02-03
|
||||
|
||||
### Added
|
||||
|
||||
- Support for Nextcloud 25
|
||||
|
||||
## 0.4.1 - 2022-09-19
|
||||
|
||||
### Added
|
||||
|
|
1573
poetry.lock
generated
1573
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "talked"
|
||||
version = "0.4.1"
|
||||
version = "0.5.0"
|
||||
description = "Call recording for Nextcloud Talk"
|
||||
authors = ["Magnus Walbeck <mw@mwalbeck.org>"]
|
||||
license = "AGPL-3.0-or-later"
|
||||
|
|
|
@ -5,7 +5,7 @@ import sys
|
|||
|
||||
from tomlkit import parse
|
||||
|
||||
__version__ = "0.4.1"
|
||||
__version__ = "0.5.0"
|
||||
|
||||
LOG_LEVELS = {
|
||||
"critical": logging.CRITICAL,
|
||||
|
|
|
@ -7,11 +7,9 @@ from queue import Queue
|
|||
from threading import Event
|
||||
|
||||
from pyvirtualdisplay import Display
|
||||
from selenium.common.exceptions import (
|
||||
ElementClickInterceptedException,
|
||||
NoSuchElementException,
|
||||
TimeoutException,
|
||||
)
|
||||
from selenium.common.exceptions import (ElementClickInterceptedException,
|
||||
NoSuchElementException,
|
||||
TimeoutException)
|
||||
from selenium.webdriver import Firefox
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
@ -139,13 +137,13 @@ def launch_browser(
|
|||
# Press escape to remove focus from chat.
|
||||
page.send_keys(Keys.ESCAPE)
|
||||
# Mute the talked user
|
||||
mute_user(driver)
|
||||
mute_user(driver, nextcloud_version)
|
||||
|
||||
# If grid view is set to False, switch to speaker view.
|
||||
if not grid_view:
|
||||
switch_to_speaker_view(driver, nextcloud_version)
|
||||
|
||||
close_sidebar(driver)
|
||||
close_sidebar(driver, nextcloud_version)
|
||||
|
||||
# Go fullscreen
|
||||
page.send_keys("f")
|
||||
|
@ -286,10 +284,16 @@ def join_call(driver: WebDriver, msg_queue: Queue, nextcloud_version: int) -> No
|
|||
graceful_shutdown(driver)
|
||||
|
||||
|
||||
def mute_user(driver: WebDriver) -> None:
|
||||
def mute_user(driver: WebDriver, nextcloud_version: int) -> None:
|
||||
logging.info("Muting Talked user")
|
||||
|
||||
if nextcloud_version >= 25:
|
||||
mute_button_css_selector = "#muteWrapper .button-vue:not(.no-audio-available)"
|
||||
else:
|
||||
mute_button_css_selector = "#mute:not(.audio-disabled)"
|
||||
|
||||
try:
|
||||
driver.find_element(By.CSS_SELECTOR, "#mute:not(.audio-disabled)").click()
|
||||
driver.find_element(By.CSS_SELECTOR, mute_button_css_selector).click()
|
||||
except NoSuchElementException:
|
||||
logging.info(("Mute button wasn't found. Assuming we are already muted."))
|
||||
|
||||
|
@ -303,12 +307,17 @@ def switch_to_speaker_view(driver: WebDriver, nextcloud_version: int) -> None:
|
|||
By.CSS_SELECTOR, ".local-media-controls button.action-item__menutoggle"
|
||||
).click()
|
||||
|
||||
if nextcloud_version >= 25:
|
||||
speaker_view_button_css_selector = "button.action-button .promoted-view-icon"
|
||||
else:
|
||||
speaker_view_button_css_selector = "button.action-button .icon-promoted-view"
|
||||
|
||||
try:
|
||||
WebDriverWait(driver, 2).until(
|
||||
EC.presence_of_element_located(
|
||||
(
|
||||
By.CSS_SELECTOR,
|
||||
"button.action-button .icon-promoted-view",
|
||||
speaker_view_button_css_selector,
|
||||
)
|
||||
)
|
||||
).click()
|
||||
|
@ -333,22 +342,30 @@ def switch_to_speaker_view(driver: WebDriver, nextcloud_version: int) -> None:
|
|||
)
|
||||
|
||||
|
||||
def close_sidebar(driver: WebDriver) -> None:
|
||||
def close_sidebar(driver: WebDriver, nextcloud_version: int) -> None:
|
||||
# Close the sidebar
|
||||
logging.info("Closing sidebar")
|
||||
|
||||
if nextcloud_version >= 25:
|
||||
close_sidebar_button_css_selector = "button.app-sidebar__close"
|
||||
leave_call_button_css_selector = ".top-bar.in-call .top-bar__button .video-off-icon"
|
||||
else:
|
||||
close_sidebar_button_css_selector = "a.app-sidebar__close"
|
||||
leave_call_button_css_selector = ".top-bar.in-call .top-bar__button .icon-leave-call"
|
||||
|
||||
try:
|
||||
driver.find_element(By.CSS_SELECTOR, "a.app-sidebar__close").click()
|
||||
driver.find_element(By.CSS_SELECTOR, close_sidebar_button_css_selector).click()
|
||||
except ElementClickInterceptedException:
|
||||
logging.info("Assuming toast is covering close button")
|
||||
close_toasts(driver)
|
||||
driver.find_element(By.CSS_SELECTOR, "a.app-sidebar__close").click()
|
||||
driver.find_element(By.CSS_SELECTOR, close_sidebar_button_css_selector).click()
|
||||
|
||||
# Wait for sidebar to close
|
||||
WebDriverWait(driver, 10).until(
|
||||
EC.visibility_of_element_located(
|
||||
(
|
||||
By.CSS_SELECTOR,
|
||||
".top-bar.in-call .top-bar__button .icon-leave-call",
|
||||
leave_call_button_css_selector,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue