def _check_bridge_model(self): bridge = qhue.Bridge(self.bridge_ip, None, timeout=QHUE_TIMEOUT) try: bridge_config = bridge.config() model = bridge_config["modelid"] except QhueException as exc: xbmc.log( f"[script.service.hue] Exception: checkBridgeModel {exc.type_id}: {exc.message} {traceback.format_exc()}" ) reporting.process_exception(exc) return None except requests.RequestException as exc: xbmc.log(f"[script.service.hue] Requests exception: {exc}") notification(header=_("Hue Service"), message=_(f"Connection Error"), icon=xbmcgui.NOTIFICATION_ERROR) if model == "BSB002": xbmc.log(f"[script.service.hue] Bridge model OK: {model}") return True xbmc.log(f"[script.service.hue] Unsupported bridge model: {model}") xbmcgui.Dialog().ok( _("Unsupported Hue Bridge"), _("Hue Bridge V1 (Round) is unsupported. Hue Bridge V2 (Square) is required." )) return None
def show_movie(movie): kids = _get_kids_mode() try: _vtmGo = VtmGo(kids=kids) movie_obj = _vtmGo.get_movie(movie) except Exception as ex: notification(message=str(ex)) raise listitem = ListItem(movie_obj.name, offscreen=True) listitem.setPath(plugin.url_for(play_movie, movie=movie)) listitem.setArt({ 'thumb': movie_obj.cover, 'fanart': movie_obj.cover, }) listitem.setInfo( 'video', { 'title': movie_obj.name, 'plot': _format_plot(movie_obj), 'duration': movie_obj.duration, 'year': movie_obj.year, 'mediatype': movie_obj.mediatype, 'aired': movie_obj.aired, }) listitem.addStreamInfo('video', { 'duration': movie_obj.duration, }) listitem.setProperty('IsPlayable', 'true') listitem.setContentLookup(False) Dialog().info(listitem)
def show_search(self, query=None): """ Shows the search dialog. :type query: str """ if not query: # Ask for query query = kodiutils.get_search_string( heading=kodiutils.localize(30009)) # Search Streamz if not query: kodiutils.end_of_directory() return # Do search try: items = self._api.do_search(query) except Exception as ex: # pylint: disable=broad-except kodiutils.notification(message=str(ex)) kodiutils.end_of_directory() return # Display results show_unavailable = kodiutils.get_setting_bool( 'interface_show_unavailable') listing = [] for item in items: if show_unavailable or item.available: listing.append(Menu.generate_titleitem(item)) # Sort like we get our results back. kodiutils.show_listing(listing, 30009, content='tvshows')
def play_movie(link_decoded): xbmcplugin.setContent(_handle, 'movies') try: link = b64decode(link_decoded) data = zalukaj.fetch_movie_details(link) streams = data['streams'] versions = data['versions'] if versions and len(versions) > 1: selected_version = xbmcgui.Dialog().select( "Wybór wersji wideo", [item['version'] for item in versions]) data = zalukaj.fetch_movie_from_player( versions[selected_version]['url']) streams = data['streams'] if not streams or len(streams) == 0: notification(header='[COLOR red]Błąd odtwarzania[/COLOR]', message="Nie można odtworzyć filmu.", time=5000) setResolvedUrl(plugin.handle, False, ListItem(path='')) movie_url = streams[0]['url'] if len(streams) > 1: selected_quality = xbmcgui.Dialog().select( "Wybór jakości wideo", [item['quality'] for item in streams]) movie_url = streams[selected_quality]['url'] setResolvedUrl(plugin.handle, True, ListItem(path=movie_url)) except ZalukajError as e: notification(header='[COLOR red]Błąd[/COLOR]', message=e.message, time=5000)
def get_url(url, headers={}, cache=False, critical=False): log(url) new_headers = {} new_headers.update(headers) if cache == True: new_headers.update({"If-None-Match": ids.get_livestream_config_tag(url)}) new_headers.update({"User-Agent":"okhttp/3.10.0", "Accept-Encoding":"gzip"}) try: request = urlopen(Request(url, headers=new_headers)) except HTTPError as e: if cache and e.code == 304: return ids.get_livestream_config_cache(url) failure = str(e) if hasattr(e, 'code'): log("(getUrl) ERROR - ERROR - ERROR : ########## {0} === {1} ##########".format(url, failure)) elif hasattr(e, 'reason'): log("(getUrl) ERROR - ERROR - ERROR : ########## {0} === {1} ##########".format(url, failure)) if critical: kodiutils.notification("ERROR GETTING URL", failure) return sys.exit(0) else: return "" if request.info().get('Content-Encoding') == 'gzip': # decompress content buffer = StringIO(request.read()) deflatedContent = gzip.GzipFile(fileobj=buffer) data = deflatedContent.read() else: data = request.read() if cache: data = xxtea.decryptBase64StringToStringss(data, ids.xxtea_key) ids.set_livestream_config_cache(url, data, request.info().get('ETag')) return data
def show_tv_series_episodes_list(link_decoded): xbmcplugin.setContent(_handle, 'episodes') try: link = b64decode(link_decoded) for item in zalukaj.fetch_tv_series_episodes_list(link): list_item = ListItem(item['title']) list_item.setArt({ "thumb": item['img'], "poster": item['img'], "banner": item['img'], "icon": item['img'], "landscape": item['img'], "clearlogo": item['img'], "fanart": item['img'] }) list_item.setInfo('video', { "season": item['season'], "episode": item['episode'] }) list_item.setProperty('IsPlayable', 'true') addDirectoryItem( plugin.handle, plugin.url_for(play_movie, b64encode(item['url'])), list_item) except ZalukajError as e: notification(header='[COLOR red]Błąd[/COLOR]', message=e.message, time=5000) endOfDirectory(plugin.handle)
def check_keep_lights_off_rule(self, scene): if not scene: return True xbmc.log( f"[script.service.hue] Check if lights should stay off, settings: enable {ADDON.getSettingBool('keep_lights_off')}" ) if ADDON.getSettingBool("keep_lights_off"): try: scene_data = self.bridge.scenes[scene]() for light in scene_data["lights"]: l = self.bridge.lights[light]() if l["state"][ "on"] is False: # one light is off, the scene should not be applied xbmc.log( "[script.service.hue] Check if lights should stay off: True" ) return False xbmc.log( "[script.service.hue] Check if lights should stay off: False" ) except QhueException as exc: xbmc.log( f"[script.service.hue] checkKeepLightsOffRule: Hue call fail: {exc.type_id}: {exc.message} {traceback.format_exc()}" ) reporting.process_exception(exc) except requests.RequestException as exc: xbmc.log(f"[script.service.hue] Requests exception: {exc}") notification(header=_("Hue Service"), message=_(f"Connection Error"), icon=xbmcgui.NOTIFICATION_ERROR) return True
def getM3U8(self): m3u8 = self.path.split('/')[3] effective_url = "{4}{0}/{1}{2}/{3}".format( self.hlsrx, self.channel_name, '_HLS' if self.ishls else '', m3u8, SERVER) resp = ChannelRequestHandler.make_requests(effective_url) if resp.status_code == 411: kodiutils.notification( "Error", "JioTV can not be accessed from outside India") ts = self.getTS(resp.text) while not ts or resp.status_code != 200: resp = ChannelRequestHandler.make_requests(effective_url) ts = self.getTS(resp.text) if not self.ishls: rq = int(re.search('(.*?_)(\d+)\.m3u8', m3u8).group(2)) quality = rq >= self.maxq and re.sub('\_\d+\-', '_{0}-'.format( self.maxq), ts.group()[1:]) else: quality = m3u8[:1] + ts.group()[2:] resp_text = self.updateTS(resp.text, quality) resp_text = self.updateKey(resp_text, quality) self.proxy.send_response(resp.status_code, 'OK') self.proxy.send_header('Content-Type', 'application/vnd.apple.mpegurl') self.proxy.send_header('Connection', 'keep-alive') self.proxy.send_header('Content-Length', len(resp_text)) self.proxy.end_headers() self.proxy.wfile.write(resp_text)
def films(): """Playable movie items""" url = jafc.get_url(get_arg("href")) data = jafc.get_html(url) paginate(data.find("ul", "pager-menu"), films) container = data.find(True, {"class": ["categories", "characters", "writer-works"]}) if container is None: ku.notification(ku.localize(32008), ku.localize(32009)) # Error - No playable items found return for item in container.find_all("li"): action = item.find("a") if action is None: continue add_menu_item( play_film, item.find(True, {"class": ["category-title", "character-serif", "writer-work-heading"]}).text, args={"href": action["href"]}, info=jafc.get_info(action["href"]), art=ku.art(jafc.get_url(item.find("img", "thumbnail")["src"])), directory=False) xbmcplugin.setContent(plugin.handle, "videos") xbmcplugin.setPluginCategory(plugin.handle, get_arg("title")) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_GENRE) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_DURATION) xbmcplugin.endOfDirectory(plugin.handle)
def check_already_active(self, scene): if not scene: return False xbmc.log( f"[script.service.hue] Check if scene light already active, settings: enable {ADDON.getSettingBool('enable_if_already_active')}" ) if ADDON.getSettingBool("enable_if_already_active"): try: scene_data = self.bridge.scenes[scene]() for light in scene_data["lights"]: l = self.bridge.lights[light]() if l["state"][ "on"]: # one light is on, the scene can be applied # xbmc.log("[script.service.hue] Check if scene light already active: True") return True # xbmc.log("[script.service.hue] Check if scene light already active: False") except QhueException as exc: if ["7", "3"] in exc.type_id: xbmc.log("[script.service.hue] Scene not found") notification(_("Hue Service"), _("ERROR: Scene not found"), icon=xbmcgui.NOTIFICATION_ERROR) else: xbmc.log( f"[script.service.hue] checkAlreadyActive: Hue call fail: {exc.type_id}: {exc.message} {traceback.format_exc()}" ) reporting.process_exception(exc) except requests.RequestException as exc: xbmc.log(f"[script.service.hue] Requests exception: {exc}") notification(header=_("Hue Service"), message=_(f"Connection Error"), icon=xbmcgui.NOTIFICATION_ERROR) return False
def add_favorite(): #data = plugin.args['query'][0].split('***') path = unquote(plugin.args['path'][0]) name = unquote(plugin.args['name'][0]) icon = "" if 'icon' in plugin.args: icon = unquote(plugin.args['icon'][0]) fanart = "" if 'fanart' in plugin.args: fanart = unquote(plugin.args['fanart'][0]) # load favorites global favorites if not favorites and xbmcvfs.exists(favorites_file_path): favorites_file = xbmcvfs.File(favorites_file_path) favorites = json.load(favorites_file) favorites_file.close() #favorites.update({data[0] : data[1]}) favorites.update({path : {"name" : name, "icon" : icon, "fanart" : fanart}}) # load favorites favorites_file = xbmcvfs.File(favorites_file_path, 'w') json.dump(favorites, favorites_file, indent=2) favorites_file.close() try: kodiutils.notification(kodiutils.get_string(32010), kodiutils.get_string(32011).format(codecs.decode(name, 'utf-8'))) except TypeError: kodiutils.notification(kodiutils.get_string(32010), kodiutils.get_string(32011).format(codecs.decode(bytes(name, 'utf-8'), 'utf-8'))) xbmc.executebuiltin('Container.Refresh') setResolvedUrl(plugin.handle, True, ListItem("none"))
def display_location(): geolocation = get_geolocation() if geolocation is not None: image = _settings.get_path('%s%s%s' % ( 'resources/images/', geolocation.response.countrycode.string.lower(), '.png')) utils.notification(_addonname, _settings.get_string(4000) % ( geolocation.response.ipaddress.string, geolocation.response.countryname.string.title()), image=image)
def show(self, header, txt): if isinstance(header, str): header = header.decode('utf-8') if isinstance(txt, str): txt = txt.decode('utf-8') kodiutils.notification(header.encode('utf-8'), txt.encode('utf-8'), self.sleep)
def show_search(self, query=None): """ Shows the search dialog :type query: str """ if not query: # Ask for query query = kodiutils.get_search_string( heading=kodiutils.localize(30009)) # Search if not query: kodiutils.end_of_directory() return # Do search try: items = self._search.search(query) except Exception as ex: # pylint: disable=broad-except kodiutils.notification(message=str(ex)) kodiutils.end_of_directory() return # Display results listing = [self._menu.generate_titleitem(item) for item in items] # Sort like we get our results back. kodiutils.show_listing(listing, 30009, content='tvshows')
def index(): icon = get_url(ids.collections_request_url.format(id=ids.icon_id, page="1")) live_icon = "" highlights_icon = "" highlights_id = ids.highlights_id mediathek_icon = "" mediathek_id = ids.mediathek_id tv_programm_icon = "" tv_programm_id = ids.tv_programm_id if icon != "": icon_json = json.loads(icon) for element in icon_json["results"]: if element["promotion_name"] == "Live": image_json = json.loads(element["images_json"]) live_icon = image_json["menu_icon"] elif element["promotion_name"] == "Highlights": image_json = json.loads(element["images_json"]) highlights_icon = image_json["menu_icon"] highlights_id = element["id"] elif element["promotion_name"] == "Mediathek": image_json = json.loads(element["images_json"]) mediathek_icon = image_json["menu_icon"] mediathek_id = element["id"] elif element["promotion_name"] == "TV Programm": image_json = json.loads(element["images_json"]) tv_programm_icon = image_json["menu_icon"] else: kodiutils.notification("ERROR getting URL", "using saved values") icon_search = get_url(ids.collections_request_url.format(id=ids.search_icon_id, page="1")) search_icon = "" settings_icon = "" if icon_search != "": icon_search_json = json.loads(icon_search) for item in icon_search_json["results"]: images = json.loads(item["images_json"]) if item["name"] == "Search": if "navbar_icon" in images: search_icon = images["navbar_icon"] elif item["name"] == "Service": if "navbar_icon" in images: settings_icon = images["navbar_icon"] else: kodiutils.notification("ERROR getting URL", "using saved values") addDirectoryItem(plugin.handle, plugin.url_for( show_category, "livestream"), ListItem("Live", iconImage=live_icon, thumbnailImage=live_icon), True) addDirectoryItem(plugin.handle, plugin.url_for( get_by_collection, collection_id=highlights_id, page="1", recursive="True"), ListItem("Highlights", iconImage=highlights_icon, thumbnailImage=highlights_icon), True) addDirectoryItem(plugin.handle, plugin.url_for( show_mediathek, mediathek_id), ListItem("Mediathek", iconImage=mediathek_icon, thumbnailImage=mediathek_icon), True) addDirectoryItem(plugin.handle, plugin.url_for( show_category, "tvprogramm"), ListItem("TV Programm", iconImage=tv_programm_icon, thumbnailImage=tv_programm_icon), True) addDirectoryItem(plugin.handle, plugin.url_for( show_search), ListItem(kodiutils.get_string(32001), iconImage=search_icon, thumbnailImage=search_icon), True) addDirectoryItem(plugin.handle, plugin.url_for( show_category, "favorites"), ListItem(kodiutils.get_string(32002)), True) addDirectoryItem(plugin.handle, plugin.url_for( open_settings), ListItem(kodiutils.get_string(32003), iconImage=settings_icon, thumbnailImage=settings_icon)) endOfDirectory(plugin.handle)
def command_reset_preferences() -> None: try: os.remove(common.get_preferences_filename()) kodiutils.notification("Reset preferences", "Preferences have been reset") except FileNotFoundError: # Expected if no preferences were stored yet pass except Exception: logger.exception("Deleting preference file failed")
def show_livetv(): kids = _get_kids_mode() try: _vtmGo = VtmGo(kids=kids) channels = _vtmGo.get_live() except Exception as ex: notification(message=str(ex)) raise for channel in channels: listitem = ListItem(channel.name, offscreen=True) # Try to use the white icons for thumbnails (used for icons as well) if get_cond_visibility( 'System.HasAddon(resource.images.studios.white)') == 1: thumb = 'resource://resource.images.studios.white/{studio}.png'.format( studio=channel.name) else: thumb = channel.logo # Try to use the coloured icons for fanart if get_cond_visibility( 'System.HasAddon(resource.images.studios.coloured)') == 1: fanart = 'resource://resource.images.studios.coloured/{studio}.png'.format( studio=channel.name) elif get_cond_visibility( 'System.HasAddon(resource.images.studios.white)') == 1: fanart = 'resource://resource.images.studios.white/{studio}.png'.format( studio=channel.name) else: fanart = channel.logo listitem.setInfo( 'video', { 'plot': _format_plot(channel), 'playcount': 0, 'studio': channel.name, 'mediatype': channel.mediatype, }) listitem.setArt({ 'icon': channel.logo, 'fanart': fanart, 'thumb': thumb, }) listitem.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem( plugin.handle, plugin.url_for(play_livetv, channel=channel.id) + '?.pvr', listitem) # Sort live channels by default like in VTM GO. xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_UNSORTED) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(plugin.handle)
def display_location(): geolocation = get_geolocation() if geolocation is not None: image = _settings.get_path( '%s%s%s' % ('resources/images/', geolocation.response.countrycode.string.lower(), '.png')) utils.notification(_addonname, _settings.get_string(4000) % (geolocation.response.ipaddress.string, geolocation.response.countryname.string.title()), image=image)
def onWebsocketConnected(self): self.getControl(9100).setEnabled( True) #Enable the connect button when we try to connect kodiutils.notification(__language__(30015), __language__(30017), time=1000) self.GUIOnConnection(True) SessionID = kodiutils.get_setting('SessionID') AuthID = kodiutils.get_setting('AuthID') Username = kodiutils.get_setting('username') self.WS.SendMOTRCommand("SESSIONRESTORE", SessionID + ";" + AuthID + ";" + Username)
def show_catalog(self): """ Show all the programs of all channels """ try: items = self._api.get_programs() except Exception as ex: kodiutils.notification(message=str(ex)) raise listing = [Menu.generate_titleitem(item) for item in items] # Sort items by title # Used for A-Z listing or when movies and episodes are mixed. kodiutils.show_listing(listing, 30003, content='tvshows', sort='title')
def delete_hue_scene(self): xbmc.log("[script.service.hue] In kodiHue deleteHueScene") scene = self.select_hue_scene() if scene is not None: confirm = xbmcgui.Dialog().yesno( heading=_("Delete Hue Scene"), message=_("Are you sure you want to delete this scene:") + f"[CR][B]{scene[1]}[/B]") if confirm: scenes = self.bridge.scenes try: result = scenes[scene[0]](http_method='delete') except QhueException as exc: xbmc.log( f"[script.service.hue]: Delete Hue Scene QhueException: {exc.type_id}: {exc.message} {traceback.format_exc()}" ) notification( _("Hue Service"), _("ERROR: Scene not deleted") + f"[CR]{exc.message}") # xbmc.log(f"[script.service.hue] In kodiHue createHueGroup. Res: {result}") except requests.RequestException as exc: xbmc.log( f"[script.service.hue]: Delete Hue Scene requestsException: {result} {exc}" ) notification(header=_("Hue Service"), message=_(f"Connection Error"), icon=xbmcgui.NOTIFICATION_ERROR) if result[0]["success"]: notification(_("Hue Service"), _("Scene deleted")) else: xbmc.log( f"[script.service.hue] Scene not deleted: {result}") notification(_("Hue Service"), _("ERROR: Scene not deleted"))
def getMaster(self): effective_url = "{4}{0}/{1}{2}/{1}{3}.m3u8".format( self.hlsrx, self.channel_name, '_HLS' if self.ishls else '', self.quality, SERVER) resp = ChannelRequestHandler.make_requests(effective_url) if resp.status_code == 411: kodiutils.notification( "Error", "JioTV can not be accessed from outside India") self.proxy.send_response(resp.status_code, "OK") for key, val in resp.headers.items(): self.proxy.send_header(key, val) # self.proxy.send_header('Content-Length', len(resp.content)) self.proxy.end_headers() self.proxy.wfile.write(resp.content)
def loop(): monitor = xbmc.Monitor() while not monitor.abortRequested(): # Sleep/wait for abort for 10 seconds if kodiutils.get_setting_as_bool("debug"): kodiutils.notification(kodiutils.get_string(30032), "Debug :: Timer set to %d" % kodiutils.get_setting_as_int("timer"), time=5000, icon=ADDON.getAddonInfo('icon'), sound=True) if monitor.waitForAbort(kodiutils.get_setting_as_int("timer")): # Abort was requested while waiting. We should exit break logger.debug("Edem.tv.parser is launched parse function at %s" % time.time()) parse()
def get_wishlist(): # Getting wishlist path = os.path.join(kodiutils.get_setting("wlPath"), kodiutils.get_setting("wlFilename")) if kodiutils.get_setting("wlPath") == "": kodiutils.notification("Warning", "Please set a path where to store a wishlist", time=5000, icon=ADDON.getAddonInfo('icon'), sound=True) path = os.path.join(xbmc.translatePath(ADDON.getAddonInfo('profile')), kodiutils.get_setting("wlFilename")) logger.debug(path) if os.path.exists(path): mode = 'r' else: mode = 'w+' with open(path, mode) as f: f_ch = f.read() return f_ch
def show_movies_section_list(section): try: if section == "kind": for item in zalukaj.fetch_movie_categories_list(): addDirectoryItem( plugin.handle, plugin.url_for(show_movies_list, b64encode(item['url'])), ListItem(item['title']), True) except ZalukajError as e: notification(header='[COLOR red]Błąd[/COLOR]', message=e.message, time=5000) endOfDirectory(plugin.handle)
def show_catalog(self): """ Show all the programs of all channels """ try: items = [] for channel in list(CHANNELS): items.extend(self._api.get_programs(channel)) except Exception as ex: kodiutils.notification(message=str(ex)) raise listing = [self._menu.generate_titleitem(item) for item in items] # Sort items by label, but don't put folders at the top. # Used for A-Z listing or when movies and episodes are mixed. kodiutils.show_listing(listing, 30003, content='tvshows', sort='label')
def show_search(): kids = _get_kids_mode() # Ask for query keyboard = xbmc.Keyboard('', 'Search') keyboard.doModal() if not keyboard.isConfirmed(): return query = keyboard.getText() try: # Do search _vtmGo = VtmGo(kids=kids) items = _vtmGo.do_search(query) except Exception as ex: notification(message=str(ex)) raise # Display results for item in items: listitem = ListItem(item.title, offscreen=True) if item.type == Content.CONTENT_TYPE_MOVIE: listitem.setInfo('video', { 'mediatype': 'movie', }) xbmcplugin.addDirectoryItem( plugin.handle, plugin.url_for(play_movie, movie=item.id), listitem) elif item.type == Content.CONTENT_TYPE_PROGRAM: listitem.setInfo( 'video', { 'mediatype': None, # This shows a folder icon }) xbmcplugin.addDirectoryItem( plugin.handle, plugin.url_for(show_program, program=item.id, kids=kids), listitem, True) xbmcplugin.setContent(plugin.handle, 'tvshows') # Sort like we get our results back. xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_UNSORTED) xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_FOLDERS) xbmcplugin.endOfDirectory(plugin.handle)
def show_tv_series_list(): xbmcplugin.setContent(_handle, 'tvshows') try: for item in zalukaj.fetch_tv_series_list(): addDirectoryItem( plugin.handle, plugin.url_for(show_tv_series_seasons_list, b64encode(item['url'])), ListItem(item['title']), True) except ZalukajError as e: notification(header='[COLOR red]Błąd[/COLOR]', message=e.message, time=5000) endOfDirectory(plugin.handle)
def live(): __addon__ = xbmcaddon.Addon() __profile__ = xbmc.translatePath( __addon__.getAddonInfo('profile') ).decode("utf-8") xbmc.log(__profile__,2) live_videos = db.getLives() if not live_videos: kodiutils.notification( ADDON_NAME, kodiutils.get_string(32009) ) else: for liz in live_videos: addDirectoryItem(plugin.handle, plugin.url_for(play, liz.getProperty("videoid")), liz, False) kodiutils.add_sort_methods(plugin.handle) xbmcplugin.setContent(plugin.handle, 'episodes') endOfDirectory(plugin.handle)
def show_catalog_channel(self, channel): """ Show the programs of a specific channel :type channel: str """ try: items = self._api.get_programs(channel) except Exception as ex: kodiutils.notification(message=str(ex)) raise listing = [] for item in items: listing.append(Menu.generate_titleitem(item)) # Sort items by title # Used for A-Z listing or when movies and episodes are mixed. kodiutils.show_listing(listing, 30003, content='tvshows', sort='title')
def getKey(self): global headers key = self.path.split('/')[3] effective_url = "https://tv.media.jio.com/streams_live/{0}/{1}".format( self.channel_name, key) if not headers: headers = utils.getHeaders() resp = ChannelRequestHandler.make_requests(effective_url, headers) if resp.status_code == 411: kodiutils.notification( "Error", "JioTV can not be accessed from outside India") self.proxy.send_response(resp.status_code, 'OK') self.proxy.send_header('Content-Type', 'application/octet-stream') self.proxy.send_header('Connection', 'keep-alive') self.proxy.send_header('Content-Length', len(resp.content)) self.proxy.end_headers() self.proxy.wfile.write(resp.content)
def display_notification(header, message): image = _settings.get_path('icon.png') utils.notification(header, message, image=image)
def display_notification(text, subtext=False): image = _settings.get_path('icon.png') if subtext: text = text + ': ' + subtext utils.notification(_addonname, text, image=image)