Beispiel #1
0
 def last_active(self):
     if self._last_active is None:
         return None
     return TimeManager.localize(self._last_active)
Beispiel #2
0
def time_localize(value):
    return TimeManager.localize(value)
Beispiel #3
0
 def last_seen(self):
     return TimeManager.localize(self._last_seen)
Beispiel #4
0
config = load_config(args.config)

if 'web' not in config:
    log.error('Missing [web] section in config.ini')
    sys.exit(1)

if 'pleblist_password_salt' not in config['web']:
    salt = generate_random_salt()
    config.set('web', 'pleblist_password_salt', salt.decode('utf-8'))

with open(args.config, 'w') as configfile:
    config.write(configfile)

DBManager.init(config['main']['db'])
TimeManager.init_timezone(config['main'].get('timezone', 'UTC'))

session = DBManager.create_session()
num_decks = session.query(func.count(Deck.id)).scalar()
custom_web_content = {}
for web_content in session.query(WebContent).filter(WebContent.content is not None):
    custom_web_content[web_content.page] = web_content.content
session.close()

has_decks = num_decks > 0

errors.init(app)
api.config = config

modules = config['web'].get('modules', '').split()
Beispiel #5
0
def time_localize(value):
    return TimeManager.localize(value)
Beispiel #6
0
    SocketClientManager.init(config['sock']['sock_file'])

twitch = oauth.remote_app(
    'twitch',
    consumer_key=config['webtwitchapi']['client_id'],
    consumer_secret=config['webtwitchapi']['client_secret'],
    request_token_params={'scope': 'user_read'},
    base_url='https://api.twitch.tv/kraken/',
    request_token_url=None,
    access_token_method='POST',
    access_token_url='https://api.twitch.tv/kraken/oauth2/token',
    authorize_url='https://api.twitch.tv/kraken/oauth2/authorize',
)

DBManager.init(config['main']['db'])
TimeManager.init_timezone(config['main'].get('timezone', 'UTC'))

with DBManager.create_session_scope() as db_session:
    num_decks = db_session.query(func.count(Deck.id)).scalar()
    custom_web_content = {}
    for web_content in db_session.query(WebContent).filter(
            WebContent.content is not None):
        custom_web_content[web_content.page] = web_content.content

has_decks = num_decks > 0

errors.init(app)
api.config = config

modules = config['web'].get('modules', '').split()
Beispiel #7
0
 def last_active(self):
     if self._last_active is None:
         return None
     return TimeManager.localize(self._last_active)
Beispiel #8
0
 def last_seen(self):
     return TimeManager.localize(self._last_seen)