Python xbmcgui.DialogProgress() Examples

The following are 30 code examples of xbmcgui.DialogProgress(). 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: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
def clear_movies():
    movies, limits = get_movies()
    total = limits.get("total")
    progress = xbmcgui.DialogProgress()
    progress.create("Clear (Movies)", "Please wait. Clearing...")
    modify = 0
    for i, movie in enumerate(movies):
        if (progress.iscanceled()):
            break

        if clear_movie(movie):
            modify += 1

        result_string = "{0}: {1}".format("Clear results", modify)
        progress.update(100 * i / total, line2=movie.get("title"), line3=result_string)

#        time.sleep(0.1)
    progress.close() 
Example #2
Source File: kodi.py    From script.module.resolveurl with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, heading, line1='', line2='', line3='', active=True, countdown=60, interval=5):
        self.heading = heading
        self.countdown = countdown
        self.interval = interval
        self.line1 = line1
        self.line2 = line2
        self.line3 = line3
        if active:
            if xbmc.getCondVisibility('Window.IsVisible(progressdialog)'):
                pd = CustomProgressDialog.ProgressDialog()
            else:
                pd = xbmcgui.DialogProgress()
            if not self.line3:
                line3 = 'Expires in: %s seconds' % countdown
            if six.PY2:
                pd.create(self.heading, line1, line2, line3)
            else:
                pd.create(self.heading,
                          line1 + '\n'
                          + line2 + '\n'
                          + line3)
            pd.update(100)
            self.pd = pd
        else:
            self.pd = None 
Example #3
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 #4
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 #5
Source File: kodi.py    From script.module.urlresolver with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, heading, line1='', line2='', line3='', active=True, countdown=60, interval=5):
        self.heading = heading
        self.countdown = countdown
        self.interval = interval
        self.line1 = line1
        self.line2 = line2
        self.line3 = line3
        if active:
            if xbmc.getCondVisibility('Window.IsVisible(progressdialog)'):
                pd = CustomProgressDialog.ProgressDialog()
            else:
                pd = xbmcgui.DialogProgress()
            if not self.line3:
                line3 = 'Expires in: %s seconds' % countdown
            if six.PY2:
                pd.create(self.heading, line1, line2, line3)
            else:
                pd.create(self.heading,
                          line1 + '\n'
                          + line2 + '\n'
                          + line3)
            pd.update(100)
            self.pd = pd
        else:
            self.pd = None 
Example #6
Source File: search.py    From plugin.video.freplay with GNU General Public License v2.0 6 votes vote down vote up
def list_shows(channel,folder):
  shows=[]                                
  progress = xbmcgui.DialogProgress()
  progress.create('Progress', 'This is a progress bar.')
  i=0
  for item in globalvar.ordered_channels:   
    chan_id=item[0]
    chan_title=globalvar.channels[item[0]][0]     
        
    if chan_id!='favourites' and chan_id!='mostviewed' and chan_id!=channel:

      percent = int( ( i / len(globalvar.channels)-3 ) * 100)
      message = chan_title + str( i ) + '-' + str(len(globalvar.channels)-3) + '-' + str(i / (len(globalvar.channels)-3 ))
      progress.update( percent, "", message, "" )
      if progress.iscanceled():
        break    
        
      shows.append( [channel,chan_id, chan_title , os.path.join( globalvar.MEDIA, chan_id +".png"),'shows'] )
      shows_channel=globalvar.channels[chan_id][1].list_shows(chan_id,'none') 
      shows.extend(shows_channel)
      i = i + 1
        
  progress.close()
  return shows 
Example #7
Source File: favourites.py    From plugin.video.freplay with GNU General Public License v2.0 6 votes vote down vote up
def list_videos(channel,show_title):
    videos=[]                
    if show_title=='unseen':
        if os.path.exists(globalvar.FAVOURITES_FILE) :
            #Read favourites
            fileFav = open(globalvar.FAVOURITES_FILE)
            jsonfav = json.loads(fileFav.read())
            pDialog = xbmcgui.DialogProgress()
            ret = pDialog.create(globalvar.LANGUAGE(33002).encode('utf-8'),'')
            i=1
            for show_folder in  jsonfav['favourites']:
                show_folder = [x.encode('utf-8') for x in show_folder]
                pDialog.update((i-1)*100/len(jsonfav['favourites']),globalvar.LANGUAGE(33003).encode('utf-8')+ show_folder[2] + ' - ' + str(i) + '/' +  str(len(jsonfav['favourites'])))
                videos+=(list_videos(show_folder[0],show_folder[1]));
                i+=1
            fileFav.close()
            pDialog.close()
    else:
        videos=globalvar.channels[channel][1].list_videos(channel,show_title) 
    return videos 
