def action_add_custom_filter(self, remove=False): if SC.ITEM_PAGE in self.args: st = List(SC.TXT_CUSTOM_FORMAT.format(self.args[SC.ITEM_PAGE])) else: st = List(SC.TXT_CUSTOM_FORMAT.format(self.url)) cfg = { SC.ITEM_URL: '', SC.ITEM_TITLE: '', } if remove is False: label = dinput('Zadaj nazov polozky') if label == '': label = self.args[SC.ITEM_ID] cfg[SC.ITEM_TITLE] = label url = dinput( 'Zadaj url pre [B]plugin[/B] z https://stream-cinema.online/filter', '') if url == '': return False cfg[SC.ITEM_URL] = url else: cfg.update({ SC.ITEM_URL: self.args[SC.ITEM_URL], SC.ITEM_TITLE: self.args[SC.ITEM_TITLE], }) st.add(cfg, remove_only=remove) if remove is True: container_refresh()
def onSettingsChanged(self): # pylint: disable=invalid-name """ Callback when a setting has changed """ if self._has_credentials_changed(): _LOGGER.info('Clearing auth tokens due to changed credentials') self._auth.clear_tokens() # Refresh container kodiutils.container_refresh()
def mylist_del(self, video_type, content_id): """ Remove an item from "My List" :type video_type: str :type content_id: str """ self._vtm_go.del_mylist(video_type, content_id) kodiutils.end_of_directory() kodiutils.container_refresh()
def action_pin(self): pinned = self.get_pinned() if pinned and self.args.get(SC.ITEM_ID) in pinned: info('remove') del pinned[self.args.get(SC.ITEM_ID)] else: info('add') pinned.update({self.args.get(SC.ITEM_ID): True}) self.set_pinned(pinned) container_refresh()
def action_add2hp(self, remove=False): st = list_hp del self.args[SC.ACTION] if remove is False: label = dinput('Zadaj vlastny nazov', self.args[SC.ITEM_ID]) if label == '': label = self.args[SC.ITEM_ID] self.args[SC.ITEM_ID] = label st.add(self.args, remove_only=remove) if remove is True: container_refresh()
def index(): """ Show the profile selection, or go to the main menu. """ try: if (kodiutils.get_setting_bool('auto_login') and kodiutils.get_setting('username') and kodiutils.get_setting('password') and kodiutils.get_setting('profile')): # We have credentials show_main_menu() else: # Ask the user for the profile to use select_profile() except NoLoginException: kodiutils.ok_dialog(message=kodiutils.localize( 30701)) # You need to configure your credentials... kodiutils.open_settings() kodiutils.container_refresh() except InvalidLoginException: kodiutils.ok_dialog(message=kodiutils.localize( 30203)) # Your credentials are not valid! kodiutils.open_settings() kodiutils.end_of_directory() except NoStreamzSubscriptionException: kodiutils.ok_dialog(message=kodiutils.localize( 30201)) # Your Streamz account has no valid subscription! kodiutils.end_of_directory() except NoTelenetSubscriptionException: kodiutils.ok_dialog(message=kodiutils.localize( 30202)) # Your Telenet account has no valid subscription! kodiutils.end_of_directory() except LoginErrorException as exc: kodiutils.ok_dialog(message=kodiutils.localize( 30702, code=exc.code)) # Unknown error while logging in: {code} kodiutils.open_settings() kodiutils.end_of_directory()
def action(self): action = self.args.get(SC.ITEM_ACTION) if action == SC.ACTION_PLAY_URL: self.play_url(self.args.get(SC.ITEM_URL)) self.succeeded = True elif action == SC.ACTION_CMD: self.action_cmd() elif action == 'intro': intro(2, True) elif action == SC.ACTION_PIN: self.action_pin() elif action == SC.ACTION_CSEARCH: self.action_csearch() elif action == SC.ACTION_LAST: self.action_last() elif action == 'nextep': self.action_next_ep() elif action == 'update_nextep': self.action_update_next_ep() return True elif action == 'search_next_episodes': self.action_search_next_episodes() elif action == SC.ACTION_DEBUG: from resources.lib.kodiutils import check_set_debug check_set_debug(True) elif action == SC.ACTION_DOWNLOAD: self.url = self.args.get(SC.ITEM_DOWNLOAD) self.call_url_and_response() elif action == SC.ACTION_BUFFER: set_kodi_cache_size() elif action == SC.ACTION_ANDROID: self.action_android() elif action == SC.ACTION_ADD2HP: self.action_add2hp() elif action == SC.ACTION_DEL2HP: self.action_add2hp(True) elif action == SC.ACTION_ADD_CUSTOM_FILTER: self.action_add_custom_filter() elif action == SC.ACTION_DEL_CUSTOM_FILTER: self.action_add_custom_filter(True) elif action == SC.ACTION_REMOVE_FROM_LIST: self.action_remove_from_list() elif action == SC.ACTION_UPDATE_ADDON: update_addon() elif 'trakt.' in action: from resources.lib.trakt.Trakt import trakt trakt.action(action, self) return True elif action in ['add_to_library', 'add_to_library_sub']: lib = List(SC.ITEM_LIBRARY) lib.add(self.args.get(SC.ITEM_ID)) if action == 'add_to_library_sub': sub = List(SC.ITEM_LIBRARY_SUB) sub.add(self.args.get(SC.ITEM_ID)) container_refresh() elif action == 'remove_from_sub': lib = List(SC.ITEM_LIBRARY) lib.add(self.args.get(SC.ITEM_ID), True) if action == 'remove_from_sub': sub = List(SC.ITEM_LIBRARY_SUB) sub.add(self.args.get(SC.ITEM_ID), True) container_refresh() elif action == 'autocomplet': from resources.lib.services.autocomplete import Autocomplete Autocomplete(self.args) return True elif action == SC.ACTION_DEL_PREFERRED_LANGUAGE: del preferred_lang_list[self.args.get(SC.ITEM_ID)] container_refresh() return elif action == SC.ACTION_SET_PREFERRED_LANGUAGE: lang_list = Sc.get('/Lang/{}'.format(self.args.get(SC.ITEM_ID))) debug('parametre: {} / langs: {}'.format(self.args, lang_list)) ret = dselect(lang_list, Strings.txt(Strings.CONTEXT_ADD_PREF_LANG)) if ret > -1: st = preferred_lang_list st[self.args.get(SC.ITEM_ID)] = lang_list[ret] debug('znovelene: {} / {}'.format( ret, st[self.args.get(SC.ITEM_ID)])) container_refresh() return else: info('Neznama akcia: {}'.format(action)) return False
def action_remove_from_list(self): st = List(self.args[SC.ITEM_PAGE]) st.add(self.args[SC.ITEM_ID], True) container_refresh() pass