-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathservice.py
50 lines (37 loc) · 1.17 KB
/
service.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
50
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
script.skin.helper.skinbackup
Kodi addon to backup skin settings
'''
from resources.lib.colorthemes import ColorThemes
from resources.lib.backuprestore import BackupRestore
from resources.lib.utils import log_msg
import xbmc
import _strptime
class Service():
'''Background service for automatic skin backups and/or automatic colortheme switches'''
def __init__(self):
'''Init'''
self.monitor = xbmc.Monitor()
self.colorthemes = ColorThemes()
self.backuprestore = BackupRestore()
def stop(self):
'''Cleanup Kodi Cpython instances'''
del self.monitor
del self.colorthemes
del self.backuprestore
def run(self):
'''Main service code'''
while not self.monitor.abortRequested():
# check daynight colorthemes
self.colorthemes.check_daynighttheme()
# check for auto backups
self.backuprestore.check_autobackup()
# sleep for one minute
self.monitor.waitForAbort(60)
self.stop()
# main entry point
log_msg("Service started")
Service().run()
log_msg("Service stopped")