2014-04-27, 19:23
I'm developing a simple plugin for XBMC. I'm running into some strange behaviour when I try to seek an audio file using JSON. Sometimes it seeks to the correct position, but other times it is ineffective and doesn't influence the position of the file.
I'm using the JSON interface class from XBMC Resume.
In all cases the JSON query is received by XBMC. I don't see much of a difference between the (partial) logs of a successful seek and a failed seek. In both cases the query returns as successful according to the JSON interface.
Is there something I'm missing? I'm thinking that perhaps I should wait for some event caused by 'Player.Open' before executing 'Player.Seek'.
--Setup--
XBMC 12.3
Windows 7 x64
Code:
if not (self._json.executeNonQuery('Player.Open', {'item' : {'playlistid' : xbmc.PLAYLIST_MUSIC, 'position' : playlist_state.playlist_idx}})):
xbmc.log("APR@ could not play item", xbmc.LOGDEBUG)
return
m, s = divmod(playlist_state.file_offset, 60)
h, m = divmod(m, 60)
if not (self._json.executeNonQuery('Player.Seek', {'playerid' : xbmc.PLAYLIST_MUSIC, 'value' : {'hours' : int(h), 'minutes' : int(m), 'seconds' : int(s)}})):
xbmc.log("APR@ could not go to position", xbmc.LOGDEBUG)
I'm using the JSON interface class from XBMC Resume.
In all cases the JSON query is received by XBMC. I don't see much of a difference between the (partial) logs of a successful seek and a failed seek. In both cases the query returns as successful according to the JSON interface.
Is there something I'm missing? I'm thinking that perhaps I should wait for some event caused by 'Player.Open' before executing 'Player.Seek'.
--Setup--
XBMC 12.3
Windows 7 x64