init with copied files from markdown-tagebuch
This commit is contained in:
parent
f13e1c88ed
commit
22013a7b3e
137
.idea/.gitignore
generated
vendored
Normal file
137
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
|
||||
.idea
|
||||
mdtagebuchenv
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
24
.idea/runConfigurations/rest_server.xml
generated
Normal file
24
.idea/runConfigurations/rest_server.xml
generated
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="rest_server" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||
<module name="yt2podcast" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
<env name="ENV" value="TEST" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/rest_server.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
11
README.md
11
README.md
@ -1,2 +1,13 @@
|
||||
# yt2podcast
|
||||
|
||||
## Automation
|
||||
- paste URL into web UI
|
||||
- trigger download via youtube dl Material API
|
||||
- upload downloaded file via PodcastGenerator
|
||||
- https://podcasts.swaghausen.de/admin/episodes_upload.php
|
||||
- PHP SessId
|
||||
- OR script to Edit Feed.xml and create xml assoicated with mp3
|
||||
|
||||
admin
|
||||
test123
|
||||
|
||||
|
4
config.yml
Normal file
4
config.yml
Normal file
@ -0,0 +1,4 @@
|
||||
auth:
|
||||
username: admin
|
||||
hashedPassword: pbkdf2:sha256:260000$2xn3u8v9EFHM7oj1$65a9126ae01129a8adc5ca74ec6c006388f3d7f0176d015dccf8e0bf1f5e2523
|
||||
prod: False
|
20
config_parser.py
Normal file
20
config_parser.py
Normal file
@ -0,0 +1,20 @@
|
||||
import yaml
|
||||
import os
|
||||
|
||||
DEFAULT_CONFIG_FILE_NAME = "config.yml"
|
||||
|
||||
if os.environ['ENV'] == 'prod':
|
||||
config_file_to_load = "config_prod.yml"
|
||||
else:
|
||||
config_file_to_load = DEFAULT_CONFIG_FILE_NAME
|
||||
|
||||
# BASE_FODLER = "/code/markdowntagebuch"
|
||||
BASE_FODLER = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
path_to_config = os.path.join(BASE_FODLER, config_file_to_load)
|
||||
print("opening config file " + path_to_config)
|
||||
with open(path_to_config, "r") as ymlfile:
|
||||
cfg = yaml.load(ymlfile, Loader=yaml.FullLoader)
|
||||
|
||||
credentials = cfg["auth"]
|
||||
prod_mode = cfg["prod"]
|
5
config_prod.yml
Normal file
5
config_prod.yml
Normal file
@ -0,0 +1,5 @@
|
||||
auth:
|
||||
username: admin
|
||||
# hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
|
||||
hashedPassword: pbkdf2:sha256:260000$2xn3u8v9EFHM7oj1$65a9126ae01129a8adc5ca74ec6c006388f3d7f0176d015dccf8e0bf1f5e2523
|
||||
prod: True
|
12
requirements.txt
Normal file
12
requirements.txt
Normal file
@ -0,0 +1,12 @@
|
||||
click==8.1.2
|
||||
colorama==0.4.4
|
||||
Flask==2.1.1
|
||||
importlib-metadata==4.11.3
|
||||
itsdangerous==2.1.2
|
||||
MarkupSafe==2.1.1
|
||||
zipp==3.8.0
|
||||
Flask-Cors==3.0.10
|
||||
Flask-HTTPAuth==4.3.0
|
||||
# pin dependency to have werkzeug.security.safe_str_cmp
|
||||
Werkzeug==2.0.0
|
||||
jinja2==3.0.3
|
56
rest_server.py
Normal file
56
rest_server.py
Normal file
@ -0,0 +1,56 @@
|
||||
import os
|
||||
|
||||
import flask
|
||||
from flask import render_template
|
||||
from flask import request
|
||||
from flask import url_for
|
||||
from flask_cors import CORS
|
||||
from flask_httpauth import HTTPBasicAuth
|
||||
from werkzeug.security import check_password_hash
|
||||
# import main
|
||||
# from werkzeug.utils import redirect
|
||||
|
||||
import config_parser
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
auth = HTTPBasicAuth()
|
||||
app.config["DEBUG"] = True
|
||||
CORS(app)
|
||||
|
||||
URL_BASE_PATH = "/"
|
||||
# URL_BASE_PATH = "/tagebuch"
|
||||
|
||||
|
||||
@auth.verify_password
|
||||
def verify_password(username, password):
|
||||
if username == config_parser.credentials['username'] and \
|
||||
check_password_hash(config_parser.credentials['hashedPassword'], password):
|
||||
return username
|
||||
|
||||
|
||||
@app.route(URL_BASE_PATH + 'home', methods=['GET'])
|
||||
# @auth.login_required
|
||||
def api_show_form():
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
@app.route(URL_BASE_PATH, methods=['POST', 'GET'])
|
||||
@auth.login_required
|
||||
def handle_yt_url():
|
||||
if request.method == "POST":
|
||||
user_input = request.form['ytlink']
|
||||
# return redirect(url_for("return_result", ytlink=user_input))
|
||||
print(user_input)
|
||||
return render_template("yt.html")
|
||||
else:
|
||||
return render_template("yt.html")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
flask_options = dict(
|
||||
host='0.0.0.0',
|
||||
debug=True,
|
||||
port=4001,
|
||||
threaded=True,
|
||||
)
|
||||
app.run(**flask_options)
|
35
templates/base.html
Normal file
35
templates/base.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
|
||||
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>{% block title %} {% endblock %}</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 style="color: blue">{% block pageHeader %} {% endblock %}</h1>
|
||||
<hr>
|
||||
|
||||
<!-- <p>This is an HTML file served up by Flask</p>-->
|
||||
<p>{% block content %} {% endblock %}</p>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
|
||||
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
|
||||
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
|
||||
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
8
templates/index.html
Normal file
8
templates/index.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %} Home Page {% endblock %}
|
||||
|
||||
|
||||
|
||||
<!--{%for _ in range(10) %}-->
|
||||
<!-- <p>x</p>-->
|
||||
<!--{% endfor %}-->
|
16
templates/yt.html
Normal file
16
templates/yt.html
Normal file
@ -0,0 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %} Youtube 2 Podcast RSS {% endblock %}
|
||||
{% block pageHeader %} Youtube 2 Podcast RSS {% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<p>Input youtube URL</p>
|
||||
<form action="#" method="post">
|
||||
<p><input type="text" name="ytlink" placeholder="https://www.youtube.com/watch?v=abc" /> </p>
|
||||
<p><input class="btn btn-primary" type="submit" value="submit" /> </p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
<!--{%for _ in range(10) %}-->
|
||||
<!-- <p>x</p>-->
|
||||
<!--{% endfor %}-->
|
Loading…
x
Reference in New Issue
Block a user