Example #8
Source File: program.py    From script.tvtime with GNU General Public License v2.0 6 votes vote down vote up
def Authorization(verification_url, user_code, device_code):
    pDialog = xbmcgui.DialogProgress()
    pDialog.create(__scriptname__, "%s: %s" % (__language__(33806), verification_url), "%s: %s" % (__language__(33807), user_code))
    for i in range(0, 100):
        pDialog.update(i)
        xbmc.sleep(5000)  
        if pDialog.iscanceled(): return
        _authorize = Authorize(device_code)
        if _authorize.is_authorized:
            __addon__.setSetting('token', _authorize.access_token)
            user = GetUserInformations(_authorize.access_token)
            if user.is_authenticated:
                if __welcome__ == 'true':
                    xbmcgui.Dialog().ok(__scriptname__, '%s %s' % (__language__(32902), user.username), __language__(33808))
                __addon__.setSetting('user', user.username)
            return
    pDialog.close() 
Example #9
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
def clear_tvshows():
    tvshows, limits = get_tvshows()
    total = limits.get("total")
    progress = xbmcgui.DialogProgress()
    progress.create("Clear (TVShows)", "Please wait. Clearing...")
    modify = 0
    for i, tvshow in enumerate(tvshows):
        if (progress.iscanceled()):
            break

        if clear_tvshow(tvshow):
            modify += 1

        result_string = "{0}: {1}".format("Clear results", modify)
        progress.update(100 * i / total, line2=tvshow.get("title"), line3=result_string)

#        time.sleep(0.1)
    progress.close() 
Example #10
Source File: http.py    From repository.evgen_dev.xbmc-addons with GNU General Public License v2.0 6 votes vote down vote up
def get_trailer(self, url):
        progress = xbmcgui.DialogProgress()
        progress.create(xbmcup.app.addon['name'])
        progress.update(0)
        html = self.load(url)
        movieInfo = {}
        movieInfo['error'] = False
        if not html:
            xbmcup.gui.message(xbmcup.app.lang[34031].encode('utf8'))
            progress.update(0)
            progress.close()
            return False

        progress.update(50)
        html = html.encode('utf-8')
        soup = xbmcup.parser.html(self.strip_scripts(html))

        link = self.decode_direct_media_url(soup.find('input', id='video-link').get('value'))
        avail_quality = max(map(self.my_int, self.get_qualitys(link)))
        progress.update(100)
        progress.close()
        return self.format_direct_link(link, str(avail_quality)) 
Example #11
Source File: kodi.py    From filmkodi with Apache License 2.0 6 votes vote down vote up
def __init__(self, heading, line1='', line2='', line3='', active=True, countdown=60, interval=5):
        self.heading = heading
        self.countdown = countdown
        self.interval = interval
        self.line3 = line3
        if active:
            if xbmc.getCondVisibility('Window.IsVisible(progressdialog)'):
                pd = CustomProgressDialog.ProgressDialog()
            else:
                pd = xbmcgui.DialogProgress()
            if not self.line3: line3 = 'Expires in: %s seconds' % (countdown)
            pd.create(self.heading, line1, line2, line3)
            pd.update(100)
            self.pd = pd
        else:
            self.pd = None 
Example #12
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
def mark_movies():
    movies, limits = get_movies()
    total = limits.get("total")
    progress = xbmcgui.DialogProgress()
    progress.create("Mark (Movies)", "Please wait. Marking...")
    modify = 0
    for i, movie in enumerate(movies):
        if (progress.iscanceled()):
            break

        if modify_movie(movie):
            modify += 1

        result_string = "{0}: {1}".format("Mark results", modify)
        progress.update(100 * i / total, line2=movie.get("title"), line3=result_string)

#        time.sleep(0.1)
    progress.close() 
Example #13
Source File: default.py    From kodi with GNU General Public License v3.0 6 votes vote down vote up
def mark_tvshows():
    tvshows, limits = get_tvshows()
    total = limits.get("total")
    progress = xbmcgui.DialogProgress()
    progress.create("Mark (TVShows)", "Please wait. Marking...")
    modify = 0
    for i, tvshow in enumerate(tvshows):
        if (progress.iscanceled()):
            break

        if modify_tvshow(tvshow):
            modify += 1

        result_string = "{0}: {1}".format("Mark results", modify)
        progress.update(100 * i / total, line2=tvshow.get("title"), line3=result_string)

#        time.sleep(0.1)
    progress.close() 
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 iscanceled(self):
        if self.created:
            return super(DialogProgress, self).iscanceled()
        return False 
