Python xbmcgui.DialogProgressBG() Examples

The following are 21 code examples of xbmcgui.DialogProgressBG(). 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: library.py    From plugin.video.emby with GNU General Public License v3.0 6 votes vote down vote up
def set_progress_dialog(self):

        queue_size = self.worker_queue_size()
        try:
            self.progress_percent = int((float(self.total_updates - queue_size) / float(self.total_updates))*100)
        except Exception:
            self.progress_percent = 0

        LOG.debug("--[ pdialog (%s/%s) ]", queue_size, self.total_updates)

        if self.total_updates < int(settings('syncProgress') or 50):
            return

        if self.progress_updates is None:
            LOG.info("-->[ pdialog ]")
            self.progress_updates = xbmcgui.DialogProgressBG()
            self.progress_updates.create(_('addon_name'), _(33178)) 
Example #2
Source File: kodi.py    From script.module.urlresolver with GNU General Public License v2.0 6 votes vote down vote up
def __create_dialog(self, line1, line2, line3):
        if self.background:
            pd = xbmcgui.DialogProgressBG()
            msg = line1 + line2 + line3
            pd.create(self.heading, msg)
        else:
            if xbmc.getCondVisibility('Window.IsVisible(progressdialog)'):
                pd = CustomProgressDialog.ProgressDialog()
            else:
                pd = xbmcgui.DialogProgress()
            if six.PY2:
                pd.create(self.heading, line1, line2, line3)
            else:
                pd.create(self.heading,
                          line1 + '\n'
                          + line2 + '\n'
                          + line3)
        return pd 
Example #3
Source File: artworkprocessor.py    From script.artwork.beef with MIT License 6 votes vote down vote up
def __init__(self, monitor=None):
        self.monitor = monitor or xbmc.Monitor()
        self.language = None
        self.autolanguages = None
        self.progress = xbmcgui.DialogProgressBG()
        self.visible = False
        self.freshstart = "0"
        self.processed = ProcessedItems()
        self.gatherer = None
        self.downloader = None
        self.chunkcount = 1
        self.currentchunk = 0
        self.debug = False
        self.localmode = False
        settings.update_settings()
        mediatypes.update_settings() 
Example #4
Source File: kodiui.py    From plugin.video.mediathekview with MIT License 6 votes vote down vote up
def create(self, heading=None, message=None):
        """
        Shows a progress dialog to the user

        Args:
            heading(str|int): Heading text of the progress dialog.
                Can be a string or a numerical id to a localized text.

            message(str|int): Text of the progress dialog.
                Can be a string or a numerical id to a localized text.
        """
        heading = self.language(heading) if isinstance(
            heading, int) else heading
        message = self.language(message) if isinstance(
            message, int) else message
        if self.pgdialog is None:
            self.pgdialog = xbmcgui.DialogProgressBG()
            self.pgdialog.create(heading, message)
        else:
            self.pgdialog.update(0, heading, message) 
Example #5
Source File: kodi.py    From script.module.resolveurl with GNU General Public License v2.0 6 votes vote down vote up
def __create_dialog(self, line1, line2, line3):
        if self.background:
            pd = xbmcgui.DialogProgressBG()
            msg = line1 + line2 + line3
            pd.create(self.heading, msg)
        else:
            if xbmc.getCondVisibility('Window.IsVisible(progressdialog)'):
                pd = CustomProgressDialog.ProgressDialog()
            else:
                pd = xbmcgui.DialogProgress()
            if six.PY2:
                pd.create(self.heading, line1, line2, line3)
            else:
                pd.create(self.heading,
                          line1 + '\n'
                          + line2 + '\n'
                          + line3)
        return pd 
Example #6
Source File: rpc.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def DialogProgressBG_Create(self, title, message, *args):
        dialog = xbmcgui.DialogProgressBG()
        dialogId = id(dialog)
        self._objects[dialogId] = dialog
        if args and isinstance(args[0], list):
            self._objects["%s-i18n" % dialogId] = {}
            for translation in args[0]:
                self._objects["%s-i18n" % dialogId][translation] = getLocalizedLabel(translation)
        dialog.create(title, getLocalizedLabel(message))
        return dialogId 
