just_playback icon indicating copy to clipboard operation
just_playback copied to clipboard

error when playing files with certain characters

Open jimmy-taylor-1 opened this issue 3 months ago • 4 comments

When I try to play files that have Japanese characters in the file name I get the error

line 235, in __bind
    raise MiniaudioError(MA_RESULT_STR[ma_res])
just_playback.ma_result.MiniaudioError: MA_DOES_NOT_EXIST

the same might happen with other characters as well but I haven't tested it

jimmy-taylor-1 avatar Mar 07 '24 23:03 jimmy-taylor-1

Hi @jimmy-taylor-1,

Could you try installing v0.1.8 ? Let me know if it solves your problem.

cheofusi avatar Mar 10 '24 23:03 cheofusi

Unfortunately this seems to have made the problem worse, now i get this error for every file I try to play

line 55, in load_file
    self.__bind(lib.load_file_w(self.__ma_attrs, path_to_file.encode('utf-16le')))
TypeError: initializer for ctype 'wchar_t *' must be a cdata pointer, not bytes

jimmy-taylor-1 avatar Mar 11 '24 00:03 jimmy-taylor-1

Unfortunately this seems to have made the problem worse, now i get this error for every file I try to play

line 55, in load_file
    self.__bind(lib.load_file_w(self.__ma_attrs, path_to_file.encode('utf-16le')))
TypeError: initializer for ctype 'wchar_t *' must be a cdata pointer, not bytes

I was getting the same error, even when directly compiling from source. I got mine working by simply removing the encoding,

so from:

if platform.system() == 'Windows':
        self.__bind(lib.load_file(self.__ma_attrs, path_to_file.encode('utf-16le')))

to:

if platform.system() == 'Windows':
        self.__bind(lib.load_file(self.__ma_attrs, path_to_file))

Also, when compiling from source, there is a little bit difference in the code, but you can still remove the utf16le encoding part completely and it will solve the issue.

Note: this isn't the right solution and we should perform some type of validation before deciding and going on with the encoding, but works for now.

Hanzyusuf avatar Mar 13 '24 08:03 Hanzyusuf

I've updated the wheels on PyPI. Uninstalling and then reinstalling v0.1.8 should fix this issue.

cheofusi avatar Mar 13 '24 12:03 cheofusi