def route(action): if action == 'change': current_language = utils.get_language() valid_languages = Language.valid() missing_languages = [ language for language in valid_languages if language != current_language ] result = kodi.Dialog().select(i18n('change_languages'), missing_languages) if result > -1: utils.change_language(missing_languages[result])
def route(action): if action == 'add': current_languages = utils.get_languages() valid_languages = Language.valid() missing_languages = [language for language in valid_languages if language not in current_languages] result = kodi.Dialog().select(i18n('add_language'), missing_languages) if result > -1: utils.add_language(missing_languages[result]) elif action == 'remove': current_languages = utils.get_languages() result = kodi.Dialog().select(i18n('remove_language'), current_languages) if result > -1: utils.remove_language(current_languages[result])
def get_metadata(community_id=list(), game_id=list(), user_id=list(), user_login=list(), stream_type=StreamTypeHelix.ALL, language=list(), after='MA==', before='MA==', first=20, use_app_token=False): q = Qry('streams/metadata', use_app_token=use_app_token) q.add_param(keys.AFTER, Cursor.validate(after), 'MA==') q.add_param(keys.BEFORE, Cursor.validate(before), 'MA==') q.add_param(keys.FIRST, first, 20) q.add_param(keys.COMMUNITY_ID, community_id, list()) q.add_param(keys.GAME_ID, game_id, list()) q.add_param(keys.USER_ID, user_id, list()) q.add_param(keys.USER_LOGIN, user_login, list()) q.add_param(keys.TYPE, StreamTypeHelix.validate(stream_type), StreamTypeHelix.ALL) if isinstance(language, list): _language = [lang for lang in language if lang in Language.valid()] q.add_param(keys.LANGUAGE, _language, list()) else: q.add_param(keys.LANGUAGE, Language.validate(language), '') return q