我们从Python开源项目中,提取了以下29个代码示例,用于说明如何使用xbmcgui.NOTIFICATION_INFO。
def doPlay(): if not configureTMDB(): return dbid = getDbId() imdbnumber = getIMDBNumber() mediatype = getMediaType() xbmcgui.Dialog().notification(ADDON.getLocalizedString(32009), sys.listitem.getLabel(), xbmcgui.NOTIFICATION_INFO, 3000) log.debug("Playing for: DBID=%s, IMDB=%s, MediaType=%s" % (dbid, imdbnumber, mediatype)) if mediatype == 'movie': tmdb_id = getTMDBId('movie', imdbnumber) url = "plugin://plugin.video.quasar/library/movie/play/%s" % tmdb_id elif mediatype == 'episode': (show_id, season_number, episode_number) = getEpisodeDetails() tmdb_id = getTMDBId('show', show_id) url = "plugin://plugin.video.quasar/library/show/play/%s/%s/%s" % (tmdb_id, season_number, episode_number) log.debug("Fetched TMDB: %s" % tmdb_id) if tmdb_id is not None: log.debug("Starting Quasar with: %s" % url) xbmc.Player().play(url)
def get_json(url): headers = {'Accept': '*/*', 'reqPayload': ADDON.getSetting(id='EPGreqPayload'), 'User-Agent': UA_ANDROID_TV, 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.5', 'X-Requested-With': 'com.snei.vue.android', 'Connection': 'keep-alive' } r = requests.get(url, headers=headers, cookies=load_cookies(), verify=VERIFY) if r.status_code != 200: dialog = xbmcgui.Dialog() msg = 'The request could not be completed.' try: json_source = r.json() msg = json_source['header']['error']['message'] except: pass dialog.notification('Error '+str(r.status_code), msg, xbmcgui.NOTIFICATION_INFO, 9000) sys.exit() return r.json()
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False): if icon == '': icon = addonIcon() elif icon == 'INFO': icon = xbmcgui.NOTIFICATION_INFO elif icon == 'WARNING': icon = xbmcgui.NOTIFICATION_WARNING elif icon == 'ERROR': icon = xbmcgui.NOTIFICATION_ERROR dialog.notification(heading, message, icon, time, sound=sound)
def clear_cache(): info = plugin.get_storage('info') homemenu = plugin.get_storage('homemenu') pcs_info = plugin.get_storage('pcs_info') info.clear() homemenu.clear() pcs_info.clear() dialog.notification('', u'????', xbmcgui.NOTIFICATION_INFO, 3000) xbmc.executebuiltin('Container.Refresh') return
def playlist_path(pcs_file_path, stream): user_info = get_user_info() user_name = user_info['username'] user_cookie = user_info['cookie'] user_tokens = user_info['tokens'] if stream: playlist_data = pcs.get_streaming_playlist(user_cookie, pcs_file_path, stream) if playlist_data: raw_dir = os.path.dirname(pcs_file_path) m = re.search('\/(.*)', raw_dir) dirname = m.group(1) basename = os.path.basename(pcs_file_path) r = re.search('(.*)\.(.*)$', basename) filename = ''.join([r.group(1), stream, '.m3u8']) dirpath = os.path.join(utils.data_dir(), user_name, dirname) if not xbmcvfs.exists(dirpath): xbmcvfs.mkdirs(dirpath) filepath = os.path.join(dirpath, filename) tmpFile = xbmcvfs.File(filepath, 'w') tmpFile.write(bytearray(playlist_data, 'utf-8')) return filepath else: dialog.notification('', u'??????', xbmcgui.NOTIFICATION_INFO, 4000) return None else: url = pcs.stream_download(user_cookie, user_tokens, pcs_file_path) if url: return url else: dialog.notification('', u'??????????????', xbmcgui.NOTIFICATION_INFO, 4000) return None
def resolve_url(url): duration=7500 #in milliseconds message = "Cannot Play URL" stream_url = urlresolver.HostedMediaFile(url=url).resolve() # If urlresolver returns false then the video url was not resolved. if not stream_url: dialog = xbmcgui.Dialog() dialog.notification("URL Resolver Error", message, xbmcgui.NOTIFICATION_INFO, duration) return False else: return stream_url
def resolve_url(url): duration = 7500 # in milliseconds message = "Cannot Play URL" stream_url = urlresolver.HostedMediaFile(url=url).resolve() # If urlresolver returns false then the video url was not resolved. if not stream_url: dialog = xbmcgui.Dialog() dialog.notification("URL Resolver Error", message, xbmcgui.NOTIFICATION_INFO, duration) return False else: return stream_url
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False): if icon == '': icon = addonIcon() elif icon == 'INFO': icon = xbmcgui.NOTIFICATION_INFO elif icon == 'WARNING': icon = xbmcgui.NOTIFICATION_WARNING elif icon == 'ERROR': icon = xbmcgui.NOTIFICATION_ERROR dialog.notification(heading=heading, message=message, icon=icon, time=time, sound=sound)
def show_no_search_results_notify(self): """ Shows notification that no search results could be found :return: bool - Dialog shown """ dlg = xbmcgui.Dialog() dialog = dlg.notification( heading=self.get_local_string(string_id=30011), message=self.get_local_string(string_id=30013), icon=xbmcgui.NOTIFICATION_INFO, time=self.notify_time) return dialog
def show_no_seasons_notify(self): """ Shows notification that no seasons be found :returns: bool - Dialog shown """ dlg = xbmcgui.Dialog() dialog = dlg.notification( heading=self.get_local_string(string_id=30010), message=self.get_local_string(string_id=30012), icon=xbmcgui.NOTIFICATION_INFO, time=self.notify_time) return dialog
def show_db_updated_notify(self): """ Shows notification that local db was updated :returns: bool - Dialog shown """ dlg = xbmcgui.Dialog() dialog = dlg.notification( heading=self.get_local_string(string_id=15101), message=self.get_local_string(string_id=30050), icon=xbmcgui.NOTIFICATION_INFO, time=self.notify_time) return dialog
def show_no_metadata_notify(self): """ Shows notification that no metadata is available :returns: bool - Dialog shown """ dlg = xbmcgui.Dialog() dialog = dlg.notification( heading=self.get_local_string(string_id=14116), message=self.get_local_string(string_id=195), icon=xbmcgui.NOTIFICATION_INFO, time=self.notify_time) return dialog
def show_autologin_enabled_notify(self): """ Shows notification that auto login is enabled :returns: bool - Dialog shown """ dlg = xbmcgui.Dialog() dialog = dlg.notification( heading=self.get_local_string(string_id=14116), message=self.get_local_string(string_id=30058), icon=xbmcgui.NOTIFICATION_INFO, time=self.notify_time) return dialog
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False): if icon == '': icon = icon=__addon__.getAddonInfo('icon') elif icon == 'INFO': icon = xbmcgui.NOTIFICATION_INFO elif icon == 'WARNING': icon = xbmcgui.NOTIFICATION_WARNING elif icon == 'ERROR': icon = xbmcgui.NOTIFICATION_ERROR dialog.notification(heading, message, icon, time, sound=sound)
def favorites_add(content_type, item_id): ok = session.user.favorites.add(content_type, item_id) if ok: xbmcgui.Dialog().notification(heading=plugin.name, message=_T(30231).format(what=_T(content_type)), icon=xbmcgui.NOTIFICATION_INFO) xbmc.executebuiltin('Container.Refresh()')
def favorites_remove(content_type, item_id): ok = session.user.favorites.remove(content_type, item_id) if ok: xbmcgui.Dialog().notification(heading=plugin.name, message=_T(30232).format(what=_T(content_type)), icon=xbmcgui.NOTIFICATION_INFO) xbmc.executebuiltin('Container.Refresh()')
def stream_locked(): xbmcgui.Dialog().notification(heading=plugin.name, message=_T(30242), icon=xbmcgui.NOTIFICATION_INFO)
def dialog_notification(heading, message, icon=0, time=5000, sound=True): dialog = xbmcgui.Dialog() try: l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR dialog.notification(heading, message, l_icono[icon], time, sound) except: dialog_ok(heading, message)
def doAssign(): if not configureTMDB(): return dbid = getDbId() imdbnumber = getIMDBNumber() mediatype = getMediaType() xbmcgui.Dialog().notification(ADDON.getLocalizedString(32011) if mediatype == 'season' else ADDON.getLocalizedString(32010), sys.listitem.getLabel(), xbmcgui.NOTIFICATION_INFO, 3000) log.debug("Assigning for: DBID=%s, IMDB=%s, MediaType=%s" % (dbid, imdbnumber, mediatype)) # xbmc.executebuiltin("XBMC.RunPlugin(plugin://plugin.video.quasar/library/movie/play/%s)" % imdbnumber)
def dialog_notification(heading, message, icon=0, time=5000, sound=True): dialog = xbmcgui.Dialog() l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR dialog.notification(heading, message, l_icono[icon], time, sound)
def getPlaybackInfo(url): if addon.getSetting("framerate") == 'false': return '' Dialog.notification(xbmc.getLocalizedString(20186), '', xbmcgui.NOTIFICATION_INFO, 60000, False) values = getFlashVars(url) if not values: return '' data = getUrldata(mode='catalog/GetPlaybackResources', values=values, extra=True) fr = getStreams(*data) Dialog.notification(xbmc.getLocalizedString(20186), '', xbmcgui.NOTIFICATION_INFO, 10, False) return fr
def sendInfo(self, message, action=Action()): self._sendMessage(xbmcgui.NOTIFICATION_INFO, self.context._(32040), message, action)
def notification_msg(self, title, msg): dialog = xbmcgui.Dialog() dialog.notification(title, msg, xbmcgui.NOTIFICATION_INFO, 9000)
def list_timeline(): url = 'https://sentv-user-ext.totsuko.tv/sentv_user_ext/ws/v2/profile/' json_source = get_json(url + PROF_ID) if 'body' in json_source and 'watch_history' in json_source['body']: watch_history = json_source['body']['watch_history'] air_dict = {} air_list = [] for airing in watch_history: xbmc.log(str(airing['airing_id']) + ' ' + str(airing['last_watch_date'])) air_dict[str(airing['last_watch_date'])] = str(airing['airing_id']) air_list.append(str(airing['last_watch_date'])) else: dialog.notification('No airing ID found', msg, xbmcgui.NOTIFICATION_INFO, 9000) sys.exit() json_source = get_json(EPG_URL + '/timeline/' + air_dict[air_list[0]]) for strand in json_source['body']['strands']: if strand['id'] == 'now_playing': addDir('[B][I][COLOR=FFFFFF66]Now Playing[/COLOR][/B][/I]', 998, ICON) for program in strand['programs']: list_episode(program) elif strand['id'] == 'watched_episodes': addDir('[B][I][COLOR=FFFFFF66]Watched Episodes[/COLOR][/B][/I]', 998, ICON) for program in reversed(strand['programs']): list_episode(program) elif strand['id'] == 'coming_up': addDir('[B][I][COLOR=FFFFFF66]Coming Up On Channel:[/COLOR][/B][/I]'+' '+strand['programs'][0]['channel']['name_short'], 998, ICON) for program in strand['programs']: list_episode(program)
def message_ok(message): xbmcgui.Dialog().notification("Soap4.me", message, icon=xbmcgui.NOTIFICATION_INFO, sound=False)
def addToWatchlist(asset_id, asset_type): skygo.login() url = base_url + 'add?assetId=' + asset_id + '&type=' + asset_type + '&version=12354&platform=web&product=SG&catalog=sg' r = skygo.session.get(url) res = json.loads(r.text[3:len(r.text)-1]) if res['resultMessage'] == 'OK': xbmcgui.Dialog().notification('SkyGo ', asset_type + ' zur Merkliste hinzugefügt', xbmcgui.NOTIFICATION_INFO, 2000, True) else: xbmcgui.Dialog().notification('SkyGo ', asset_type + ' konnte nicht zur Merkliste hinzugefügt werden', xbmcgui.NOTIFICATION_ERROR, 2000, True)