Example #15
Source File: basehost.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
def LOAD_AND_PLAY_VIDEO(self, url, title, icon, year='', plot='', id=''):
        progress = xbmcgui.DialogProgress()
        progress.create('Postęp', '')
        message = "Pracuje...."
        progress.update(10, "", message, "")
        xbmc.sleep(1000)
        progress.update(30, "", message, "")
        progress.update(50, "", message, "")
        VideoLink = ''
        subs = ''
        VideoLink = self.up.getVideoLink(url)
        if isinstance(VideoLink, basestring):
            videoUrl = VideoLink
        else:
            videoUrl = VideoLink[0]
            subs = VideoLink[1]
        progress.update(70, "", message, "")
        if videoUrl == '':
            progress.close()
            d = xbmcgui.Dialog()
            d.ok('Nie znaleziono streamingu', 'Może to chwilowa awaria.', 'Spróbuj ponownie za jakiś czas')
            return False
        if icon == '' or icon == 'None':
            icon = "DefaultVideo.png"
        if plot == '' or plot == 'None':
            plot = ''
        liz = xbmcgui.ListItem(title, iconImage=icon, thumbnailImage=icon, path=videoUrl)
        liz.setInfo(type="video", infoLabels={"Title": title})
        xbmcPlayer = xbmc.Player()
        progress.update(90, "", message, "")
        progress.close()
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz) 
Example #16
Source File: platformtools.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def dialog_progress(heading, line1, line2=" ", line3=" "):
    dialog = xbmcgui.DialogProgress()
    dialog.create(heading, line1, line2, line3)
    return dialog 
Example #17
Source File: ui.py    From plugin.git.browser with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
		xbmcgui.DialogProgress.__init__(self, *args, **kwargs)
		self._silent = False
		self._index = 0
		self._total = 0
		self._percent = 0 
Example #18
Source File: Trakt.py    From plugin.video.openmeta with GNU General Public License v3.0 5 votes vote down vote up
def trakt_get_device_token(device_codes):
	data = {
		'code': device_codes['device_code'],
		'client_id': CLIENT_ID,
		'client_secret': CLIENT_SECRET
		}
	start = time.time()
	expires_in = device_codes['expires_in']
	pDialog = xbmcgui.DialogProgress()
	pDialog.create(title, msg2 + str(device_codes['user_code']))
	try:
		time_passed = 0
		while not xbmc.Monitor().abortRequested() and not pDialog.iscanceled() and time_passed < expires_in:            
			try:
				response = call_trakt('oauth/device/token', data=data, with_auth=False)
			except requests.HTTPError as e:
				if e.response.status_code != 400:
					raise e
				progress = int(100 * time_passed / expires_in)
				pDialog.update(progress)
				xbmc.sleep(max(device_codes['interval'], 1)*1000)
			else:
				return response
			time_passed = time.time() - start
	finally:
		pDialog.close()
		del pDialog
	return None 
Example #19
Source File: pairing.py    From script.tubecast with MIT License 5 votes vote down vote up
def generate_pairing_code():
    monitor = Monitor()
    progress = DialogProgress()
    progress.create(get_string(32000), get_string(32001))
    chromecast = YoutubeCastV1()
    pairing_code = chromecast.pair()

    i = 0

    if PY3:
        progress.update(i, message="{} {}".format(get_string(32002), pairing_code))
    else:
        progress.update(i, get_string(32002), pairing_code)

    start_time = time.time()
    while not monitor.abortRequested() and not chromecast.has_client and not progress.iscanceled() and not (time.time() - start_time) > (60 * 1):
        i += 10
        if i > 100:
            i = 0


        if PY3:
            progress.update(i, message="{} {}".format(get_string(32002), pairing_code))
        else:
            progress.update(i, get_string(32002), pairing_code)

        monitor.waitForAbort(2)
    progress.close() 
Example #20
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 #21
Source File: sutils.py    From plugin.video.sosac.ph with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, provider, settings, addon):
        xbmcprovider.XBMCMultiResolverContentProvider.__init__(
            self, provider, settings, addon)
        provider.parent = self
        self.dialog = xbmcgui.DialogProgress()
        try:
            import StorageServer
            self.cache = StorageServer.StorageServer("Downloader")
        except:
            import storageserverdummy as StorageServer
            self.cache = StorageServer.StorageServer("Downloader") 
Example #22
Source File: rpc.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def DialogProgress_Create(self, *args, **kwargs):
        dialog = xbmcgui.DialogProgress()
        self._objects[id(dialog)] = dialog
        #dialog.create(*args, **kwargs)
        heading, message = makeMessage(*args, **kwargs)
        dialog.create(heading, message)
        return id(dialog) 
