Code Monkey home page Code Monkey logo

Comments (5)

synesthesiam avatar synesthesiam commented on July 30, 2024 1

Thanks, I can add this! The code is indeed in rhasspy3 but I haven't pushed it up just yet. I'm making a lot of changes quickly, so I don't want to break anyone depending on the Github repo just yet 😄

from rhasspy3.

synesthesiam avatar synesthesiam commented on July 30, 2024 1

I pushed the code up to a side branch for now: https://github.com/rhasspy/rhasspy3/tree/wyoming-v1

from rhasspy3.

mweinelt avatar mweinelt commented on July 30, 2024

I would very much like to submit the following change against the current wyoming release.

From: Martin Weinelt <[email protected]>
Date: Wed, 12 Jul 2023 19:05:54 +0200
Subject: [PATCH] Use urlparse for uri parsing in server component

Python's builtin urlparsing functionality has fewer edge cases, like
most home-grown url parsing code.

This change allows me to bind a wyoming server to an IPv6 socket.
---
 wyoming/server.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/wyoming/server.py b/wyoming/server.py
index 6dcc4e3..f3905b9 100644
--- a/wyoming/server.py
+++ b/wyoming/server.py
@@ -4,6 +4,7 @@ from abc import ABC, abstractmethod
 from functools import partial
 from pathlib import Path
 from typing import Callable, Set, Union
+from urllib.parser import urlparse
 
 from .event import Event, async_get_stdin, async_read_event, async_write_event
 
@@ -57,16 +58,15 @@ class AsyncServer(ABC):
 
     @staticmethod
     def from_uri(uri: str) -> "AsyncServer":
-        if uri.startswith("unix://"):
-            socket_path = uri[len("unix://") :]
-            return AsyncUnixServer(socket_path)
+        result = urlparse(uri)
 
-        if uri.startswith("tcp://"):
-            host, port_str = uri[len("tcp://") :].split(":")
-            port = int(port_str)
-            return AsyncTcpServer(host, port)
+        if result.scheme == "unix":
+            return AsyncUnixServer(result.path)
 
-        if uri.startswith("stdio://"):
+        if result.scheme == "tcp":
+            return AsyncTcpServer(result.hostname, result.port)
+
+        if result.scheme == "stdio":
             return AsyncStdioServer()
 
         raise ValueError("Only 'stdio://', 'unix://', or 'tcp://' are supported")
-- 
2.41.0

from rhasspy3.

KeithSBB avatar KeithSBB commented on July 30, 2024

Thanks Michael,

I hope this branch leads to being able to setup Rhasspy 3 as a satellite speaker for Home Assistant.

from rhasspy3.

synesthesiam avatar synesthesiam commented on July 30, 2024

@KeithSBB Yep, that's what a lot of the new code is for 🙂

from rhasspy3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.