Example #7
Source File: ipwww_video.py    From plugin.video.iplayerwww with GNU General Public License v2.0 5 votes vote down vote up
def ListAtoZ():
    """List programmes based on alphabetical order.

    Only creates the corresponding directories for each character.
    """
    characters = [
        ('A', 'a'), ('B', 'b'), ('C', 'c'), ('D', 'd'), ('E', 'e'), ('F', 'f'),
        ('G', 'g'), ('H', 'h'), ('I', 'i'), ('J', 'j'), ('K', 'k'), ('L', 'l'),
        ('M', 'm'), ('N', 'n'), ('O', 'o'), ('P', 'p'), ('Q', 'q'), ('R', 'r'),
        ('S', 's'), ('T', 't'), ('U', 'u'), ('V', 'v'), ('W', 'w'), ('X', 'x'),
        ('Y', 'y'), ('Z', 'z'), ('0-9', '0-9')]

    if int(ADDON.getSetting('scrape_atoz')) == 1:
        pDialog = xbmcgui.DialogProgressBG()
        pDialog.create(translation(30319))
        page = 1
        total_pages = len(characters)
        for name, url in characters:
            GetAtoZPage(url)
            percent = int(100*page/total_pages)
            pDialog.update(percent,translation(30319),name)
            page += 1
        pDialog.close()
    else:
        for name, url in characters:
            AddMenuEntry(name, url, 124, '', '', '') 
Example #8
Source File: kodi.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
def __create_dialog(self, line1, line2, line3):
        if self.background:
            pd = xbmcgui.DialogProgressBG()
            msg = line1 + line2 + line3
            pd.create(self.heading, msg)
        else:
            if xbmc.getCondVisibility('Window.IsVisible(progressdialog)'):
                pd = CustomProgressDialog.ProgressDialog()
            else:
                pd = xbmcgui.DialogProgress()
            pd.create(self.heading, line1, line2, line3)
        return pd 
Example #9
Source File: platformtools.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def dialog_progress_bg(heading, message=""):
    try:
        dialog = xbmcgui.DialogProgressBG()
        dialog.create(heading, message)
        return dialog
    except:
        return dialog_progress(heading, message) 
Example #10
Source File: xbmc_progress_dialog_bg.py    From plugin.video.youtube with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, heading, text):
        AbstractProgressDialog.__init__(self, 100)
        self._dialog = xbmcgui.DialogProgressBG()
        self._dialog.create(heading, text)

        # simple reset because KODI won't do it :(
        self._position = 1
        self.update(steps=-1)
        pass 
Example #11
Source File: koditidal2.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def show_busydialog(self, headline='', textline=''):
        #self.progressWindow = xbmcgui.DialogProgress()
        #self.progressWindow.create(heading=_T(30267), line1=headline, line2=textline)
        # or:
        self.progressWindow = xbmcgui.DialogProgressBG()
        self.progressWindow.create(heading=headline, message=textline)
        self.progressWindow.update(percent=50)
        #if KODI_VERSION >= (18, 0):
        #    xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
        #else:
        #    xbmc.executebuiltin('ActivateWindow(busydialog)') 
Example #12
Source File: dialog.py    From script.module.clouddrive.common with GNU General Public License v3.0 5 votes vote down vote up
def update(self, percent=0, heading=None, message=None):
        if not self.created:
            if not heading: heading = self._default_heading
            self.create(heading=heading, message=message)
        if percent < 0: percent = 0
        if percent > 100: percent = 100
        super(DialogProgressBG, self).update(percent=percent, heading=heading, message=message) 
Example #13
Source File: dialog.py    From script.module.clouddrive.common with GNU General Public License v3.0 5 votes vote down vote up
def close(self):
        if self.created:
            super(DialogProgressBG, self).close()
            self.created = False 
Example #14
Source File: dialog.py    From script.module.clouddrive.common with GNU General Public License v3.0 5 votes vote down vote up
def create(self, heading, message=None):
        if self.created:
            self.update(heading=heading, message=message)
        else:
            super(DialogProgressBG, self).create(heading, message)
            self.created = True 
