Basic structute built

This commit is contained in:
Maximilian Wagner
2023-07-29 18:10:49 +02:00
parent df98376456
commit 93dac70c86
14 changed files with 203 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (yt-dls) (2)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/yt-dls.iml" filepath="$PROJECT_DIR$/.idea/yt-dls.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

21
.idea/yt-dls.iml generated Normal file
View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="Flask">
<option name="enabled" value="true" />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/../yt-dls\templates" />
</list>
</option>
</component>
</module>

16
app.py Normal file
View File

@@ -0,0 +1,16 @@
from flask import Flask
from flask_bootstrap import Bootstrap
from frontend import frontend
from nav import nav
def create_app():
app = Flask(__name__)
Bootstrap(app)
app.config['BOOTSTRAP_SERVE_LOCAL'] = True
app.register_blueprint(frontend)
nav.init_app(app)
return app

36
frontend.py Normal file
View File

@@ -0,0 +1,36 @@
from flask import Blueprint, render_template, flash, redirect, url_for
from flask_bootstrap import __version__ as BOOTSTRAP_VERSION
from flask_nav3.elements import Navbar, View, Subgroup, Link, Text, Separator
from markupsafe import escape
from nav import nav
frontend = Blueprint('frontend', __name__)
nav.register_element('frontend_top', Navbar(
View('yt-dls', '.index'),
View('downloader', '.downloader'),
View('updater', '.updater'),
View('library', '.library')
)
)
@frontend.route('/')
def index():
return render_template('index.html')
@frontend.route('/downloader')
def downloader():
return render_template('downloader.html')
@frontend.route('/update')
def updater():
return render_template('updater.html')
@frontend.route('/library')
def library():
return render_template('library.html')

3
nav.py Normal file
View File

@@ -0,0 +1,3 @@
from flask_nav3 import Nav
nav = Nav()

23
templates/base.html Normal file
View File

@@ -0,0 +1,23 @@
{%- extends "bootstrap/base.html" %}
{% import "bootstrap/fixes.html" as fixes %}
{% block title %}
yt-dls
{% endblock %}
{% block head %}
{{ super() }}
{{ fixes.ie8() }}
{% endblock %}
{% block styles %}
{{ super() }}
{# Commented out cause don't exist
<link rel="stylesheet" type="text/css"
href="{{url_for('static', filename='example.css')}}">
#}
{% endblock %}
{% block navbar %}
{{ nav.frontend_top.render() }}
{% endblock %}

17
templates/downloader.html Normal file
View File

@@ -0,0 +1,17 @@
{%- extends "base.html" %}
{% import "bootstrap/utils.html" as utils %}
{% block content %}
<div class="container">
{%- with messages = get_flashed_messages(with_categories=True) %}
{%- if messages %}
<div class="row">
<div class="col-md-12">
{{utils.flashed_messages(messages)}}
</div>
</div>
{%- endif %}
{%- endwith %}
</div>
{%- endblock %}

21
templates/index.html Normal file
View File

@@ -0,0 +1,21 @@
{%- extends "base.html" %}
{% import "bootstrap/utils.html" as utils %}
{% block content %}
<div class="container">
{%- with messages = get_flashed_messages(with_categories=True) %}
{%- if messages %}
<div class="row">
<div class="col-md-12">
{{utils.flashed_messages(messages)}}
</div>
</div>
{%- endif %}
{%- endwith %}
<a href="http://pythonhosted.org/Flask-Bootstrap">Documentation</a>. </p>
</div>
{%- endblock %}

17
templates/library.html Normal file
View File

@@ -0,0 +1,17 @@
{%- extends "base.html" %}
{% import "bootstrap/utils.html" as utils %}
{% block content %}
<div class="container">
{%- with messages = get_flashed_messages(with_categories=True) %}
{%- if messages %}
<div class="row">
<div class="col-md-12">
{{utils.flashed_messages(messages)}}
</div>
</div>
{%- endif %}
{%- endwith %}
</div>
{%- endblock %}

17
templates/updater.html Normal file
View File

@@ -0,0 +1,17 @@
{%- extends "base.html" %}
{% import "bootstrap/utils.html" as utils %}
{% block content %}
<div class="container">
{%- with messages = get_flashed_messages(with_categories=True) %}
{%- if messages %}
<div class="row">
<div class="col-md-12">
{{utils.flashed_messages(messages)}}
</div>
</div>
{%- endif %}
{%- endwith %}
</div>
{%- endblock %}