Python xbmcgui.NOTIFICATION_WARNING Examples

The following are 12 code examples of xbmcgui.NOTIFICATION_WARNING(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmcgui , or try the search function .
Example #1
Source File: kodiui.py    From plugin.video.mediathekview with MIT License 6 votes vote down vote up
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) 
Example #2
Source File: kodiui.py    From plugin.video.mediathekview with MIT License 6 votes vote down vote up
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) 
Example #3
Source File: koditidal.py    From plugin.audio.tidal2 with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #4
Source File: control.py    From plugin.video.sparkle with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #5
Source File: advancedsettings.py    From script.artwork.beef with MIT License 5 votes vote down vote up
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)) 
Example #6
Source File: artworkprocessor.py    From script.artwork.beef with MIT License 5 votes vote down vote up
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) 
Example #7
Source File: default.py    From script.artwork.beef with MIT License 5 votes vote down vote up
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)) 
Example #8
Source File: platformtools.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #9
Source File: control.py    From script.module.openscrapers with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #10
Source File: platformtools.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #11
Source File: control.py    From plugin.video.brplay with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #12
Source File: koditidal.py    From plugin.audio.tidal2 with GNU General Public License v3.0 4 votes vote down vote up
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