From 4f8ac6398804bd2c5c6bad897eb20dce59b7721b Mon Sep 17 00:00:00 2001 From: Magnus Walbeck Date: Wed, 23 Mar 2022 21:38:54 +0100 Subject: [PATCH] Make Nextcloud version comparison with int instead of string. (#45) * Make Nextcloud version comparison with int instead of string. --- .gitignore | 1 + .vscode/settings.json | 9 ++++----- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- talked/__init__.py | 2 +- talked/recorder.py | 12 ++++++------ 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index df7d060..6dbae83 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ geckodriver.log /config.json /config.toml /dist +/.mypy_cache diff --git a/.vscode/settings.json b/.vscode/settings.json index f4d89e3..f1c3e67 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,15 +5,14 @@ "python.linting.mypyEnabled": false, "python.linting.mypyPath": ".venv/bin/mypy", "python.testing.pytestPath": ".venv/bin/pytest", + "python.linting.pylintEnabled": false, "python.linting.pylintPath": ".venv/bin/pylint", "python.linting.banditPath": ".venv/bin/bandit", "python.formatting.provider": "black", "python.analysis.typeCheckingMode": "off", - "python.analysis.extraPaths": [ - "./talked" - ], + "python.analysis.extraPaths": ["./talked"], "[python]": { - "editor.codeActionsOnSave": {"source.organizeImports": true}, + "editor.codeActionsOnSave": { "source.organizeImports": true } }, - "autoDocstring.startOnNewLine": true, + "autoDocstring.startOnNewLine": true } diff --git a/CHANGELOG.md b/CHANGELOG.md index 27b0ad0..7bf4018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased] +## 0.3.2 - 2022-03-23 + +### Fixed + +- Make Nextcloud version comparison with int instead of string. + ## 0.3.1 - 2022-01-11 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index e8bdf63..def734c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "talked" -version = "0.3.1" +version = "0.3.2" description = "Call recording for Nextcloud Talk" authors = ["Magnus Walbeck "] license = "AGPL-3.0-or-later" diff --git a/talked/__init__.py b/talked/__init__.py index db555df..39d9222 100644 --- a/talked/__init__.py +++ b/talked/__init__.py @@ -5,7 +5,7 @@ from tomlkit import parse -__version__ = "0.3.1" +__version__ = "0.3.2" LOG_LEVELS = { "critical": logging.CRITICAL, diff --git a/talked/recorder.py b/talked/recorder.py index 7bffaa6..aac2090 100644 --- a/talked/recorder.py +++ b/talked/recorder.py @@ -28,7 +28,7 @@ def start( token: str, queue: Queue, recording: Event, - nextcloud_version: str, + nextcloud_version: int, audio_only: bool, grid_view: bool, ) -> None: @@ -109,7 +109,7 @@ def start( def launch_browser( - call_link: str, msg_queue: Queue, nextcloud_version: str, grid_view: bool + call_link: str, msg_queue: Queue, nextcloud_version: int, grid_view: bool ) -> WebDriver: logging.info("Configuring browser options") options = Options() @@ -201,7 +201,7 @@ def change_name_of_user(driver: WebDriver) -> None: ) -def join_call(driver: WebDriver, msg_queue: Queue, nextcloud_version: str) -> None: +def join_call(driver: WebDriver, msg_queue: Queue, nextcloud_version: int) -> None: # Wait for the green Join Call button to appear then click it logging.info("Waiting for join call button to appear") try: @@ -223,7 +223,7 @@ def join_call(driver: WebDriver, msg_queue: Queue, nextcloud_version: str) -> No logging.info("Joining call") join_call_button.click() - if nextcloud_version == "23": + if nextcloud_version == 23: logging.info("Handling device checker screen") try: device_checker_join_call_button = WebDriverWait(driver, 10).until( @@ -267,11 +267,11 @@ def mute_user(driver: WebDriver) -> None: logging.info(("Mute button wasn't found. Assuming we are already muted.")) -def switch_to_speaker_view(driver: WebDriver, nextcloud_version: str) -> None: +def switch_to_speaker_view(driver: WebDriver, nextcloud_version: int) -> None: # Switch to speaker view logging.info("Switching to speaker view") - if nextcloud_version == "23": + if nextcloud_version == 23: driver.find_element_by_css_selector( ".local-media-controls button.action-item__menutoggle" ).click()