Python xbmcgui.NOTIFICATION_INFO Examples

The following are 30 code examples of xbmcgui.NOTIFICATION_INFO(). 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: subreddit_lists.py    From plugin.video.sparkle with GNU General Public License v3.0 6 votes vote down vote up
def initialize_db(self):
        conn = database.connect(_subreddits_file)
        cur = conn.cursor()
        cur.execute("DROP TABLE IF EXISTS subreddits;")
        cur.execute("CREATE TABLE IF NOT EXISTS {tbl} (""url TEXT, ""name TEXT, ""UNIQUE(url)"");".format(tbl=_db_table))
        for k in default_streaming_subreddits:
            cur.execute("INSERT INTO {tbl} VALUES ('{url}', '{name}')".format(
                tbl=_db_table, url=k['url'], name=k['name']))
        conn.commit()
        xbmcgui.Dialog().notification(
            heading="DB Initialized",
            message="Initialized ",
            icon=xbmcgui.NOTIFICATION_INFO,
            time=3000,
            sound=False)
        return conn 
Example #2
Source File: subreddit_lists.py    From plugin.video.sparkle with GNU General Public License v3.0 6 votes vote down vote up
def add_entry(self, url, name):
        cur = self.conn.cursor()
        try:
            statement = "INSERT INTO {} (url, name) VALUES ('{}', '{}')".format(_db_table, url, name)
            log(statement)
            cur.execute(statement)
            self.conn.commit()
        except:
            xbmcgui.Dialog().notification(
                heading="Add entry",
                message="Couldn't add entry ({}, {}) for some reason".format(url, name),
                icon=xbmcgui.NOTIFICATION_INFO,
                time=3000,
                sound=False)
            raise

        xbmcgui.Dialog().notification(
            heading="Add entry",
            message="{} added".format(url),
            icon=xbmcgui.NOTIFICATION_INFO,
            time=3000,
            sound=False) 
Example #3
Source File: subreddit_lists.py    From plugin.video.sparkle with GNU General Public License v3.0 6 votes vote down vote up
def delete_entry(self, url):
        cur = self.conn.cursor()
        try:
            statement = "DELETE FROM {} WHERE url = '{}'".format(_db_table, url)
            log(statement)
            cur.execute(statement)
            self.conn.commit()
        except:
            xbmcgui.Dialog().notification(
                heading="Delete",
                message="Couldn't delete {} for some reason".format(url),
                icon=xbmcgui.NOTIFICATION_INFO,
                time=3000,
                sound=False)
            raise

        xbmcgui.Dialog().notification(
            heading="Delete",
            message="{} deleted".format(url),
            icon=xbmcgui.NOTIFICATION_INFO,
            time=3000,
            sound=False) 
Example #4
Source File: default.py    From script.artwork.beef with MIT License 6 votes vote down vote up
def identify_unmatched(mediatype):
    busy = pykodi.get_busydialog()
    busy.create()
    processed = ProcessedItems()
    ulist = quickjson.get_item_list(mediatype)
    if mediatype == mediatypes.MUSICVIDEO:
        for item in ulist:
            item['label'] = info.build_music_label(item)
    unmatched = [item for item in ulist if not processed.get_data(item[mediatype + 'id'], mediatype, item['label'])]
    busy.close()
    if unmatched:
        selected = xbmcgui.Dialog().select(L(M.UNMATCHED_ITEMS), [item['label'] for item in unmatched])
        if selected < 0:
            return # Cancelled
        mediaitem = info.MediaItem(unmatched[selected])
        info.add_additional_iteminfo(mediaitem, processed, search)
        processor = ArtworkProcessor()
        if processor.manual_id(mediaitem):
            processor.process_item(mediatype, mediaitem.dbid, 'auto')
    else:
        xbmcgui.Dialog().notification("Artwork Beef", L(M.NO_UNMATCHED_ITEMS), xbmcgui.NOTIFICATION_INFO) 
Example #5
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 #6
Source File: addon.py    From xbmc-addons-chinese with GNU General Public License v2.0 6 votes vote down vote up
def get_search(keyword, page):
    serachUrl = 'https://www.acfun.cn/rest/pc-direct/search/video?keyword=' + keyword + '&pCursor=' + str(page)

    r = requests.get(serachUrl, headers=headers)
    r.encoding = 'UTF-8'
    rtext = r.text
    j = json.loads(rtext)
    #dialog = xbmcgui.Dialog()
    #ok = dialog.ok('错误提示', str(j['videoList'][0]['id']))
    videos = []
    if 'videoList' in j:
        for index in range(len(j['videoList'])):
            videoitem = {}
            videoitem['name'] = j['videoList'][index]['title']
            videoitem['href'] = 'https://www.acfun.cn/v/ac'+ str(j['videoList'][index]['id'])
            videoitem['thumb'] = j['videoList'][index]['coverUrl']
            videos.append(videoitem)
        dialog = xbmcgui.Dialog()
        dialog.notification('当前'+ str(page) + '/' + str(j['pageNum']) + '页', '总共'+ str(j['totalNum']) + '个视频', xbmcgui.NOTIFICATION_INFO, 5000,False)
    else:
        dialog = xbmcgui.Dialog()
        ok = dialog.ok('错误提示', '搜索结果为空')
    return videos 
