def __init__(self): """Table for one application in the applications module""" self.apps = serverTools.getPrefsDb() self.apps.beginTransaction() self.apps.checkTable("applications", [{ "name": "id", "type": "integer primary key autoincrement" }, { "name": "name", "type": "text" }, { "name": "url", "type": "text" }, { "name": "description", "type": "text" }, { "name": "image", "type": "text" }, { "name": "position", "type": "integer" }]) self.apps.commitTransaction() """if position is None:
def __init__(self): """Table for the XBMC server config""" self.configDb = serverTools.getPrefsDb() self.configDb.beginTransaction() self.configDb.checkTable("xbmc_servers", [ {"name": "id", "type": "integer primary key autoincrement"}, {"name": "label", "type": "text"}, {"name": "position", "type": "integer"}, {"name": "hostname", "type": "text"}, {"name": "port", "type": "text"}, {"name": "username", "type": "text"}, {"name": "password", "type": "text"}, {"name": "mac_address", "type": "text"}]) self.configDb.commitTransaction() self.label = None self.position = None self.hostname = None self.port = None self.username = None self.password = None self.mac_address = None
def __init__(self): """Table for one setting value""" self.configDb = serverTools.getPrefsDb() self.configDb.beginTransaction() self.configDb.checkTable("settings", [ {"name": "id", "type": "integer primary key autoincrement"}, {"name": "key", "type": "text"}, {"name": "value", "type": "text"}]) self.configDb.commitTransaction()
def __init__(self, customDb=False): if customDb: self.db = customDb self.db.checkTable("prefs", [ {"name": "name", "type": "text"}, {"name": "value", "type": "text"}]) else: self.db = serverTools.getPrefsDb() self.db.beginTransaction() self.db.checkTable("pyemoncms", [ {"name": "name", "type": "text"}, {"name": "value", "type": "text"}]) self.checkDefaults("version", "8.3.6") self.checkDefaults("username", "ironworks_admin") self.checkDefaults("password", "") self.checkDefaults("server", "localhost") self.checkDefaults("database", "pyemoncms") self.checkDefaults("redis_enabled", "True") # Enable this to try out the experimental MQTT Features: # - updated to feeds are published to topic: emoncms/feed/feedid self.checkDefaults("mqtt_enabled", "False") self.checkDefaults("timestore", "{'adminkey': '_TS_ADMINKEY_'}") self.checkDefaults("graphite", "{'port': 0, 'host':0}") self.checkDefaults("smtp_email_settings", "{'host': '_SMTP_HOST_', 'username': '******', 'password': '******', 'from': {'_SMTP_EMAIL_ADDR_': '_SMTP_EMAIL_NAME_'}") self.checkDefaults("enalbe_password_reset", "False") # Checks for limiting garbage data? self.checkDefaults("max_node_id_limit", "32") # Default controller and action if none are specified and user is anonymous self.checkDefaults("default_controller", "user") self.checkDefaults("default_action", "login") # Default controller and action if none are specified and user is logged in self.checkDefaults("default_controller_auth", "user") self.checkDefaults("default_action_auth", "view") # Public profile functionality self.checkDefaults("public_profile_enabled", "True") self.checkDefaults("public_profile_controller", "dashboard") self.checkDefaults("public_profile_action", "view") # Misc self.checkDefaults("theme", "basic") self.checkDefaults("display_errors", "True") self.checkDefaults("allowusersregister", "True") self.checkDefaults("enable_rememberme", "True")
def __init__(self, name, data=[]): # Check for ~/.ironworks configDb = serverTools.getPrefsDb() configDb.beginTransaction() configDb.checkTable("recently_added", [ {"name": "id", "type": "integer primary key autoincrement"}, {"name": "name", "type": "text"}, {"name": "data", "type": "text"}]) configDb.commitTransaction() self.name = name self.data = data
def __init__(self, name, url, apikey): configDb = serverTools.getPrefsDb() configDb.beginTransaction() configDb.checkTable("newznab", [ {"name": "id", "type": "integer primary key autoincrement"}, {"name": "name", "type": "text"}, {"name": "url", "type": "text"}, {"name": "apikey", "type": "string"}]) configDb.commitTransaction() self.name = name self.url = url self.apikey = apikey
def __init__(self): """Table for one application in the applications module""" self.apps = serverTools.getPrefsDb() self.apps.beginTransaction() self.apps.checkTable("applications", [ {"name": "id", "type": "integer primary key autoincrement"}, {"name": "name", "type": "text"}, {"name": "url", "type": "text"}, {"name": "description", "type": "text"}, {"name": "image", "type": "text"}, {"name": "position", "type": "integer"}]) self.apps.commitTransaction() """if position is None:
def __init__(self): """Table for the XBMC server config""" self.configDb = serverTools.getPrefsDb() self.configDb.beginTransaction() self.configDb.checkTable( "xbmc_servers", [{ "name": "id", "type": "integer primary key autoincrement" }, { "name": "label", "type": "text" }, { "name": "position", "type": "integer" }, { "name": "hostname", "type": "text" }, { "name": "port", "type": "text" }, { "name": "username", "type": "text" }, { "name": "password", "type": "text" }, { "name": "mac_address", "type": "text" }]) self.configDb.commitTransaction() self.label = None self.position = None self.hostname = None self.port = None self.username = None self.password = None self.mac_address = None
def __init__(self): """Table for one setting value""" self.configDb = serverTools.getPrefsDb() self.configDb.beginTransaction() self.configDb.checkTable( "settings", [{ "name": "id", "type": "integer primary key autoincrement" }, { "name": "key", "type": "text" }, { "name": "value", "type": "text" }]) self.configDb.commitTransaction()
def __init__(self, name, column, position=None, poll=None, delay=None): """Table for one Ironworks module""" configDb = serverTools.getPrefsDb() configDb.beginTransaction() configDb.checkTable("modules", [ {"name": "id", "type": "integer primary key autoincrement"}, {"name": "name", "type": "text"}, {"name": "column", "type": "integer"}, {"name": "position", "type": "integer"}, {"name": "poll", "type": "integer"}, {"name": "delay", "type": "integer"}]) configDb.commitTransaction() self.name = name self.column = column self.position = position self.poll = poll self.delay = delay
from flask import jsonify, render_template, session from ironworks import serverTools, feedparser from ironworks.tools import * from modules_lib.plugin_models import application app = serverTools.getApp() RUNDIR = serverTools.getRunDir() appModel = application.Application() db = serverTools.getPrefsDb() def parseFeeds(): # Feeds google_url = 'https://news.google.com/news?pz=1&cf=all&ned=us&siidp=a3761a02c7bb42a6b2f9e47806ce78c4bb0d&ict=ln&output=rss' wallStreet_url = 'http://online.wsj.com/xml/rss/3_7014.xml' techNews_url = "http://www.technewsworld.com/perl/syndication/rssfull.pl" linuxNews_url = "http://www.linuxinsider.com/perl/syndication/rssfull.pl" google_feeds = feedparser.parse(google_url) wallStreet_feeds = feedparser.parse(wallStreet_url) techNews_feeds = feedparser.parse(techNews_url) linuxNews_feeds = feedparser.parse(linuxNews_url) return google_feeds, wallStreet_feeds, techNews_feeds, linuxNews_feeds @app.route('/applications') def applications(): if 'username' in session: global appModel
def __init__(self, customDb=False): if customDb: self.db = customDb self.db.checkTable("prefs", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) else: # Check for ~/.ironworks if not os.path.isdir(self.prefsRootPath()): os.mkdir(self.prefsRootPath()) if serverTools.getPrefsDb() is not None: self.db = serverTools.getPrefsDb() else: self.db = db.Db( os.path.join(self.prefsRootPath(), 'ironworks.db')) self.db.beginTransaction() self.db.checkTable("prefs", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) # Check basic defaults self.checkDefaults("timesRun", "0") self.checkDefaults("daemon", "False") self.checkDefaults("pidfile", "False") self.checkDefaults("pidFileName", "") self.checkDefaults("port", 7000) self.checkDefaults("verbose", "True") self.checkDefaults("development", "True") self.checkDefaults("kiosk", "False") self.checkDefaults("noupdate", "True") self.db.commitTransaction() self.db.checkTable("rss", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) self.db.checkTable("news", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) self.db.checkTable("xbmc_server", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) self.db.checkTable("login", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) self.db.checkTable("desktop", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) self.db.checkTable("pyemoncms", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) self.db.checkTable("freePBX", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) self.checkLoginDefaults("dbName", "ironworks_login") self.checkLoginDefaults("host", "localhost") self.checkLoginDefaults("user", "'db username'") self.checkLoginDefaults("password", "") self.checkDesktopDefaults("dbName", "desktop") self.checkDesktopDefaults("host", "localhost") self.checkDesktopDefaults("user", "db username") self.checkDesktopDefaults("password", "") self.checkPyEMONCMSDefaults("dbName", "pyemoncms") self.checkPyEMONCMSDefaults("host", "localhost") self.checkPyEMONCMSDefaults("user", "db username") self.checkPyEMONCMSDefaults("password", "") self.checkFreePBXDefaults("AMPDBNAME", "asterisk") self.checkFreePBXDefaults("AMPDBHOST", "localhost") self.checkFreePBXDefaults("AMPDBUSER", "asterisk username") self.checkFreePBXDefaults("AMPDBPASS", "asterisk db password") self.checkFreePBXDefaults("AMPDBENGINE", "mysql") self.checkFreePBXDefaults("datasource", "") # for sqlite3 self.checkFreePBXDefaults("action", "null") self.checkFreePBXDefaults("confirm_email", "") self.checkFreePBXDefaults("confirm_password", "") self.checkFreePBXDefaults("display", "") self.checkFreePBXDefaults("extdisplay", "False") self.checkFreePBXDefaults("email_address", "") self.checkFreePBXDefaults("fw_popover", "") self.checkFreePBXDefaults("fw_popover_process", "") self.checkFreePBXDefaults("logout", "False") self.checkFreePBXDefaults("password", "") self.checkFreePBXDefaults("quitemode", "") self.checkFreePBXDefaults("restrictmods", "False") self.checkFreePBXDefaults("skip", "0") self.checkFreePBXDefaults("skip_astman", "False") self.checkFreePBXDefaults("type", "") self.checkFreePBXDefaults("username", "")
def __init__(self, extdisplay=None, restrictmods=None, skip_astman=None, handler=None): self.db = serverTools.getPrefsDb() self.ampDB = serverTools.getAmpDb() self.logger = serverTools.getLogger() self.bootstrap_settings = {} self.action = self.db.getPBXAction() self.confirm_email = self.db.getPBXConfirmEmail() self.confirm_password = self.db.getPBXConfirmPassword() self.display = self.db.getPBXDisplay() if self.db.getPBXExtdisplay() == "False": self.extdisplay = False else: self.extdisplay = self.db.getPBXExtdisplay() self.email_address = self.db.getPBXEmailAddress() self.fw_popover = self.db.getPBXFwPopover() self.fw_popover_process = self.db.getPBXFwPopoverProcess() self.logout = self.db.getPBXLogout() self.password = self.db.getPBXPassword() self.quietmode = self.db.getPBXQuietMode() if self.db.getPBXRestrcitmods() == "False": self.restrictmods = False else: self.restricmods = self.db.getPBXRestrcitmods() self.skip = self.db.getPBXSkip() if self.db.getPBXSkipAstman() == "False": self.skip_astman = False else: self.skip_astman = self.db.getPBXSkipAstman() self.type = self.db.getPBXType() self.username = self.db.getPBXUsername() if extdisplay != None and extdisplay != False: # htmlspecialchars($extdisplay, ENT_QUOTES) : false; self.extdisplay = extdisplay if restrictmods != None: self.restrictmods = restrictmods if skip_astman != None: self.skip_astman = skip_astman self.bootstrap_settings['skip_astman'] = skip_astman self.ampUser = ampuser.class.Ampuser_Class() if handler != None: if self.restrictmods == 'False': self.restrictmods = 'True' if 'api' in handler: pass if 'reload' in handler: pass # If we didn't provide skip_astman in the $_REQUEST[] array # it will be boolean false and for handlers, this should default # to true, if we did provide it, it will NOT be a boolean # (it could be 0) so we will honor the setting if self.bootstrap_settings['skip_astman'] == 'False': self.bootstrap_settings['skip_astman'] = 'True' self.bootstrap = bootstrap.Bootstrap(self.bootstrap_settings, self.restricmods)
def __init__(self, customDb=False): if customDb: self.db = customDb self.db.checkTable("prefs", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) else: self.db = serverTools.getPrefsDb() self.db.beginTransaction() self.db.checkTable("pyemoncms", [{ "name": "name", "type": "text" }, { "name": "value", "type": "text" }]) self.checkDefaults("version", "8.3.6") self.checkDefaults("username", "ironworks_admin") self.checkDefaults("password", "") self.checkDefaults("server", "localhost") self.checkDefaults("database", "pyemoncms") self.checkDefaults("redis_enabled", "True") # Enable this to try out the experimental MQTT Features: # - updated to feeds are published to topic: emoncms/feed/feedid self.checkDefaults("mqtt_enabled", "False") self.checkDefaults("timestore", "{'adminkey': '_TS_ADMINKEY_'}") self.checkDefaults("graphite", "{'port': 0, 'host':0}") self.checkDefaults( "smtp_email_settings", "{'host': '_SMTP_HOST_', 'username': '******', 'password': '******', 'from': {'_SMTP_EMAIL_ADDR_': '_SMTP_EMAIL_NAME_'}" ) self.checkDefaults("enalbe_password_reset", "False") # Checks for limiting garbage data? self.checkDefaults("max_node_id_limit", "32") # Default controller and action if none are specified and user is anonymous self.checkDefaults("default_controller", "user") self.checkDefaults("default_action", "login") # Default controller and action if none are specified and user is logged in self.checkDefaults("default_controller_auth", "user") self.checkDefaults("default_action_auth", "view") # Public profile functionality self.checkDefaults("public_profile_enabled", "True") self.checkDefaults("public_profile_controller", "dashboard") self.checkDefaults("public_profile_action", "view") # Misc self.checkDefaults("theme", "basic") self.checkDefaults("display_errors", "True") self.checkDefaults("allowusersregister", "True") self.checkDefaults("enable_rememberme", "True")