def onControl(self, control): if control == self.close_button: self.stop() elif control == self.settings_button: utils.open_settings() else: button = self.getControl(control) response = button.send_cmd(control) if not response: msg = u"{0}: {1}".format(utils.get_string(32103), response.message) utils.notify(msg) if isinstance(control, xbmcgui.ControlRadioButton): control.setSelected(not control.isSelected())
def error_dialog(msg): xbmcgui.Dialog().ok(utils.get_string(32000), msg, " ", utils.get_string(32102)) utils.open_settings() sys.exit(1)
def router(self, parameters): if not self.verifica_login(): utils.open_settings() return params = utils.get_parameters_dict_from_url(parameters) params_count = len(params) if params_count == 0: self.verify_version() self.create_main_page() else: if params.has_key("page"): page = params.get("page") category_id = params.get("category_id") if page in ["HOME", "INTRATTENIMENTO"]: self.create_category_page(page_id=category_id) elif page == "CINEMA": self.create_category_page(page_id=category_id, ha_elenco=True, category_name='Cinema') elif page == "SERIE TV": self.create_category_page(page_id=category_id, ha_elenco=True, category_name='Serie') elif page == "BAMBINI": self.create_category_page(page_id=category_id, ha_elenco=True, category_name='Kids') if params.has_key("action"): action = params.get("action") if action == "full_list": category = params.get("category") items = utils.call_service("load_all_contents", { "begin": 0, "category": category }) self.add_items_to_folder(items) elif action == "apri_serie": id_serie = params.get("id_serie") nome_serie = urllib.unquote(params.get("serieNome", "")) items = utils.call_service( "get_show_content", { "contentId": id_serie, "contentType": TimVisionAPI.TVSHOW_CONTENT_TYPE_SEASONS }) if len(items) == 1 and utils.get_setting("unique_season"): items = TimVisionObjects.parse_collection(items) items = utils.call_service( "get_show_content", { "contentId": items[0].content_id, "contentType": TimVisionAPI.TVSHOW_CONTENT_TYPE_EPISODES }) self.add_items_to_folder(items=items, title=nome_serie) elif action == "apri_stagione": id_stagione = params.get("id_stagione") items = utils.call_service( "get_show_content", { "contentId": id_stagione, "contentType": TimVisionAPI.TVSHOW_CONTENT_TYPE_EPISODES }) season_no = params.get("seasonNo") self.add_items_to_folder(items=items, title="Stagione %s" % (season_no)) elif action == "play_item": content_id = params.get("contentId") video_type = params.get("videoType") has_hd = params.get("has_hd", "false") start_offset = params.get("startPoint") duration = params.get("duration") paused = self.increase_play_video_count() self.play_video(content_id, video_type, has_hd, start_offset, duration, paused) elif action == "open_page": uri = urllib.unquote_plus(params.get("uri")).replace( "maxResults=30", "maxResults=50").replace("&addSeeMore=50", "") items = utils.call_service("get_contents", {"url": uri}) items = [x for x in items if x["layout"] != "SEE_MORE"] self.add_items_to_folder(items) elif action == "logout": utils.call_service("logout") elif action == "play_trailer": content_id = params.get("contentId") content_type = params.get("type") self.play_trailer(content_id, content_type) elif action == "set_seen": content_id = params.get("contentId") duration = params.get("duration") utils.call_service("set_content_seen", { "contentId": content_id, "duration": duration }) xbmc.executebuiltin("Container.Refresh()") elif action == "toogle_favourite": content_id = params.get("contentId") value = utils.get_bool(params.get("value")) mediatype = params.get("mediatype") response = utils.call_service( "set_favourite", { "contentId": content_id, "value": value, "mediatype": mediatype }) if response: dialog_title = utils.get_local_string(30033) dialog_msg = utils.get_local_string( 30034) if value else utils.get_local_string(30035) Dialogs.show_message(dialog_msg, dialog_title, xbmcgui.NOTIFICATION_INFO) xbmc.executebuiltin("Container.Refresh()") else: dialog_title = utils.get_local_string(30038) dialog_msg = utils.get_local_string(30039) Dialogs.show_dialog(dialog_msg, dialog_title) elif action == "search": keyword = Dialogs.get_text_input( utils.get_local_string(30032)) if keyword != None and len(keyword) > 0: items = utils.call_service("search", {"keyword": keyword}) return self.add_items_to_folder(items) elif action == "favourites": items = utils.call_service("get_favourite") return self.add_items_to_folder(items) elif action == "donation": self.open_donation_page() elif action == "library": library = TimVisionLibrary.TimVisionLibrary() library.update(force=True) elif action == "library_kodi": library = TimVisionLibrary.TimVisionLibrary() library.check_db_integrity() pass
disabledDialog() else: enabledDialog() elif sys.argv[1] == "activity": val = "true" try: val = "true" if sys.argv[2] == "true" else "false" except: pass utils.set_setting("activity_enable",val) if val == "true": enabledDiaglog() else: disabledDialog() elif sys.argv[1] == "settings": utils.open_settings() else: dialog = xbmcgui.Dialog() options = sorted([elem for elem in SCENES.keys() if elem!="None"]) change_index = len(options) options.append(" - " + toggleState + " Activities -") options.append(" - Settings -") options.append(" - Cancel - ") rets = dialog.select("Select a Scene (Activities " + currentState + ")",options) txt = options[rets] if rets < change_index: Main(options[rets]) elif txt == " - Settings -": utils.open_settings() elif txt == " - Enable Activities -": utils.set_setting("activity_enable","true")