Commit 8a510b89 authored by Hermann Krumrey's avatar Hermann Krumrey

Add simple web server

parent 9b967e10
include version
\ No newline at end of file
include version
graft toktokkie/web/templates
graft toktokkie/web/static
\ No newline at end of file
"""LICENSE
Copyright 2015 Hermann Krumrey <hermann@krumreyh.com>
This file is part of toktokkie.
toktokkie is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
toktokkie is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with toktokkie. If not, see <http://www.gnu.org/licenses/>.
LICENSE"""
import argparse
from toktokkie.web.routes import app
from toktokkie.scripts.Command import Command
class WebStartCommand(Command):
"""
Class that encapsulates behaviour of the web command
"""
@classmethod
def name(cls) -> str:
"""
:return: The command name
"""
return "web"
@classmethod
def prepare_parser(cls, parser: argparse.ArgumentParser):
"""
Prepares an argumentparser for this command
:param parser: The parser to prepare
:return: None
"""
pass
def execute(self):
"""
Executes the commands
:return: None
"""
app.run(port=1234)
......@@ -34,6 +34,7 @@ from toktokkie.scripts.AlbumArtFetchCommand import AlbumArtFetchCommand
from toktokkie.scripts.MusicTagCommand import MusicTagCommand
from toktokkie.scripts.PlaylistCreateCommand import PlaylistCreateCommand
from toktokkie.scripts.MusicMergeCommand import MusicMergeCommand
from toktokkie.scripts.WebStartCommand import WebStartCommand
toktokkie_commands = [
PrintCommand,
......@@ -52,7 +53,8 @@ toktokkie_commands = [
AlbumArtFetchCommand,
MusicTagCommand,
MusicMergeCommand,
PlaylistCreateCommand
PlaylistCreateCommand,
WebStartCommand
]
"""
A list of commands for the toktokkie script
......
"""LICENSE
Copyright 2015 Hermann Krumrey <hermann@krumreyh.com>
This file is part of toktokkie.
toktokkie is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
toktokkie is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with toktokkie. If not, see <http://www.gnu.org/licenses/>.
LICENSE"""
import os
from flask import Flask
root_path = os.path.join(os.path.dirname(os.path.abspath(__file__)))
app = Flask("toktokkie", root_path=root_path)
"""LICENSE
Copyright 2015 Hermann Krumrey <hermann@krumreyh.com>
This file is part of toktokkie.
toktokkie is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
toktokkie is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with toktokkie. If not, see <http://www.gnu.org/licenses/>.
LICENSE"""
from toktokkie.web import app
from flask import render_template
@app.route('/')
def root():
return render_template("index.html")
toktokkie
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment