def __init__(self, steps): self.enable = setting('hide_progress') == 'false' self.steps = steps self.current = 0 if steps > 0: if self.enable: if utilxbmc.version() >= 13: self.bar = xbmcgui.DialogProgressBG() else: self.bar = xbmcgui.DialogProgress() self.bar.create(info('name')) self.bar.update(0, info('name'))
def update_library(self, path=False): if path and setting('remove_video') == 'true': videolibrary.remove_video(path) if setting('update_library') == 'true': xbmc.executebuiltin('UpdateLibrary(video)') while not xbmc.getCondVisibility('Library.IsScanningVideo'): pass while xbmc.getCondVisibility('Library.IsScanningVideo'): xbmc.sleep(20) percent = (self.current-1) * 100 / self.steps if self.enable: if utilxbmc.version() >= 13: self.bar = xbmcgui.DialogProgressBG() else: self.bar = xbmcgui.DialogProgress() self.bar.create(info('name')) self.bar.update(percent, info('name'), lang(30531) % (self.module_title, lang(30513)))