Example #23
Source File: rpc.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def DialogInsert(self, *args, **kwargs):
        if PLATFORM['kodi'] <= 16:
            window = DialogInsert("DialogInsertLegacy.xml", ADDON_PATH, "Default")
        else:
            window = DialogInsert("DialogInsert.xml", ADDON_PATH, "Default")
        window.doModal()
        retval = {"type": ("cancelled", "url", "file")[window.type], "path": window.retval}
        del window
        return retval

    ###########################################################################
    # DialogProgress
    ########################################################################### 
Example #24
Source File: net.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def _download(self):
        fd = open(self.request.download, 'wb')
        if self.request.progress:
            self.progress = xbmcgui.DialogProgress()
            self.progress.create(u'Download')

        bs = 1024 * 8
        size = -1
        read = 0
        name = None

        if self.request.progress:
            if 'content-length' in self.response.headers:
                size = int(self.response.headers['content-length'])
            if 'content-disposition' in self.response.headers:
                r = RE['content-disposition'].search(self.response.headers['content-disposition'])
                if r:
                    name = urllib.parse.unquote(r.group(1))

        while 1:
            buf = self.con.read(bs)
            if not buf:
                break
            read += len(buf)
            fd.write(buf)

            if self.request.progress:
                self.progress.update(*self._progress(read, size, name))

        self.response.filename = self.request.download 
Example #25
Source File: platformtools.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def dialog_progress(heading, line1, line2=" ", line3=" "):
    dialog = xbmcgui.DialogProgress()
    dialog.create(heading, makeMessage(line1, line2, line3))
    return dialog 
Example #26
Source File: util.py    From xbmc.service.pushbullet with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,header=T(32100),message=''):
        self.message = message
        self.prog = xbmcgui.DialogProgress()
        self.prog.create(header,message)
        self.current = 0
        self.display = ''
        self.file_pct = 0 
Example #27
Source File: mozie_request.py    From plugin.video.bimozie with GNU General Public License v3.0 5 votes vote down vote up
def __create_queue(self, urls):
        print("*********************** Start Queue %d" % len(urls))
        self.length = len(urls)
        self.q = Queue(maxsize=self.length)
        self.num_theads = min(self.MIN_THREAD, self.length)
        self.dialog = xbmcgui.DialogProgress()
        self.dialog.create('Get URL', "Loading 0/%d urls" % self.length)
        self.results = [{} for x in urls]
        for i in range(len(urls)):
            self.q.put((i, urls[i])) 
Example #28
Source File: traktapi.py    From plugin.video.themoviedb.helper with GNU General Public License v3.0 5 votes vote down vote up
def login(self):
        self.code = self.get_api_request('https://api.trakt.tv/oauth/device/code', postdata={'client_id': self.client_id})
        if not self.code.get('user_code') or not self.code.get('device_code'):
            return  # TODO: DIALOG: Authentication Error
        self.progress = 0
        self.interval = self.code.get('interval', 5)
        self.expirein = self.code.get('expires_in', 0)
        self.auth_dialog = xbmcgui.DialogProgress()
        self.auth_dialog.create(
            self.addon.getLocalizedString(32097),
            self.addon.getLocalizedString(32096),
            self.addon.getLocalizedString(32095) + ': [B]' + self.code.get('user_code') + '[/B]')
        self.poller() 
Example #29
Source File: AddonGithubUpdater.py    From plugin.program.hyperion.configurator with GNU General Public License v2.0 5 votes vote down vote up
def installUpdate(self):
		download_path=os.path.expanduser("~/update_plugin.zip")
		pDialog = xbmcgui.DialogProgress()
		pDialog.create('Updater..', 'Please wait... Installing update...')
		f=open(download_path,"w")
		f.write(urllib2.urlopen("https://github.com/"+self.githubOrg+"/"+self.githubRepo+"/archive/master.zip").read())
		f.close()
		subprocess.call(["unzip","-o",download_path,"-d",self.addonParentFolder])
		pDialog.close() 
Example #30
Source File: AddonGithubUpdater.py    From plugin.program.hyperion.configurator with GNU General Public License v2.0 5 votes vote down vote up
def isUpdateAvailable(self):
		pDialog = xbmcgui.DialogProgress()
		pDialog.create('Updater..', 'Please wait... Checking for updates...')		
		f=open(self.addonFullPath+"/changelog.txt")
		local=f.readlines()[-1]
		f.close()
		try:
			remote=urllib2.urlopen("https://raw.githubusercontent.com/"+self.githubOrg+"/"+self.githubRepo+"/master/changelog.txt").readlines()[-1]
		except Exception, e:
			pDialog.close()
			return false