2015-05-13, 09:49
I use an Android tablet as an alarm clock, with Tasker set to run Kodi at the alarm time. Kodi then uses the following script to start playing an Internet radio stream:
This works just fine, but occasionally the stream will fail to play and this means the alarm doesn't go off and I sleep in. Is there a way to detect whether ExecuteBuiltin has failed? Looking at the C++ I see that PlayMedia returns false if the media fails to play, but is this passed to ExecuteBuiltin and does ExecuteBuiltin return a result that I can use to check if the stream played? If not, is there some other way to check if the stream is playing - an IsPlaying() function or something like that?
Code:
import xbmc
xbmc.executebuiltin("PlayMedia(/storage/emulated/0/Music/BBCRadio1.strm)")
This works just fine, but occasionally the stream will fail to play and this means the alarm doesn't go off and I sleep in. Is there a way to detect whether ExecuteBuiltin has failed? Looking at the C++ I see that PlayMedia returns false if the media fails to play, but is this passed to ExecuteBuiltin and does ExecuteBuiltin return a result that I can use to check if the stream played? If not, is there some other way to check if the stream is playing - an IsPlaying() function or something like that?