forked from t0mm0/xbmc-urlresolver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request t0mm0#7 from anarchintosh/master
updated countdown script
- Loading branch information
Showing
2 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
*.pyc | ||
*.pyo | ||
*.cookies | ||
*.DS_Store | ||
temp/* | ||
script.module.urlresolver/resources/settings.xml | ||
doc/build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,49 @@ | ||
''' | ||
Countdown XBMC 0.2 | ||
Countdown XBMC 0.3 | ||
Copyleft Anarchintosh | ||
Set a countdown dialog for XBMC. | ||
Set a countdown dialog with a progress bar for XBMC. | ||
Necessary for some filehosters eg. megaupload | ||
''' | ||
|
||
import xbmc, xbmcgui | ||
|
||
def countdown(time_to_wait,title='',text=''): | ||
return do_xbmc_wait(time_to_wait,title,text) | ||
|
||
def do_xbmc_wait(time_to_wait,title,text): | ||
|
||
print 'waiting '+str(time_to_wait)+' secs' | ||
def countdown( time_to_wait, title='', text='' ): | ||
|
||
time_to_wait = int(time_to_wait) | ||
|
||
pDialog = xbmcgui.DialogProgress() | ||
ret = pDialog.create(title) | ||
|
||
print 'waiting '+str(time_to_wait)+' secs' | ||
|
||
secs=0 | ||
percent=0 | ||
increment = 100 / time_to_wait | ||
|
||
cancelled = False | ||
while secs < time_to_wait: | ||
secs = secs + 1 | ||
percent = increment*secs | ||
while secs <= time_to_wait: | ||
|
||
percent = increment * secs | ||
|
||
secs_left = str((time_to_wait - secs)) | ||
|
||
if secs != 0: xbmc.sleep(1000) | ||
|
||
if secs_left == '0': percent = 100 | ||
|
||
remaining_display = ' Wait '+secs_left+' seconds for the video stream to activate...' | ||
pDialog.update(percent,' '+text,remaining_display) | ||
xbmc.sleep(1000) | ||
|
||
if (pDialog.iscanceled()): | ||
cancelled = True | ||
break | ||
|
||
secs += 1 | ||
|
||
if cancelled == True: | ||
print 'wait cancelled' | ||
return False | ||
else: | ||
print 'done waiting' | ||
return True | ||
|