-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.py
49 lines (33 loc) · 1.2 KB
/
default.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
import xbmc
import xbmcaddon
import xbmcgui
import os
import sys
_addon = xbmcaddon.Addon()
_id = _addon.getAddonInfo('id').decode('utf-8')
_path = _addon.getAddonInfo('path').decode('utf-8')
_skin = os.path.basename(
os.path.normpath(xbmc.translatePath('special://skin/')))
_xml = 'Custom_Screensaver_1166.xml'
class Screensaver(xbmcgui.WindowXMLDialog):
class ExitMonitor(xbmc.Monitor):
def __init(self, exit_callback):
self.exit_callback = exit_callback
def onScreensaverDeactivated(self):
log('Screensaver Deactivated')
self.exit_callback()
def onScreensaverActivated(self):
log('Screensaver Activated')
def onInit(self):
self.monitor = self.ExitMonitor(self.exit)
def exit(self):
self.close()
def log(msg, level=xbmc.LOGDEBUG):
message = '{}: {}'.format(_id, msg)
xbmc.log(msg=msg, level=level)
if __name__ == '__main__':
screensaver_gui = Screensaver(_xml, _path, 'Default', '1080p')
screensaver_gui.doModal()
del screensaver_gui
sys.modules.clear()