mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
This commit is contained in:
		@@ -1,3 +1,4 @@
 | 
			
		||||
from apscheduler.schedulers.background import BackgroundScheduler
 | 
			
		||||
from config import config
 | 
			
		||||
from flask import Flask
 | 
			
		||||
from flask_login import LoginManager
 | 
			
		||||
@@ -6,11 +7,14 @@ from flask_sqlalchemy import SQLAlchemy
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
db = SQLAlchemy()
 | 
			
		||||
mail = Mail()
 | 
			
		||||
 | 
			
		||||
login_manager = LoginManager()
 | 
			
		||||
login_manager.login_view = 'auth.login'
 | 
			
		||||
 | 
			
		||||
mail = Mail()
 | 
			
		||||
 | 
			
		||||
background_scheduler = BackgroundScheduler()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def create_app(config_name):
 | 
			
		||||
    app = Flask(__name__)
 | 
			
		||||
@@ -27,4 +31,9 @@ def create_app(config_name):
 | 
			
		||||
    from .main import main as main_blueprint
 | 
			
		||||
    app.register_blueprint(main_blueprint)
 | 
			
		||||
 | 
			
		||||
    from .scheduler import scheduler as scheduler_blueprint
 | 
			
		||||
    app.register_blueprint(scheduler_blueprint, url_prefix='/scheduler')
 | 
			
		||||
 | 
			
		||||
    background_scheduler.start()
 | 
			
		||||
 | 
			
		||||
    return app
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								app/scheduler/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/scheduler/__init__.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
from flask import Blueprint
 | 
			
		||||
 | 
			
		||||
scheduler = Blueprint('scheduler', __name__)
 | 
			
		||||
 | 
			
		||||
from . import views
 | 
			
		||||
							
								
								
									
										0
									
								
								app/scheduler/forms.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								app/scheduler/forms.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										21
									
								
								app/scheduler/views.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								app/scheduler/views.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
from flask import render_template
 | 
			
		||||
from . import scheduler
 | 
			
		||||
from flask_login import current_user, login_required
 | 
			
		||||
from .. import background_scheduler
 | 
			
		||||
import json
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@scheduler.route('/')
 | 
			
		||||
@login_required
 | 
			
		||||
def scheduler():
 | 
			
		||||
    job = {
 | 
			
		||||
        'creator': current_user.id,
 | 
			
		||||
        'files': ['file_1', 'file_2', 'file_3'],
 | 
			
		||||
        'service': 'ocr',
 | 
			
		||||
        'args': {
 | 
			
		||||
            'lang': 'deu'
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    job = background_scheduler.add_job(print, trigger='date', args=[job])
 | 
			
		||||
    print(job)
 | 
			
		||||
    return render_template('scheduler/index.html.j2', title='Scheduler')
 | 
			
		||||
@@ -41,25 +41,21 @@
 | 
			
		||||
        <li>
 | 
			
		||||
          <div class="user-view">
 | 
			
		||||
            <div class="background" style="background-color: #ee6e73;"></div>
 | 
			
		||||
            <a href="#user"><img class="circle" src="{{ url_for('static', filename='images/account_circle.png') }}"></a>
 | 
			
		||||
            <a href="#name">
 | 
			
		||||
              <span class="white-text name">
 | 
			
		||||
                {% if current_user.is_authenticated %}
 | 
			
		||||
                {{ current_user.username }}
 | 
			
		||||
                {% else %}
 | 
			
		||||
                Unknown
 | 
			
		||||
                {% endif %}
 | 
			
		||||
              </span>
 | 
			
		||||
            </a>
 | 
			
		||||
            <a href="#email">
 | 
			
		||||
              <span class="white-text email">
 | 
			
		||||
                {% if current_user.is_authenticated %}
 | 
			
		||||
                {{ current_user.email }}
 | 
			
		||||
                {% else %}
 | 
			
		||||
                Unknown
 | 
			
		||||
                {% endif %}
 | 
			
		||||
              </span>
 | 
			
		||||
            </a>
 | 
			
		||||
            <img class="circle" src="{{ url_for('static', filename='images/account_circle.png') }}">
 | 
			
		||||
            <span class="white-text name">
 | 
			
		||||
              {% if current_user.is_authenticated %}
 | 
			
		||||
              {{ current_user.username }}
 | 
			
		||||
              {% else %}
 | 
			
		||||
              Unknown
 | 
			
		||||
              {% endif %}
 | 
			
		||||
            </span>
 | 
			
		||||
            <span class="white-text email">
 | 
			
		||||
              {% if current_user.is_authenticated %}
 | 
			
		||||
              {{ current_user.email }}
 | 
			
		||||
              {% else %}
 | 
			
		||||
              Unknown
 | 
			
		||||
              {% endif %}
 | 
			
		||||
            </span>
 | 
			
		||||
          </div>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li><a href="{{ url_for('main.index') }}"><i class="material-icons">opacity</i>Opaque</a></li>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								app/templates/scheduler/index.html.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								app/templates/scheduler/index.html.j2
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{% extends "base.html.j2" %}
 | 
			
		||||
 | 
			
		||||
{% block page_content %}
 | 
			
		||||
<div class="col s12">
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
		Reference in New Issue
	
	Block a user