Python xbmcgui 模块,DialogProgressBG() 实例源码

我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用xbmcgui.DialogProgressBG()

项目:context.youtube.download    作者:anxdpanic    | 项目源码 | 文件源码
def __init__(self, heading, line1='', line2='', line3='', background=False, active=True):
        if active:
            if background:
                self.pd = xbmcgui.DialogProgressBG()
                msg = line1 + line2 + line3
                self.pd.create(heading, msg)
            else:
                self.pd = xbmcgui.DialogProgress()
                self.pd.create(heading, line1, line2, line3)
            self.background = background
            self.heading = heading
            self.pd.update(0)
        else:
            self.pd = None
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def dialog_progress_bg(heading, message=""):
    try:
        dialog = xbmcgui.DialogProgressBG()
        dialog.create(heading, message)
        return dialog
    except:
        return dialog_progress(heading, message)
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def update_servers():
    xml = scrapertools.cache_page(remote_url + "serverlist.xml")
    remote_dict = read_servers_list(xml)

    with open(os.path.join(local_folder, "serverlist.xml"), 'rb') as f:
        data = f.read()
    local_dict = read_servers_list(data)

    # ----------------------------
    import xbmcgui
    progress = xbmcgui.DialogProgressBG()
    progress.create("Update servers list")
    # ----------------------------

    for index, server_id in enumerate(remote_dict.iterkeys()):
        # ----------------------------
        percentage = index * 100 / len(remote_dict)
        # ----------------------------
        if server_id not in local_dict or remote_dict[server_id][VERSION_IDX] > local_dict[server_id][VERSION_IDX]:
            data = scrapertools.cache_page(remote_dict[server_id][UPDATE_URL_IDX])

            with open(os.path.join(local_folder, server_id + ".py"), 'wb') as f:
                f.write(data)
            # ----------------------------
            progress.update(percentage, ' Update server: ' + server_id)
            # ----------------------------

    for server_id in set(local_dict.keys()) - set(remote_dict.keys()):
        os.remove(os.path.join(local_folder, server_id + ".py"))

    with open(os.path.join(local_folder, "serverlist.xml"), 'wb') as f:
        f.write(xml)

    # ----------------------------
    progress.close()
    # ----------------------------
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def update_channels():
    with open(os.path.join(local_folder, "channelslist.xml"), 'rb') as f:
        xml = f.read()
    local_dict = read_channels_list(xml)

    xml = scrapertools.cache_page(remote_url + "channelslist.xml")
    remote_dict = read_channels_list(xml)

    # ----------------------------
    import xbmcgui
    progress = xbmcgui.DialogProgressBG()
    progress.create("Update channels list")
    # ----------------------------

    for index, channel_id in enumerate(remote_dict.iterkeys()):
        # ----------------------------
        percentage = index * 100 / len(remote_dict)
        # ----------------------------
        if channel_id not in local_dict or remote_dict[channel_id][VERSION_IDX] > local_dict[channel_id][VERSION_IDX]:
            data = scrapertools.cache_page(remote_dict[channel_id][UPDATE_URL_IDX])

            with open(os.path.join(local_folder, channel_id + ".py"), 'wb') as f:
                f.write(data)
            # ----------------------------
            progress.update(percentage, ' Update channel: ' + channel_id)
            # ----------------------------

    for channel_id in set(local_dict.keys()) - set(remote_dict.keys()):
        os.remove(os.path.join(local_folder, channel_id + ".py"))

    with open(os.path.join(local_folder, "channelslist.xml"), 'wb') as f:
        f.write(xml)

    # ----------------------------
    progress.close()
    # ----------------------------
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def dialog_progress_bg(heading, message=""):
    dialog = xbmcgui.DialogProgressBG()
    dialog.create(heading, message)
    return dialog
项目:script.reddit.reader    作者:gedisony    | 项目源码 | 文件源码
def __init__(self,heading):
        xbmcgui.DialogProgressBG.__init__(self)
        self.heading=heading
        xbmcgui.DialogProgressBG.create(self, self.heading)
项目:script.reddit.reader    作者:gedisony    | 项目源码 | 文件源码
def playURLRVideo(url, name, type_):
    dialog_progress_title='URL Resolver'
    dialog_progress_YTDL = xbmcgui.DialogProgressBG()
    dialog_progress_YTDL.create(dialog_progress_title )
    dialog_progress_YTDL.update(10,dialog_progress_title,translation(32014)  )

    from urlparse import urlparse
    parsed_uri = urlparse( url )
    domain = '{uri.netloc}'.format(uri=parsed_uri)
    try:
        import urlresolver
        #hmf = urlresolver.HostedMediaFile(url)
        dialog_progress_YTDL.update(20,dialog_progress_title,translation(32012)  )

        media_url = urlresolver.resolve(url)
        dialog_progress_YTDL.update(80,dialog_progress_title,translation(32013)  )
        if media_url:
            log( '  URLResolver stream url=' + repr(media_url ))

            pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            pl.clear()
            pl.add(media_url, xbmcgui.ListItem(name))
            xbmc.Player().play(pl, windowed=False)  #scripts play video like this.
        else:
            log( "  Can't URL Resolve:" + repr(url))
            xbmc_notify('URLresolver', translation(32192),icon="type_urlr.png" )  #Failed to get playable url
    except Exception as e:
        xbmc_notify('URLresolver:'+domain, str(e),icon="type_urlr.png" )
    dialog_progress_YTDL.close()
项目:plugin.video.youtube    作者:jdf76    | 项目源码 | 文件源码
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)
项目:plugin.video.youtube    作者:Kolifanes    | 项目源码 | 文件源码
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
项目:addon    作者:alfa-addon    | 项目源码 | 文件源码
def dialog_progress_bg(heading, message=""):
    try:
        dialog = xbmcgui.DialogProgressBG()
        dialog.create(heading, message)
        return dialog
    except:
        return dialog_progress(heading, message)
项目:repository.midraal    作者:midraal    | 项目源码 | 文件源码
def dl_stream(url):
    html = koding.Open_URL(url)
    match = re.findall("hls:.*?'(.*?)'", html)
    dp = xbmcgui.DialogProgressBG()
    dp.create(addon_name, "Downloading")
    for stream in match:
        if "bumper" in stream:
            continue
        stream_ext = stream.split("/")[-1]
        base_stream = stream.replace(stream_ext, "")
        m3u8 = koding.Open_URL(stream)
        lines = m3u8.splitlines()
        num_lines = len(lines)
        for index, line in enumerate(lines):
            percent = int((index * 100) / num_lines)
            dp.update(percent, addon_name, "Downloading")
            if not line.endswith(".m3u8"):
                continue
            sub_m3u8 = koding.Open_URL(base_stream + line)
            for sub_line in sub_m3u8.splitlines():
                if not sub_line.endswith(".ts"):
                    continue
                ts = requests.get(base_stream + sub_line.strip()).content
                path = "test.avi"
                if os.path.isfile(path):
                    mode = "ab"
                else:
                    mode = "wb"
                with open(path, mode) as outfile:
                    outfile.write(ts)
    koding.Text_Box(addon_name, "Finished Downloading")