mirror of
https://github.com/onyx-and-iris/nvda-addon-voicemeeter.git
synced 2026-04-19 09:33:30 +00:00
Compare commits
4 Commits
8e8e3ce8a5
...
v1.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| c3b06cae51 | |||
| 4c176cfd77 | |||
| df023c67ea | |||
| 8b025206b1 |
3
.github/workflows/build_addon.yml
vendored
3
.github/workflows/build_addon.yml
vendored
@@ -5,9 +5,6 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches: [ main, master ]
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
15
Taskfile.yml
15
Taskfile.yml
@@ -24,3 +24,18 @@ tasks:
|
|||||||
platforms: [windows]
|
platforms: [windows]
|
||||||
cmds:
|
cmds:
|
||||||
- '{{.SHELL}} -Command "pdm run scons"'
|
- '{{.SHELL}} -Command "pdm run scons"'
|
||||||
|
|
||||||
|
bump:
|
||||||
|
desc: Bump the version number
|
||||||
|
preconditions:
|
||||||
|
- sh: '{{.SHELL}} -c "if (Get-Command bump) { exit 0 } else { exit 1 }"'
|
||||||
|
msg: "The 'bump' command is not available. Run `go install github.com/onyx-and-iris/bump/cmd/bump@latest`."
|
||||||
|
cmds:
|
||||||
|
- |
|
||||||
|
{{if eq .CLI_ARGS "show"}}
|
||||||
|
{{.SHELL}} -c "bump show -f buildVars.py -p \"'addon_version': '(\d+\.\d+\.\d+)'\""
|
||||||
|
{{.SHELL}} -c "bump show -f pyproject.toml -p \"version = .(\d+\.\d+\.\d+).\""
|
||||||
|
{{else}}
|
||||||
|
{{.SHELL}} -c "bump {{.CLI_ARGS}} -w -f buildVars.py -p \"'addon_version': '(\d+\.\d+\.\d+)'\""
|
||||||
|
{{.SHELL}} -c "bump {{.CLI_ARGS}} -w -f pyproject.toml -p \"version = .(\d+\.\d+\.\d+).\""
|
||||||
|
{{end}}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import ctypes as ct
|
|||||||
from ctypes.wintypes import CHAR, FLOAT, LONG
|
from ctypes.wintypes import CHAR, FLOAT, LONG
|
||||||
|
|
||||||
from .cdll import libc
|
from .cdll import libc
|
||||||
from .error import VMCAPIError
|
from .error import VMAddonCAPIError
|
||||||
|
|
||||||
|
|
||||||
class Binds:
|
class Binds:
|
||||||
@@ -41,5 +41,5 @@ class Binds:
|
|||||||
def call(self, fn, *args, ok=(0,)):
|
def call(self, fn, *args, ok=(0,)):
|
||||||
retval = fn(*args)
|
retval = fn(*args)
|
||||||
if retval not in ok:
|
if retval not in ok:
|
||||||
raise VMCAPIError(fn.__name__, retval)
|
raise VMAddonCAPIError(fn.__name__, retval)
|
||||||
return retval
|
return retval
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
import ctypes as ct
|
import ctypes as ct
|
||||||
import platform
|
import platform
|
||||||
import winreg
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from .error import VMError
|
from .error import VMAddonError
|
||||||
|
|
||||||
|
try:
|
||||||
|
import winreg
|
||||||
|
except ImportError as e:
|
||||||
|
ERR_MSG = 'winreg module not found, only Windows OS supported'
|
||||||
|
raise VMAddonError(ERR_MSG) from e
|
||||||
|
|
||||||
|
# Defense against edge cases where winreg imports but we're not on Windows
|
||||||
|
if platform.system() != 'Windows':
|
||||||
|
ERR_MSG = f'Unsupported OS: {platform.system()}, only Windows OS supported'
|
||||||
|
raise VMAddonError(ERR_MSG)
|
||||||
|
|
||||||
BITS = 64 if ct.sizeof(ct.c_voidp) == 8 else 32
|
BITS = 64 if ct.sizeof(ct.c_voidp) == 8 else 32
|
||||||
|
|
||||||
if platform.system() != 'Windows':
|
|
||||||
raise VMError('Only Windows OS supported')
|
|
||||||
|
|
||||||
|
|
||||||
VM_KEY = 'VB:Voicemeeter {17359A74-1236-5467}'
|
VM_KEY = 'VB:Voicemeeter {17359A74-1236-5467}'
|
||||||
REG_KEY = '\\'.join(
|
REG_KEY = '\\'.join(
|
||||||
filter(
|
filter(
|
||||||
@@ -35,12 +41,14 @@ def get_vmpath():
|
|||||||
try:
|
try:
|
||||||
vm_parent = Path(get_vmpath()).parent
|
vm_parent = Path(get_vmpath()).parent
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
raise VMError('Unable to fetch DLL path from the registry') from e
|
ERR_MSG = 'Voicemeeter installation not found in registry'
|
||||||
|
raise VMAddonError(ERR_MSG) from e
|
||||||
|
|
||||||
DLL_NAME = f'VoicemeeterRemote{"64" if BITS == 64 else ""}.dll'
|
DLL_NAME = f'VoicemeeterRemote{"64" if BITS == 64 else ""}.dll'
|
||||||
|
|
||||||
dll_path = vm_parent.joinpath(DLL_NAME)
|
dll_path = vm_parent.joinpath(DLL_NAME)
|
||||||
if not dll_path.is_file():
|
if not dll_path.is_file():
|
||||||
raise VMError(f'Could not find {dll_path}')
|
ERR_MSG = f'Could not find {dll_path}'
|
||||||
|
raise VMAddonError(ERR_MSG)
|
||||||
|
|
||||||
libc = ct.WinDLL(str(dll_path))
|
libc = ct.WinDLL(str(dll_path))
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
class VMError(Exception):
|
class VMAddonError(Exception):
|
||||||
"""Base voicemeeterlib exception class"""
|
"""Base voicemeeter add-on exception class"""
|
||||||
|
|
||||||
|
|
||||||
class VMCAPIError(VMError):
|
class VMAddonCAPIError(VMAddonError):
|
||||||
"""Exception raised when the C-API returns an error code"""
|
"""Exception raised when the Voicemeeter C-API returns an error code"""
|
||||||
|
|
||||||
def __init__(self, fn_name, code):
|
def __init__(self, fn_name, code):
|
||||||
self.fn_name = fn_name
|
self.fn_name = fn_name
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import Enum, unique
|
from enum import Enum, unique
|
||||||
|
|
||||||
from .error import VMError
|
from .error import VMAddonError
|
||||||
|
|
||||||
|
|
||||||
@unique
|
@unique
|
||||||
@@ -78,7 +78,8 @@ def kind_factory(kind_id):
|
|||||||
elif kind_id == 'potato':
|
elif kind_id == 'potato':
|
||||||
_kind_map = PotatoMap
|
_kind_map = PotatoMap
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Unknown Voicemeeter kind {kind_id}')
|
ERR_MSG = f'Unknown Voicemeeter kind {kind_id}'
|
||||||
|
raise ValueError(ERR_MSG)
|
||||||
return _kind_map(name=kind_id)
|
return _kind_map(name=kind_id)
|
||||||
|
|
||||||
|
|
||||||
@@ -87,5 +88,5 @@ def request_kind_map(kind_id):
|
|||||||
try:
|
try:
|
||||||
KIND_obj = kind_factory(kind_id)
|
KIND_obj = kind_factory(kind_id)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise VMError(str(e)) from e
|
raise VMAddonError(str(e)) from e
|
||||||
return KIND_obj
|
return KIND_obj
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ addon_info = {
|
|||||||
The add-on requires Voicemeeter to be installed."""
|
The add-on requires Voicemeeter to be installed."""
|
||||||
),
|
),
|
||||||
# version
|
# version
|
||||||
'addon_version': '1.1.0',
|
'addon_version': '1.1.1',
|
||||||
# Author(s)
|
# Author(s)
|
||||||
'addon_author': 'onyx-and-iris <code@onyxandiris.online>',
|
'addon_author': 'onyx-and-iris <code@onyxandiris.online>',
|
||||||
# URL for the add-on documentation support
|
# URL for the add-on documentation support
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "nvda-addon-voicemeeter"
|
name = "nvda-addon-voicemeeter"
|
||||||
version = "1.1.0"
|
version = "1.1.1"
|
||||||
description = "A GUI-less NVDA Addon for Voicemeeter using the Remote API"
|
description = "A GUI-less NVDA Addon for Voicemeeter using the Remote API"
|
||||||
authors = [
|
authors = [{ name = "Onyx and Iris", email = "code@onyxandiris.online" }]
|
||||||
{name = "Onyx and Iris", email = "code@onyxandiris.online"},
|
|
||||||
]
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
requires-python = "==3.11.*"
|
requires-python = "==3.11.*"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
build = [
|
build = ["scons>=4.8.1", "markdown>=3.7"]
|
||||||
"scons>=4.8.1",
|
|
||||||
"markdown>=3.7",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.pdm]
|
[tool.pdm]
|
||||||
distribution = false
|
distribution = false
|
||||||
@@ -56,9 +51,11 @@ target-version = "py311"
|
|||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||||
|
# Enable flake8-errmsg (EM) warnings.
|
||||||
|
# Enable flake8-bugbear (B) warnings.
|
||||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||||
# McCabe complexity (`C901`) by default.
|
# McCabe complexity (`C901`) by default.
|
||||||
select = ["E4", "E7", "E9", "F"]
|
select = ["E4", "E7", "E9", "EM", "F", "B"]
|
||||||
ignore = []
|
ignore = []
|
||||||
|
|
||||||
# Allow fix for all enabled rules (when `--fix`) is provided.
|
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||||
@@ -100,7 +97,4 @@ docstring-code-line-length = "dynamic"
|
|||||||
max-complexity = 10
|
max-complexity = 10
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
"__init__.py" = [
|
"__init__.py" = ["E402", "F401"]
|
||||||
"E402",
|
|
||||||
"F401",
|
|
||||||
]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user