Ejemplo n.º 1
0
def schedule(period):
    if app.config.get('ANIMETABLE'):
        return flask.redirect('http://animeta.net/table/%s/' % period)

    path = 'data/%s/schedule.yml' % period
    if not os.path.exists(path):
        flask.abort(404)

    if flask.g.account:
        favs = db.get_favorites(flask.g.user_id)
        settings = db.get_settings(flask.g.user_id)
    else:
        favs = []
        settings = {'preferKR': flask.request.args.get('preferKR') == 'true'}
    
    with open(path) as fp:
        data = list(yaml.load_all(fp))
    for item in data:
        process_item(item, period)
    
    if settings.get('preferKR'):
        data.sort(key=lambda item: nullslast(get_schedule_kr(item) or get_schedule(item)))
    else:
        data.sort(key=lambda item: nullslast(get_schedule(item)))

    return flask.render_template('index.html', period=period, data=data, favs=favs, settings=settings)
Ejemplo n.º 2
0
def main():
    db.init()
    while db.get_settings()["mode"] == "init":
        Inithandler()
    if conf.DEBUG: print("Engine setted in running mode!", flush=True)
    init_modules()
    Handler()
    wait_modules()
Ejemplo n.º 3
0
def _finish_login(client_id, client_name, auth, new_user):
	settings = db.get_settings(client_id)
	client = {
		'id': client_id,
		'name': client_name,
		'auth': auth,
		'time_format': settings.time_format,
	}
	if settings.time_zone:
		client['time_zone'] = settings.time_zone
	flask.session['client'] = client
	# Default session lifetime is 31 days.
	flask.session.permanent = True

	# If a new user, redirect to the settings page.
	if new_user:
		return flask.redirect(flask.url_for('get_settings'))

	# Redirect to the URL that the user came from.
	next_url = flask.session.pop('next_url', None)
	if next_url is None:
		next_url = flask.url_for('home')
	return flask.redirect(next_url)
Ejemplo n.º 4
0
 def update(self):
     temp = db.get_settings()[1:]
     self.ui.count_days.setText(str(temp[0]))
     self.ui.caption.setText(temp[1])
     self.ui.time.setText(temp[2])
     self.ui.time_start.setText(str(temp[3]))
Ejemplo n.º 5
0
def update_site_settings(primary, secondary, tertiary, about_us):
    db.update_settings(primary, secondary, tertiary, about_us)
    return jsonify(db.get_settings())
Ejemplo n.º 6
0
def get_site_settings():
    print(db.get_settings())
    return jsonify(db.get_settings())
Ejemplo n.º 7
0
from pyrogram import Client, types
import os
import time
import db

shedule_time = list(map(float, db.get_settings()[3].split()))
chat_id = -1001216485269
GTM = 0


def check(dir_name):
    if not dir_name in os.listdir():
        os.mkdir(dir_name)
        print("Папка " + dir_name + " создана успешно")
    else:
        print("Папка " + dir_name + " уже существует")


check("source")
check("complete")

last = db.get_last_message()[1]

minute = 60
hour = minute * 60
day = hour * 24

t = int(time.time())

next_day = int(t + day - t % day - hour * 3)
time_start = db.get_settings()[4]
Ejemplo n.º 8
0
def get_settings():
	settings = db.get_settings(flask.g.client_id)
	return _render_settings(
			settings.time_format, settings.country, settings.time_zone)