Exemple #1
0
 def __init__(self):
     self.database = src.Database()
     self.command = sys.argv[1]
     deb('ClearDB onInitialized param %s' % self.command)
     if self.command == 'deleteDbFile':
         self.database.deleteDbFile()
         self.database.close()
         xbmcgui.Dialog().ok(strings(DB_DELETED), strings(30969))
     else:
         self.database.initialize(self.onInitialized)
    def __init__(self):
        self.database = src.Database()
        self.command = sys.argv[1]
        deb('ClearDB onInitialized param {}'.format(self.command))
        if self.command == 'deleteDbFile' or self.command == 'deleteAll' or self.command == 'deleteDb59908':
            self.database.deleteDbFile()
            self.database.close()
            #Delete skinsFix check
            if sys.version_info[0] > 2:
                try:
                    self.profilePath = xbmcvfs.translatePath(
                        ADDON.getAddonInfo('profile'))
                except:
                    self.profilePath = xbmcvfs.translatePath(
                        ADDON.getAddonInfo('profile')).decode('utf-8')
            else:
                try:
                    self.profilePath = xbmc.translatePath(
                        ADDON.getAddonInfo('profile'))
                except:
                    self.profilePath = xbmc.translatePath(
                        ADDON.getAddonInfo('profile')).decode('utf-8')

            if xbmcvfs.exists(os.path.join(self.profilePath,
                                           'skin_fonts.ini')) == True:
                os.remove(os.path.join(self.profilePath, 'skin_fonts.ini'))
                with open(os.path.join(self.profilePath, 'skin_fonts.ini'),
                          'w+') as fp:
                    fp.write('')
                    fp.close()
            if self.command == 'deleteAll' or self.command == 'deleteDb59908':
                settingsFile = os.path.join(self.profilePath, 'settings.xml')
                os.remove(settingsFile)
                try:
                    shutil.rmtree(self.profilePath)
                except:
                    pass
            xbmcgui.Dialog().ok(strings(DB_DELETED), strings(30969))
        else:
            self.database.initialize(self.onInitialized)
Exemple #3
0
 def __init__(self):
     self.database = source.Database(True)
     self.database.initialize(self.onInit)
Exemple #4
0
                            (name.encode('utf-8', 'replace'), programTitle.encode('utf-8', 'replace'), description.encode('utf-8', 'replace'), self.icon, timeToNotification))

    def _unscheduleNotification(self, programTitle, startTime):
        name = self.createAlarmClockName(programTitle, startTime)
        xbmc.executebuiltin('CancelAlarm(%s-5mins,True)' % name.encode('utf-8', 'replace'))
        xbmc.executebuiltin('CancelAlarm(%s-now,True)' % name.encode('utf-8', 'replace'))

    def addNotification(self, program):
        self.database.addNotification(program)
        self._scheduleNotification(program.channel.title, program.title, program.startDate)

    def removeNotification(self, program):
        self.database.removeNotification(program)
        self._unscheduleNotification(program.title, program.startDate)


if __name__ == '__main__':
    database = src.Database()

    def onNotificationsCleared():
        xbmcgui.Dialog().ok(strings(CLEAR_NOTIFICATIONS), strings(DONE))

    def onInitialized(success):
        if success:
            database.clearAllNotifications()
            database.close(onNotificationsCleared)
        else:
            database.close()

    database.initialize(onInitialized)
Exemple #5
0
def clearCustomStreamUrls(success):
    if success:
        database.clearCustomStreamUrls()
        xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), 'Cleared channel mappings')
    else:
        database.close()

def clearAltCustomStreamUrls(success):
    if success:
        database.clearAltCustomStreamUrls()
        xbmcgui.Dialog().notification(ADDON.getAddonInfo('name'), 'Cleared alternative channel mappings')
    else:
        database.close()

if __name__ == '__main__':
    database = source.Database()
    if len(sys.argv) > 1:
        mode = int(sys.argv[1])
        if mode in [1]:
            database.initialize(getCustomStreamUrls)
        elif mode in [2]:
            database.initialize(setCustomStreamUrls)
        elif mode in [3]:
            database.initialize(getAltCustomStreamUrls)
        elif mode in [4]:
            database.initialize(setAltCustomStreamUrls)
        elif mode in [5]:
            database.initialize(clearCustomStreamUrls)
        elif mode in [6]:
            database.initialize(clearAltCustomStreamUrls)
 def __init__(self):
     self.database = source.Database(False)
     self.database.initialize(self.onInit)
     self.pluginData = xbmc.translatePath(os.path.join('special://profile', 'addon_data', ADDON.getAddonInfo('id')))
Exemple #7
0
 def __init__(self):
     self.database = source.Database(self)
     self.database.initializeS(self.onInitS)
Exemple #8
0
 def __init__(self):
     self.database = source.Database()
     self.database.initialize(self.onInit)
     self.source = source.XMLTVPushSource(self.database)