本文整理汇总了Python中xbmcgui.NOTIFICATION_WARNING属性的典型用法代码示例。如果您正苦于以下问题:Python xbmcgui.NOTIFICATION_WARNING属性的具体用法?Python xbmcgui.NOTIFICATION_WARNING怎么用?Python xbmcgui.NOTIFICATION_WARNING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类xbmcgui
的用法示例。
在下文中一共展示了xbmcgui.NOTIFICATION_WARNING属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_notification
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
def show_notification(self, heading, message, icon=xbmcgui.NOTIFICATION_INFO, time=5000, sound=True):
"""
Shows a notification to the user
Args:
heading(str|int): Heading text of the notification.
Can be a string or a numerical id to a localized text.
message(str|int): Text of the notification.
Can be a string or a numerical id to a localized text.
icon(id, optional): xbmc id of the icon. Can be `xbmcgui.NOTIFICATION_INFO`,
`xbmcgui.NOTIFICATION_WARNING` or `xbmcgui.NOTIFICATION_ERROR`.
Default is `xbmcgui.NOTIFICATION_INFO`
time(int, optional): Number of milliseconds the notification stays
visible. Default is 5000.
sound(bool, optional): If `True` a sound is played. Default is `True`
"""
heading = self.language(heading) if isinstance(
heading, int) else heading
message = self.language(message) if isinstance(
message, int) else message
xbmcgui.Dialog().notification(heading, message, icon, time, sound)
示例2: show_warning
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
def show_warning(self, heading, message, time=5000, sound=True):
"""
Shows a warning notification to the user
Args:
heading(str|int): Heading text of the notification.
Can be a string or a numerical id to a localized text.
message(str|int): Text of the notification.
Can be a string or a numerical id to a localized text.
time(int, optional): Number of milliseconds the notification stays
visible. Default is 5000.
sound(bool, optional): If `True` a sound is played. Default is `True`
"""
self.show_notification(
heading, message, xbmcgui.NOTIFICATION_WARNING, time, sound)
示例3: get_track_url
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
def get_track_url(self, track_id, quality=None, cut_id=None, fallback=True):
oldSessionId = self.session_id
self.session_id = self.stream_session_id
soundQuality = quality if quality else self._config.quality
#if soundQuality == Quality.lossless and self._config.codec == 'MQA' and not cut_id:
# soundQuality = Quality.hi_res
media = Session.get_track_url(self, track_id, quality=soundQuality, cut_id=cut_id)
if fallback and soundQuality == Quality.lossless and (media == None or media.isEncrypted):
log(media.url, level=xbmc.LOGWARNING)
if media:
log('Got encryptionKey "%s" for track %s, trying HIGH Quality ...' % (media.encryptionKey, track_id), level=xbmc.LOGWARNING)
else:
log('No Lossless stream for track %s, trying HIGH Quality ...' % track_id, level=xbmc.LOGWARNING)
media = self.get_track_url(track_id, quality=Quality.high, cut_id=cut_id, fallback=False)
if media:
if quality == Quality.lossless and media.codec not in ['FLAC', 'ALAC', 'MQA']:
xbmcgui.Dialog().notification(plugin.name, _T(30504) , icon=xbmcgui.NOTIFICATION_WARNING)
log('Got stream with soundQuality:%s, codec:%s' % (media.soundQuality, media.codec))
self.session_id = oldSessionId
return media
示例4: infoDialog
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
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)
示例5: save_arttypes
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
def save_arttypes(arttype_map):
root = read_xml()
if root is None:
xbmcgui.Dialog().notification("Artwork Beef", L(MALFORMED), xbmcgui.NOTIFICATION_WARNING)
return False
set_arttypes(root, arttype_map)
if save_backup():
save_xml(root)
xbmcgui.Dialog().ok("Artwork Beef", L(RESTART_KODI))
示例6: notify_warning
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
def notify_warning(self, message, header=None, error=False):
if settings.progressdisplay != PROGRESS_DISPLAY_NONE:
header = "Artwork Beef: " + header if header else "Artwork Beef"
xbmcgui.Dialog().notification(header, message,
xbmcgui.NOTIFICATION_ERROR if error else xbmcgui.NOTIFICATION_WARNING)
示例7: cache_artwork
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
def cache_artwork(librarytype='videos'):
fileman = FileManager(False, True)
if not fileman.imagecachebase:
xbmcgui.Dialog().notification("Artwork Beef", L(M.REMOTE_CONTROL_REQUIRED),
xbmcgui.NOTIFICATION_WARNING)
return
heading = L(M.CACHE_VIDEO_ARTWORK if librarytype == 'videos' else M.CACHE_MUSIC_ARTWORK)
cached = runon_medialist(lambda mi: fileman.cachefor(mi.art, True), heading, librarytype, fg=True)
xbmcgui.Dialog().ok("Artwork Beef", L(M.CACHED_COUNT).format(cached))
示例8: dialog_notification
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
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)
示例9: notification
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
def notification(title=None, message=None, icon=None, time=3000, sound=False):
if title == 'default' or title is None:
title = addonName()
heading = str(title)
body = str(message)
if icon is None or icon == '' or icon == 'default':
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, body, icon, time, sound=sound)
示例10: infoDialog
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
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)
示例11: get_video_url
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import NOTIFICATION_WARNING [as 别名]
def get_video_url(self, video_id, maxHeight=-1):
oldSessionId = self.session_id
self.session_id = self.http_video_session_id
maxVideoHeight = maxHeight if maxHeight > 0 else self._config.maxVideoHeight
media = None
try:
if self._config.forceHttpVideo:
quality = 'LOW' if self._config.maxVideoHeight < 480 else 'MEDIUM' if self._config.maxVideoHeight < 720 else 'HIGH'
media = Session.get_video_url(self, video_id, quality=quality)
except requests.HTTPError as e:
r = e.response
msg = _T(30505)
try:
msg = r.reason
msg = r.json().get('userMessage')
except:
pass
log('HTTP-Error: ' + msg, xbmc.LOGERROR)
log('Got no HTTP Stream for Video ID %s, using HLS Stream ...' % video_id, xbmc.LOGERROR)
xbmcgui.Dialog().notification(plugin.name, _T(30510), xbmcgui.NOTIFICATION_WARNING)
if not media:
# Using HLS-Stream
self.session_id = self.stream_session_id
media = Session.get_video_url(self, video_id, quality=None)
if maxVideoHeight <> 9999 and media.url.lower().find('.m3u8') > 0:
log('Parsing M3U8 Playlist: %s' % media.url)
m3u8obj = m3u8_load(media.url)
if m3u8obj.is_variant and not m3u8obj.cookies:
# Variant Streams with Cookies have to be played without stream selection.
# You can change the Bandwidth Limit in Kodi Settings to select other streams !
# Select stream with highest resolution <= maxVideoHeight
selected_height = 0
selected_bandwidth = -1
for playlist in m3u8obj.playlists:
try:
width, height = playlist.stream_info.resolution
bandwidth = playlist.stream_info.average_bandwidth
if not bandwidth:
bandwidth = playlist.stream_info.bandwidth
if not bandwidth:
bandwidth = 0
if (height > selected_height or (height == selected_height and bandwidth > selected_bandwidth)) and height <= maxVideoHeight:
if re.match(r'https?://', playlist.uri):
media.url = playlist.uri
else:
media.url = m3u8obj.base_uri + playlist.uri
if height == selected_height and bandwidth > selected_bandwidth:
log('Bandwidth %s > %s' % (bandwidth, selected_bandwidth))
log('Selected %sx%s %s: %s' % (width, height, bandwidth, playlist.uri.split('?')[0].split('/')[-1]))
selected_height = height
selected_bandwidth = bandwidth
media.width = width
media.height = height
media.bandwidth = bandwidth
elif height > maxVideoHeight:
log('Skipped %sx%s %s: %s' % (width, height, bandwidth, playlist.uri.split('?')[0].split('/')[-1]))
except:
pass
self.session_id = oldSessionId
return media