def pause(self): playerid = kodi_rpc.get_active_playerid() is_playing = kodi_rpc.is_player_playing(playerid) if is_playing: kodi_rpc.play_pause_player(playerid) return True
def resume(self): playerid = kodi_rpc.get_active_playerid() is_playing = kodi_rpc.is_player_playing(playerid) # TODO - handle this, as user is expecting that something plays if not is_playing: kodi_rpc.play_pause_player(playerid) return True
def start_over(self): current_playing_item = get_current_item() if current_playing_item: player_id = kodi_rpc.get_active_playerid() if player_id: kodi_rpc.seek_to_percentage(player_id, 0) return True return False
def get_current_item(): player_id = kodi_rpc.get_active_playerid() if not player_id: return None item = kodi_rpc.get_current_item(player_id) print(item) item_type = _get(item, 'type') if item_type == 'movie': return { 'type': item_type, 'movieid': item['id'], } elif item_type == 'episode': return { 'type': item_type, 'episodeid': item['id'], 'tvshowid': item['tvshowid'], 'season': item['season'], 'episode': item['episode'], } return None
def get_current_item(): player_id = kodi_rpc.get_active_playerid() if not player_id: return None item = kodi_rpc.get_current_item(player_id) logger.debug('Current item: {}'.format(str(item))) item_type = _get(item, 'type') if item_type == 'movie': return { 'type': item_type, 'movieid': item['id'], } elif item_type == 'episode': return { 'type': item_type, 'episodeid': item['id'], 'tvshowid': item['tvshowid'], 'season': item['season'], 'episode': item['episode'], } return None
def stop(self): playerid = kodi_rpc.get_active_playerid() kodi_rpc.stop_player(playerid) return True