本文整理汇总了Python中xbmcgui.DialogProgress方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcgui.DialogProgress方法的具体用法?Python xbmcgui.DialogProgress怎么用?Python xbmcgui.DialogProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmcgui
的用法示例。
在下文中一共展示了xbmcgui.DialogProgress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Authorization
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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()
示例2: __create_dialog
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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
示例3: __init__
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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
示例4: get_trailer
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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))
示例5: mark_movies
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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()
示例6: mark_tvshows
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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()
示例7: clear_movies
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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()
示例8: clear_tvshows
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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()
示例9: list_videos
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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
示例10: list_shows
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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
示例11: __init__
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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
示例12: __init__
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
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")
示例13: root_list
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
def root_list(network_name):
"""
Loads data from master list
"""
network = get_network(network_name)
dialog = xbmcgui.DialogProgress()
dialog.create(smart_utf8(addon.getLocalizedString(39016)))
current = 0
rootlist = []
network_name = network.NAME
dialog.update(0, smart_utf8(addon.getLocalizedString(39017)) + network.NAME, smart_utf8(addon.getLocalizedString(39018)))
showdata = network.masterlist()
total_shows = len(showdata)
current_show = 0
for show in showdata:
percent = int( (float(current_show) / total_shows))
dialog.update(percent, smart_utf8(addon.getLocalizedString(39017)) + network.NAME, smart_utf8(addon.getLocalizedString(39005)) + show[0])
current_show += 1
if (dialog.iscanceled()):
return False
for show in showdata:
try:
add_show(show[0], show[1], show[2], show[3], sitedata = show[4])
except:
add_show(show[0], show[1], show[2], show[3])
set_view('root')
示例14: refresh_db
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
def refresh_db():
if not os.path.isfile(ustvpaths.DBFILE):
database.create_db()
networks = get_networks()
dialog = xbmcgui.DialogProgress()
dialog.create(smart_utf8(addon.getLocalizedString(39016)))
total_stations = len(networks)
current = 0
increment = 100.0 / total_stations
all_shows = []
for network in networks:
network_name = network.NAME
if addon.getSetting(network.SITE) == 'true':
percent = int(increment * current)
dialog.update(percent, smart_utf8(addon.getLocalizedString(39017)) + network.NAME, smart_utf8(addon.getLocalizedString(39018)))
showdata = network.masterlist()
for show in showdata:
try:
series_title, mode, submode, url = show
except:
series_title, mode, submode, url, siteplot = show
all_shows.append((smart_unicode(series_title.lower().strip()), smart_unicode(mode), smart_unicode(submode)))
total_shows = len(showdata)
current_show = 0
for show in showdata:
percent = int((increment * current) + (float(current_show) / total_shows) * increment)
dialog.update(percent, smart_utf8(addon.getLocalizedString(39017)) + network.NAME, smart_utf8(addon.getLocalizedString(39005)) + show[0])
get_serie(show[0], show[1], show[2], show[3], forceRefresh = False)
current_show += 1
if (dialog.iscanceled()):
return False
current += 1
command = 'select tvdb_series_title , series_title, mode, submode, url from shows order by series_title'
shows = database.execute_command(command, fetchall = True)
for show in shows:
tvdb_series_title, series_title, mode, submode, url = show
if ((smart_unicode(series_title.lower().strip()),smart_unicode(mode), smart_unicode(submode)) not in all_shows and (smart_unicode(tvdb_series_title.lower().strip()),smart_unicode(mode), smart_unicode(submode)) not in all_shows):
command = 'delete from shows where series_title = ? and mode = ? and submode = ? and url = ?;'
values = (series_title, mode, submode, url)
print "Deleting - " + series_title + " " + mode + " " + submode + " " + url
database.execute_command(command, values, fetchone = True, commit = True)
示例15: convert_subtitles
# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import DialogProgress [as 别名]
def convert_subtitles(video_guid):
try:
file = None
dialog = xbmcgui.DialogProgress()
dialog.create(common.smart_utf8(addon.getLocalizedString(39026)))
dialog.update(0, common.smart_utf8(addon.getLocalizedString(39027)))
str_output = ''
subtitle_data = connection.getURL(CLOSEDCAPTION % video_guid, connectiontype = 0)
subtitle_data = simplejson.loads(subtitle_data)
lines_total = len(subtitle_data)
dialog.update(0, common.smart_utf8(addon.getLocalizedString(39028)))
for i, subtitle_line in enumerate(subtitle_data):
if subtitle_line is not None and 'Text' in subtitle_line['metadata']:
if (dialog.iscanceled()):
return
if i % 10 == 0:
percent = int( (float(i*100) / lines_total) )
dialog.update(percent, common.smart_utf8(addon.getLocalizedString(30929)))
sub = common.smart_utf8(subtitle_line['metadata']['Text'])
start_time = common.smart_utf8(str(subtitle_line['startTime'])).split('.')
start_minutes, start_seconds = divmod(int(start_time[0]), 60)
start_hours, start_minutes = divmod(start_minutes, 60)
start_time = '%02d:%02d:%02d,%02d' % (start_hours, start_minutes, start_seconds, int(start_time[1][0:2]))
end_time = common.smart_utf8(str(subtitle_line['endTime'])).split('.')
end_minutes, end_seconds = divmod(int(end_time[0]), 60)
end_hours, end_minutes = divmod(end_minutes, 60)
end_time = '%02d:%02d:%02d,%02d' % (end_hours, end_minutes, end_seconds, int(end_time[1][0:2]))
str_output += str(i + 1) + '\n' + start_time + ' --> ' + end_time + '\n' + sub + '\n\n'
file = open(ustvpaths.SUBTITLE, 'w')
file.write(str_output)
file.close()
except Exception, e:
print "Exception: " + unicode(e)
common.show_exception(NAME, addon.getLocalizedString(39030))