def __init__(self,params): self.params = params database = Database() database.connect() database.checkDBStructure() self.historyDB = WatchHistory(database) self.settings = DBSettings(database)
def __init__(self): utils.log("Starting History Service") self.playerMonitor = HistoryPlayerMonitor(on_play_started = self.playStarted) self.updateMonitor = HistorySettingsMonitor(update_settings = self.onSettingsUpdate) #setup the database connection database = Database() database.connect() database.checkDBStructure() self.historyDB = WatchHistory(database) self.settings = DBSettings(database) if(utils.getSetting('require_pin_on_change') == 'true'): self.require_pin = True #backup the settings file self._settingsBackup()
import xbmcgui import resources.lib.utils as utils from resources.lib.database import Database, DBSettings # create the dialog dialog = xbmcgui.Dialog() database = Database() database.connect() database.checkDBStructure() settings = DBSettings(database) # check if there is a current pin current_pin = settings.getPIN() allow_change = True if current_pin != "0000": allow_change = False # ask user to input current pin user_input = dialog.numeric(0, "Enter Current PIN") if settings.checkPIN(user_input): allow_change = True else: dialog.ok("Error", "Incorrect PIN") # ask the user for a new pin if allow_change: first_try = dialog.numeric(0, "Enter new PIN")