Example #15
Source File: addon.py    From plugin.video.stalker with GNU General Public License v2.0 5 votes vote down vote up
def playLevel():
	
	dp = xbmcgui.DialogProgressBG();
	dp.create('IPTV', 'Loading ...');
	
	title 	= args['title'][0];
	cmd 	= args['cmd'][0];
	tmp 	= args['tmp'][0];
	genre_name 	= args['genre_name'][0];
	logo_url 	= args['logo_url'][0];
	
	
	try:
		if genre_name != 'VoD':
			url = load_channels.retriveUrl(portal['mac'], portal['url'], portal['serial'], cmd, tmp);
		else:
			url = load_channels.retriveVoD(portal['mac'], portal['url'], portal['serial'], cmd);

	
	except Exception as e:
		dp.close();
		xbmcgui.Dialog().notification(addonname, str(e), xbmcgui.NOTIFICATION_ERROR );
		return;
	
	dp.update(80);
	
	title = title.decode("utf-8");
	
	title += ' (' + portal['name'] + ')';
	
	li = xbmcgui.ListItem(title, iconImage=logo_url);
	li.setInfo('video', {'Title': title, 'Genre': genre_name});
	xbmc.Player().play(item=url, listitem=li);
	
	dp.update(100);
	
	dp.close(); 
Example #16
Source File: kodiutils.py    From script.module.inputstreamhelper with MIT License 5 votes vote down vote up
def bg_progress_dialog():
    """Show Kodi's Background Progress dialog"""
    return DialogProgressBG() 
Example #17
Source File: platformtools.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def dialog_progress_bg(heading, message=""):
    try:
        dialog = xbmcgui.DialogProgressBG()
        dialog.create(heading, message)
        return dialog
    except:
        return dialog_progress(heading, message) 
Example #18
Source File: control.py    From bugatsinho.github.io with GNU General Public License v3.0 5 votes vote down vote up
def __create_dialog(self, line1, line2, line3):
        if self.background:
            pd = xbmcgui.DialogProgressBG()
            msg = line1 + line2 + line3
            pd.create(self.heading, msg)
        else:
            pd = xbmcgui.DialogProgress()
            pd.create(self.heading, line1, line2, line3)
        return pd 
Example #19
Source File: wrapper.py    From plugin.video.emby with GNU General Public License v3.0 5 votes vote down vote up
def progress(message=None):

    ''' Will start and close the progress dialog.
    '''
    def decorator(func):
        def wrapper(self, item=None, *args, **kwargs):

            dialog = xbmcgui.DialogProgressBG()

            if item and type(item) == dict:

                dialog.create(_('addon_name'), "%s %s" % (_('gathering'), item['Name']))
                LOG.info("Processing %s: %s", item['Name'], item['Id'])
            else:
                dialog.create(_('addon_name'), message)
                LOG.info("Processing %s", message)

            if item:
                args = (item,) + args

            try:
                result = func(self, dialog=dialog, *args, **kwargs)
                dialog.close()
            except Exception:
                dialog.close()

                raise

            return result

        return wrapper
    return decorator 