Example #7
Source File: addon.py    From xbmc-addons-chinese with GNU General Public License v2.0 6 votes vote down vote up
def get_up(uid,page):
    videos = []
    apiurl = 'https://www.acfun.cn/space/next?uid='+str(uid)+'&type=video&orderBy=2&pageNo=' +str(page)
    rec = requests.get(apiurl,headers=headers)
    #print(rec.text)
    j = json.loads(rec.text)
    dialog = xbmcgui.Dialog()
    dialog.notification('当前'+ str(j['data']['page']['pageNo']) + '/' + str(j['data']['page']['totalPage']) + '页', '总共'+ str(j['data']['page']['totalCount']) + '个视频', xbmcgui.NOTIFICATION_INFO, 5000,False)
    html = j['data']['html']
    soup = BeautifulSoup(html,'html.parser')
    #print(html)
    fig = soup.find_all('figure')
    #print(len(fig))
    for index in range(len(fig)):
        videoitem = {}
        videoitem['name'] = fig[index]['data-title']
        videoitem['href'] = 'https://www.acfun.cn'+fig[index]['data-url']
        videoitem['thumb'] = fig[index].img['src']
        videos.append(videoitem)
    return videos 
Example #8
Source File: taskABC.py    From script.service.kodi.callbacks with GNU General Public License v3.0 5 votes vote down vote up
def notify(msg):
    dialog = xbmcgui.Dialog()
    dialog.notification('Kodi Callbacks', msg, xbmcgui.NOTIFICATION_INFO, 5000) 
Example #9
Source File: addon.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
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()') 
Example #10
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 #11
Source File: default.py    From plugin.video.bdyun with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #12
Source File: default.py    From plugin.video.bdyun with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #13
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 #14
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 #15
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
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 
Example #16
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
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 
Example #17
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
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 
Example #18
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
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 
Example #19
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
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 
Example #20
Source File: script.py    From script.service.kodi.callbacks with GNU General Public License v3.0 5 votes vote down vote up
def notify(msg):
    dialog = xbmcgui.Dialog()
    dialog.notification('Kodi Callabacks', msg, xbmcgui.NOTIFICATION_INFO, 5000) 
Example #21
Source File: addon.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def stream_locked():
    xbmcgui.Dialog().notification(heading=plugin.name, message=_T(30242), icon=xbmcgui.NOTIFICATION_INFO) 
Example #22
Source File: addon.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
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()') 
Example #23
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #24
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #25
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 #26
Source File: default.py    From script.artwork.beef with MIT License 5 votes vote down vote up
def show_artwork_log():
    if pykodi.get_kodi_version() < 16:
        xbmcgui.Dialog().notification("Artwork Beef", L(M.VERSION_REQUIRED).format("Kodi 16"), xbmcgui.NOTIFICATION_INFO)
        return
    xbmcgui.Dialog().textviewer("Artwork Beef: " + L(M.REPORT_TITLE), reporting.get_latest_report()) 
Example #27
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 #28
Source File: addon.py    From Kodi with GNU Lesser General Public License v3.0 5 votes vote down vote up
def message_ok(message):
        xbmcgui.Dialog().notification("Soap4.me", message, icon=xbmcgui.NOTIFICATION_INFO, sound=False) 
Example #29
Source File: service.py    From plugin.video.sendtokodi with MIT License 5 votes vote down vote up
def showInfoNotification(message):
    xbmcgui.Dialog().notification("SendToKodi", message, xbmcgui.NOTIFICATION_INFO, 5000) 
Example #30
Source File: addon.py    From script.moonlight with GNU General Public License v2.0 4 votes vote down vote up
def index():
    gs = LibGameStream(addon.getAddonInfo("path") + "/lib")

    address = addon.getSetting("MOON_SERVER_IP")
    if address == "0.0.0.0":
        address = gs.discover_server()

    if not gs.connect_server(address, os.path.join(addon_base_path, "keys")):
        dialog = xbmcgui.Dialog()
        dialog.ok("Error", "Failed connect to server (%s)" % (address))
        return

    if not gs.isPaired():
        pin = "%d%d%d%d" % (random.randint(0,9), random.randint(0,9), random.randint(0,9), random.randint(0,9))

        dialog = xbmcgui.Dialog()
        dialog.notification("PIN code", "Insert the pin code in server: %s" % pin, xbmcgui.NOTIFICATION_INFO, 10000)

        if gs.pair(pin):
            dialog = xbmcgui.Dialog()
            dialog.ok("Paired", "Succesfully paired")
        else:
            dialog = xbmcgui.Dialog()
            dialog.ok("Error", "Failed to pair to server, try again")
            return

    for appId, name in gs.applist():
        base_path = os.path.join(addon_base_path, "images")

        if not os.path.exists(base_path):
            os.makedirs(base_path)

        poster_path = os.path.join(base_path, str(appId) + ".png")

        if not os.path.isfile(poster_path):
            gs.poster(appId, base_path)
            xbmc.sleep(100)

        xbmcplugin.addDirectoryItem(handle=addon_handle,
                                    url=build_url({"mode": "stream", "app": name}),
                                    listitem=xbmcgui.ListItem(label=name, thumbnailImage=poster_path),
                                    isFolder=False)

    xbmcplugin.endOfDirectory(addon_handle)