Пример #1
0
def search(s_query=None):
    if s_query is None:
        s_query = player.dialog_keyboard(heading="Поиск")

        if s_query is None:
            return

        if not s_query or s_query.strip() == "":
            player.dialog_ok("Kinoman.Uz", "Для поиска нужно ввести запрос")
            return

    if player.get_setting("search_history_status", "bool"):
        history = player.get_setting("_search_history", "list")

        if s_query in history:
            history.remove(s_query)

        history.append(s_query)

        if len(history) > 6:
            history = history[-6:]

        player.set_setting("_search_history", history)

    list_movies(query={"q": s_query})
def _kinoman_login_save_cookies(cookie_dict, user_id):
    player.set_setting("_cookie", json.dumps(cookie_dict))
    player.set_setting("_last_check", int(time.time()))
    player.set_setting("_user_id", int(user_id))
Пример #3
0
def search_clear():
    player.set_setting("_search_history", "")
    player.redirect_in_place(path_for("root"))
Пример #4
0
 def test_set_setting_list(self, mock_addon):
     player.set_setting("test_key", ["item1", "item2"])
     mock_addon.setSetting.assert_called_once_with(id="test_key",
                                                   value="item1|item2")
     mock_addon.setSetting.reset_mock()
Пример #5
0
 def test_set_setting_bool(self, mock_addon):
     player.set_setting("test_key", True)
     mock_addon.setSettingBool.assert_called_once_with("test_key", True)
Пример #6
0
 def test_set_setting_float(self, mock_addon):
     player.set_setting("test_key", 100.10)
     mock_addon.setSettingNumber.assert_called_once_with("test_key", 100.10)
Пример #7
0
 def test_set_setting_int(self, mock_addon):
     player.set_setting("test_key", 100)
     mock_addon.setSettingInt.assert_called_once_with("test_key", 100)
Пример #8
0
 def test_set_setting_str(self, mock_addon):
     player.set_setting("test_key", "test_value")
     mock_addon.setSetting.assert_called_once_with(id="test_key",
                                                   value="test_value")
     mock_addon.setSetting.reset_mock()