-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor frontend structure, needs blueprint paths fixes for routes
Signed-off-by: miigotu <miigotu@gmail.com>
- Loading branch information
Showing
31 changed files
with
223 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
""" | ||
This module implements the web interface for the sickchill configurationt | ||
""" | ||
|
||
from frontend.utils import build_blueprint | ||
|
||
config_blueprint = build_blueprint(__file__, __name__) |
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from flask import render_template | ||
|
||
from sickchill import logger, settings | ||
|
||
from .. import config_blueprint | ||
|
||
|
||
@config_blueprint.route("/") | ||
def config(): | ||
logger.info("Loading config page") | ||
return render_template("/config.html") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
""" | ||
This module implements the web interface for the sickchill movies media type | ||
""" | ||
|
||
from frontend.utils import build_blueprint | ||
|
||
movies_blueprint = build_blueprint(__file__, __name__) |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from flask import render_template | ||
|
||
from sickchill import logger, settings | ||
|
||
# from sickchill.movies import movie | ||
|
||
from .. import movies_blueprint | ||
|
||
|
||
@movies_blueprint.route("/") | ||
def movies(): | ||
logger.info("Loading movies page") | ||
movies_blueprint.logger.info("Loaded movies page") | ||
|
||
logger.debug(f"movies: {settings.showList}") | ||
movies_blueprint.logger.debug(f"movies: {settings.movie_list}") | ||
|
||
return render_template("movies.html", movies=settings.movie_list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
""" | ||
This module implements the web interface for the sickchill shows media type | ||
""" | ||
|
||
from frontend.utils import build_blueprint | ||
|
||
shows_blueprint = build_blueprint(__file__, __name__) |
Empty file.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
from flask import Blueprint, render_template | ||
from flask import render_template | ||
|
||
from sickchill import logger, settings | ||
|
||
# from sickchill.tv import TVEpisode, TVShow | ||
|
||
shows_blueprint = Blueprint("shows", __name__) | ||
from .. import shows_blueprint | ||
|
||
|
||
@shows_blueprint.route("/") | ||
@shows_blueprint.route("/shows") | ||
def index(): | ||
def shows(): | ||
logger.info("Loading shows page") | ||
logger.debug(f"Shows: {settings.showList}") | ||
return render_template("shows.html", shows=settings.showList) | ||
|
||
|
||
@shows_blueprint.route("/show/") | ||
def show(): | ||
logger.info("Loading show details page") | ||
logger.debug(f"Shows: {settings.showList}") | ||
return render_template("show.html", show=None) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from pathlib import Path | ||
from flask import Blueprint | ||
import logging | ||
|
||
logging.basicConfig(format="{asctime} {levelname} :: {threadName} :: {message}", style="{") | ||
logger = logging.getLogger(__package__) | ||
logger.setLevel(logging.DEBUG) | ||
|
||
|
||
def build_blueprint(module_location: Path, module_import: str) -> Blueprint: | ||
"""Generate a blueprint for a frontend module""" | ||
|
||
module_name = Path(module_location).parent.name | ||
module_path = Path(module_location).parent.resolve() | ||
frontend_path = module_path.parent.resolve() | ||
|
||
templates_path = module_path.joinpath("templates") | ||
static_path = frontend_path.joinpath("static").joinpath(module_name) | ||
|
||
blueprint = Blueprint(module_name, module_import, static_folder=static_path, template_folder=templates_path) | ||
logger.debug( | ||
f"Paths for {blueprint.name}\n\ttemplates: {blueprint.template_folder}\n\tstatic: {blueprint.static_folder}\n\turl_prefix: {blueprint.url_prefix}" | ||
) | ||
return blueprint |
Oops, something went wrong.