forked from quintyne/repository.renegadestv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.py
55 lines (48 loc) · 1.85 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
51
52
53
54
55
#
# Copyright (C) 2012 Tommy Winther
# http://tommy.winther.nu
#
# Modified for FTV Guide (09/2014 onwards)
# by Thomas Geppert [bluezed] - bluezed.apps@gmail.com
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this Program; see the file LICENSE.txt. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
#
import xbmcaddon
import notification
import xbmc
import source
class Service(object):
def __init__(self):
self.database = source.Database()
self.database.initialize(self.onInit)
def onInit(self, success):
if success:
self.database.updateChannelAndProgramListCaches(self.onCachesUpdated)
else:
self.database.close()
def onCachesUpdated(self):
if ADDON.getSetting('notifications.enabled') == 'true':
n = notification.Notification(self.database, ADDON.getAddonInfo('path'))
n.scheduleNotifications()
self.database.close(None)
try:
ADDON = xbmcaddon.Addon(id = 'script.renegadestv')
if ADDON.getSetting('cache.data.on.xbmc.startup') == 'true':
Service()
except source.SourceNotConfiguredException:
pass # ignore
except Exception, ex:
xbmc.log('[script.renegadestv] Uncaugt exception in service.py: %s' % str(ex) , xbmc.LOGDEBUG)