OpenVoiceOS / ovos-audio

OpenVoiceOS audio output daemon
Apache License 2.0
0 stars 6 forks source link

Support for Windows #70

Closed mikejgray closed 4 months ago

mikejgray commented 4 months ago

ovos_audio.service

class PlaybackService(Thread):
...
    @staticmethod
    def _resolve_sound_uri(uri: str):
        """ helper to resolve sound files full path"""
        if uri is None:
            return None
        if uri.startswith("snd/") or uri.startswith("snd\\"):
            local_uri = os.path.join(os.path.dirname(__file__), "res", uri)
            if os.path.isfile(local_uri):
                return local_uri
        audio_file = resolve_resource_file(uri)
        if audio_file is None or not exists(audio_file):
            raise FileNotFoundError(f"{audio_file} does not exist")
        return audio_file

Need to support snd\\ as an option in the URI in order for the path to construct properly. Another option is to not doing a string construction at all and to instead use path objects.

More to come, possibly...