def __init__(self, name, dbdef): assert name and dbdef self.name = name self.desc = dbdef self.db = BoundConnector(self.name) with self: self._init_meta()
def __init__(self, connector=None): """user configuration: hidden values can not be set by the user in the options, but might be subject of being set automatically, e.g. the heartbeat. """ db.require(DBNAME, '0') c = cfg.ConfigBuilder() with c['keyboard_shortcuts'] as kbs: kbs.valid = '\d\d?\d?' kbs['prev'].value = 89 kbs['play'].value = 88 kbs['pause'].value = 67 kbs['stop'].value = 86 kbs['next'].value = 66 kbs['search'].value = 83 with c['misc.show_playlist_download_buttons'] as pl_download_buttons: pl_download_buttons.value = False with c['misc.autoplay_on_add'] as autoplay_on_add: autoplay_on_add.value = False with c['custom_theme.primary_color'] as primary_color: primary_color.value = '#F02E75' primary_color.valid = '#[0-9a-fA-F]{6}' with c['custom_theme.white_on_black'] as white_on_black: white_on_black.value = False with c['last_time_online'] as last_time_online: last_time_online.value = 0 last_time_online.valid = '\\d+' last_time_online.hidden = True last_time_online.doc = "UNIX TIME (1.1.1970 = never)" self.DEFAULTS = c.to_configuration() self.conn = BoundConnector(DBNAME, connector).connection()
def __init__(self, connector=None): database.require(DBNAME, version='1') self.normalize_basedir() connector = BoundConnector(DBNAME, connector) self.DBFILENAME = connector.dblocation self.conn = connector.connection() self.db = self.conn.cursor() #I don't care about journaling! self.conn.execute('PRAGMA synchronous = OFF') self.conn.execute('PRAGMA journal_mode = MEMORY') self.load_db_to_memory()
def __init__(self, connector=None): database.require(DBNAME, version='1') self.conn = BoundConnector(DBNAME, connector).connection()