def add_schedule(task): schedule = db_session.query(Schedule).filter(Schedule.task == task).first() if not schedule: schedule = Schedule(task, DEFAULT_INTERVAL) db_session.add(schedule) db_session.commit() start_timer(DEFAULT_INTERVAL) return redirect(url_for('.index'))
def add_schedule(feed): schedule = db_session.query(Schedule).filter(Schedule.feed == feed).first() if not schedule: schedule = Schedule(feed, DEFAULT_INTERVAL) db_session.add(schedule) db_session.commit() start_timer(DEFAULT_INTERVAL) return redirect(url_for("index"))
def add_schedule(task): schedule = db_session.query(Schedule).filter(Schedule.task == task).first() if not schedule: schedule = Schedule(task, DEFAULT_INTERVAL) db_session.add(schedule) db_session.commit() start_timer(DEFAULT_INTERVAL) return redirect(url_for('index'))
def set_task_interval(task, interval): task_interval = db_session.query(Schedule).filter(Schedule.task == task).first() if task_interval: log.debug('Updating %s interval' % task) task_interval.interval = interval else: log.debug('Creating new %s interval' % task) db_session.add(Schedule(task, interval)) db_session.commit() stop_empty_timers()
def set_feed_interval(feed, interval): feed_interval = db_session.query(Schedule).filter(Schedule.feed == feed).first() if feed_interval: log.debug("Updating %s interval" % feed) feed_interval.interval = interval else: log.debug("Creating new %s interval" % feed) db_session.add(Schedule(feed, interval)) db_session.commit() stop_empty_timers()
def enable_authentication(): if manager.options.no_auth: return global credentials credentials = db_session.query(AuthCredentials).first() if not credentials: credentials = AuthCredentials('flexget', 'flexget') db_session.add(credentials) if manager.options.username: credentials.username = manager.options.username if manager.options.password: credentials.password = manager.options.password db_session.commit() app.before_request(check_authenticated)
def enable_authentication(): if manager.options.webui.no_auth: return global credentials credentials = db_session.query(AuthCredentials).first() if not credentials: credentials = AuthCredentials('flexget', 'flexget') db_session.add(credentials) if manager.options.webui.username: credentials.username = manager.options.username if manager.options.webui.password: credentials.password = manager.options.webui.password db_session.commit() app.before_request(check_authenticated)