Example #20
Source File: default.py    From script.artwork.beef with MIT License 4 votes vote down vote up
def runon_medialist(function, heading, medialist='videos', typelabel=None, fg=False):
    progress = xbmcgui.DialogProgress() if fg else xbmcgui.DialogProgressBG()
    progress.create(heading)
    monitor = xbmc.Monitor()

    if medialist == 'videos':
        steps_to_run = [(lambda: quickjson.get_item_list(mediatypes.MOVIE), L(M.MOVIES)),
            (info.get_cached_tvshows, L(M.SERIES)),
            (quickjson.get_seasons, L(M.SEASONS)),
            (lambda: quickjson.get_item_list(mediatypes.MOVIESET), L(M.MOVIESETS)),
            (quickjson.get_episodes, L(M.EPISODES)),
            (lambda: quickjson.get_item_list(mediatypes.MUSICVIDEO), L(M.MUSICVIDEOS))]
    elif medialist == 'music' and get_kodi_version() >= 18:
        steps_to_run = [(lambda: quickjson.get_item_list(mediatypes.ARTIST), L(M.ARTISTS)),
            (lambda: quickjson.get_item_list(mediatypes.ALBUM), L(M.ALBUMS)),
            (lambda: quickjson.get_item_list(mediatypes.SONG), L(M.SONGS))]
    else:
        steps_to_run = ((lambda: medialist, typelabel),)
    stepsize = 100 // len(steps_to_run)

    def update_art_for_items(items, start):
        changedcount = 0
        for i, item in enumerate(items):
            if fg:
                progress.update(start + i * stepsize // len(items), item['label'])
            else:
                progress.update(start + i * stepsize // len(items))
            item = info.MediaItem(item)
            if item.mediatype == mediatypes.SEASON:
                item.file = info.get_cached_tvshow(item.tvshowid)['file']
            updates = function(item)
            if isinstance(updates, int):
                changedcount += updates
            else:
                processed = utils.get_simpledict_updates(item.art, updates)
                if processed:
                    info.update_art_in_library(item.mediatype, item.dbid, processed)
                    changedcount += len(processed)
            if monitor.abortRequested() or fg and progress.iscanceled():
                break
        return changedcount

    fixcount = 0
    for i, (list_fn, listtype) in enumerate(steps_to_run):
        start = i * stepsize
        if fg:
            progress.update(start, line1=L(M.LISTING_ALL).format(listtype))
        else:
            progress.update(start, message=L(M.LISTING_ALL).format(listtype))
        fixcount += update_art_for_items(list_fn(), start)
        if monitor.abortRequested() or fg and progress.iscanceled():
            break

    info.clear_cache()
    progress.close()
    return fixcount 
Example #21
Source File: script.py    From plugin.video.themoviedb.helper with GNU General Public License v3.0 4 votes vote down vote up
def library_autoupdate(self, list_slug=None, user_slug=None):
        busy_dialog = True if self.params.get('busy_dialog') else False
        utils.kodi_log(u'UPDATING TV SHOWS LIBRARY', 1)
        xbmcgui.Dialog().notification('TMDbHelper', 'Auto-Updating Library...')
        basedir_tv = self.addon.getSettingString('tvshows_library') or 'special://profile/addon_data/plugin.video.themoviedb.helper/tvshows/'

        list_slug = list_slug or self.addon.getSettingString('monitor_userlist') or ''
        user_slug = user_slug or TraktAPI().get_usernameslug()
        if user_slug and list_slug:
            for i in list_slug.split(' | '):
                context.library_userlist(
                    user_slug=user_slug, list_slug=i, confirmation_dialog=False,
                    allow_update=False, busy_dialog=busy_dialog)

        p_dialog = xbmcgui.DialogProgressBG() if busy_dialog else None
        p_dialog.create('TMDbHelper', 'Adding items to library...') if p_dialog else None
        for f in xbmcvfs.listdir(basedir_tv)[0]:
            try:
                folder = basedir_tv + f + '/'
                # Get nfo file
                nfo = None
                for x in xbmcvfs.listdir(folder)[1]:
                    if x.endswith('.nfo'):
                        nfo = x
                if not nfo:
                    continue

                # Read nfo file
                vfs_file = xbmcvfs.File(folder + nfo)
                content = ''
                try:
                    content = vfs_file.read()
                finally:
                    vfs_file.close()
                tmdb_id = content.replace('https://www.themoviedb.org/tv/', '')
                tmdb_id = tmdb_id.replace('&islocal=True', '')
                if not tmdb_id:
                    continue

                # Get the tvshow
                url = 'plugin://plugin.video.themoviedb.helper/?info=seasons&tmdb_id={}&type=tv'.format(tmdb_id)
                context.library_addtvshow(basedir=basedir_tv, folder=f, url=url, tmdb_id=tmdb_id, p_dialog=p_dialog)
            except Exception as exc:
                utils.kodi_log(u'LIBRARY AUTO UPDATE ERROR:\n{}'.format(exc))
        p_dialog.close() if p_dialog else None
        if self.addon.getSettingBool('auto_update'):
            xbmc.executebuiltin('UpdateLibrary(video)')