Ghawken/appleTV-indigoPlugin

Error playing diff to HomePod

berkinet opened this issue · 3 comments

Here is the debugging info from the plugin...

`5 Feb 2023 at 11:27:57
appleTV Plugin Debug (plugin.py:closedPrefsConfigUi:764): logLevel = 5
appleTV Plugin Debug (plugin.py:closedPrefsConfigUi:765): User prefs saved.
appleTV Plugin Debug (plugin.py:closedPrefsConfigUi:766): Debugging on (Level: 5)
Action Group AppleTV Nescafe
appleTV Plugin Debug (plugin.py:sendRemoteCommand:1282): sendRemoteCommand Called configured : True
delayAmount : 900
description : send command to apple tv
deviceId : 0
pluginId : com.GlennNZ.indigoplugin.appleTV
pluginTypeId : sendCommand
props : com.GlennNZ.indigoplugin.appleTV : (dict)
appleTV : 1330741460 (string)
args : /Users/rdp/Music/nescafe.aiff (string)
command : stream_file (string)
replaceExisting : True
textToSpeak : & None
appleTV Plugin Debug (plugin.py:sendRemoteCommand:1284): Props equal: com.GlennNZ.indigoplugin.appleTV : (dict)
appleTV : 1330741460 (string)
args : /Users/rdp/Music/nescafe.aiff (string)
command : stream_file (string)
appleTV Plugin Sending Command stream_file=/Users/rdp/Music/nescafe.aiff to appleTV Device ID 1330741460
appleTV Plugin Debug (plugin.py:sendRemoteCommand:1303): Found correct AppleTV listener/manager. <main.appleTVListener object at 0x1030f8b20> and id 1330741460
appleTV Plugin Debug (plugin.py:send_command:506): Within send_command and command & args - stream_file=/Users/rdp/Music/nescafe.aiff and args /Users/rdp/Music/nescafe.aiff
appleTV Plugin Debug (plugin.py:_handle_device_command:403): _handle_device_command called - Args: /Users/rdp/Music/nescafe.aiff Cmd:stream_file=/Users/rdp/Music/nescafe.aiff
appleTV Plugin Debug (plugin.py:_handle_device_command:419): cmd and cmd_args extracted and Cmd stream_file and cmd_args ['/Users/rdp/Music/nescafe.aiff']
appleTV Plugin Debug (plugin.py: Function: _exec_command line: 489): Exception : Message : General Exception Caught:
appleTV Plugin Debug Traceback:
File "plugin.py", line 468, in _exec_command
value = await tmp(*args)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/core/facade.py", line 392, in stream_file
await self.relay("stream_file")(file, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/init.py", line 371, in stream_file
audio_file = await open_source(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/audio_source.py", line 484, in open_source
return await FileSource.open(source, sample_rate, channels, sample_size)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/audio_source.py", line 428, in open
src = await loop.run_in_executor(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/miniaudio.py", line 949, in decode_file
raise DecodeError("failed to decode file", result)

appleTV Plugin Debug Error in plugin execution:

Traceback (most recent call last):
File "plugin.py", line 468, in _exec_command
value = await tmp(*args)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/core/facade.py", line 392, in stream_file
await self.relay("stream_file")(file, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/init.py", line 371, in stream_file
audio_file = await open_source(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/audio_source.py", line 484, in open_source
return await FileSource.open(source, sample_rate, channels, sample_size)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/audio_source.py", line 428, in open
src = await loop.run_in_executor(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/miniaudio.py", line 949, in decode_file
raise DecodeError("failed to decode file", result)
miniaudio.DecodeError: ('failed to decode file', -1)

appleTV Plugin Debug
Exc_info: (<class 'miniaudio.DecodeError'>, DecodeError('failed to decode file', -1), <traceback object at 0x108ef7740>)
Exc_Text: Traceback (most recent call last):
File "plugin.py", line 468, in _exec_command
value = await tmp(*args)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/core/facade.py", line 392, in stream_file
await self.relay("stream_file")(file, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/init.py", line 371, in stream_file
audio_file = await open_source(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/audio_source.py", line 484, in open_source
return await FileSource.open(source, sample_rate, channels, sample_size)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/raop/audio_source.py", line 428, in open
src = await loop.run_in_executor(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/miniaudio.py", line 949, in decode_file
raise DecodeError("failed to decode file", result)
miniaudio.DecodeError: ('failed to decode file', -1)
Stack_info: None
appleTV Plugin Could not run this command at this time.`

Somewhat expected and would be the same with a host of other files types.

aiff files are not supported by Homepod or likely appleTV’s I would guess.

mp3 are the safest.

The url or files are simply passed to the appleTV or the Homepod - if they can play great, if not then the above will result. File support may change as OS versions change.

The log pretty much says that “failed to decode file”.
Rest is just debug info - plugin catches the error and continues. Shouldn’t be any ongoing impact on plugin function.

Thank you for the explanation. It does make sense. Although, it also does suggest a possible upgrade, since ffmpeg can be used to change file formats, it should be possible to pipe non-compatible sound files through ffmpeg for conversion on the fly. But, I guess it’s just as easy to convert in advance, and just use the mp3. In any case, it does seem to be working well now and meet my needs.

Thank you again for the plugin.

Yep - sounds like you went through the same thought process as I did.

Could convert on the fly - few issues though:
Would probably have to convert everything - as wouldn’t know what file type is supported as time goes on, and maybe some mp3 encoding differences that still mean wouldn’t play
Would add a slight delay (although with text-speech - really not noticeable)
& a added level of complication

vs.
Have appropriate files that you send to homepod.