2015-11-11, 14:29
Hello all
I have made a script for some year ago and it was working as expected but after updating to latest kodi 15.2 it not closing the dialog after the 30 sec timer ends.
Is there someone that can see whats wrong in this script ?
It is displaying a picture and popup a dialog with a question if I want to open the door "yes" or "no" And if no answer in 30 sec it is suppose to close the dialog again. (it is working if no media is playing but if a movie plays it will not remove the dialog popup after 30 sec)
I have made a script for some year ago and it was working as expected but after updating to latest kodi 15.2 it not closing the dialog after the 30 sec timer ends.
Is there someone that can see whats wrong in this script ?
It is displaying a picture and popup a dialog with a question if I want to open the door "yes" or "no" And if no answer in 30 sec it is suppose to close the dialog again. (it is working if no media is playing but if a movie plays it will not remove the dialog popup after 30 sec)
Code:
# Import the XBMC/XBMCGUI modules.
import xbmc, xbmcgui, time, urllib, xbmcvfs, xbmcaddon, os
__addon__ = xbmcaddon.Addon()
__addonid__ = __addon__.getAddonInfo('id')
#url='http://192.168.0.24:8090/snapshot.cgi?user=admin&pwd=server1'
url='http://admin:[email protected]:8098/Cam2.jpg'
path = xbmc.translatePath('special://profile/addon_data/%s' % __addonid__)
if not xbmcvfs.exists(path):
xbmcvfs.mkdir(path)
imagefile = os.path.join(path, 'bell.jpg')
class CamView(xbmcgui.WindowDialog):
def __init__(self):
#set the initial image before the window is shown
urllib.urlretrieve(url, imagefile)
self.image = xbmcgui.ControlImage(870, 120, 380, 253, "")
self.addControl(self.image)
viewer = CamView()
viewer.show()
start_time = time.time()
firstimage = True
urllib.urlretrieve(url, imagefile)
viewer.image.setImage("")
viewer.image.setImage(imagefile)
xbmc.executebuiltin('XBMC.Action(Pause)')
xbmc.executebuiltin('AlarmClock(closedialog,Dialog.Close(all,true),00:30,silent)')
dialog = xbmcgui.Dialog()
resp = dialog.yesno("Doorbell is pressed", "Do you want to open the door ?")
if resp:
urllib.urlopen('http://admin:[email protected]:8098/index.html?doorlock')
xbmc.executebuiltin('XBMC.Action(Pause)')
else:
xbmc.executebuiltin('Dialog.Close(all,true)')
xbmc.executebuiltin('XBMC.Action(Pause)')
viewer.close()
del viewer