~hristoast/mousikofidi

95561a312cc1a94d166c7468fc214e2ece047ad1 — Hristos N. Triantafillou 7 months ago 7854ec9 1.0_beta3
Showing errors in the UI is optional, default: off (#143)
3 files changed, 16 insertions(+), 1 deletions(-)

M mousikofidi/mousikofidi.py
M mousikofidi/templates/playlist.html
M test_mousikofidi.py
M mousikofidi/mousikofidi.py => mousikofidi/mousikofidi.py +10 -0
@@ 96,6 96,9 @@ logo_path = "/fidi.png"
# Should MousikóFídi try and display cover art?
show_cover_art = true

# Show errors e.g. when a playlist has a bad entry in the UI?
show_errors = false

# The name of your MousikóFídi instance; this is what will
# display on the main page of the application.
site_name = "MousikóFídi - Your Music Cloud"


@@ 496,6 499,7 @@ def request_context(config_data: dict) -> dict:
        "playlist_save": config_data["playlists"]["allow_save"],
        "playlists": playlists,
        "secret_key": config_data["other"]["secret_key"],
        "show_errors": config_data["ui"]["show_errors"],
        "site_name": config_data["ui"]["site_name"],
        "queue": queue,
        "theme": theme,


@@ 811,6 815,12 @@ def init(
        )
        c["ui"]["site_name"] = "MousikóFídi - Your Music Cloud"

    if "show_errors" not in c["ui"].keys():
        wrn(
            "No 'ui.show_errors' value was found in the configuration file!  Defaulting to off..."
        )
        c["ui"]["show_errors"] = False

    if "theme" in c["ui"].keys():
        theme = c["ui"]["theme"].lower()
        if theme in THEMES.keys():

M mousikofidi/templates/playlist.html => mousikofidi/templates/playlist.html +1 -1
@@ 1,7 1,7 @@
{% extends 'base.html' %}
{% block content %}

  {% if bunk_tracks %}
  {% if bunk_tracks and show_errors %}
    <div>
      <h2 class="center">Oh no!</h2>
      <p class="center">{% if audio_list == [] and video_list == [] %}All{% else %}Some{% endif %} tracks on this playlist failed to load.</p>

M test_mousikofidi.py => test_mousikofidi.py +5 -0
@@ 462,6 462,7 @@ def test_browse_dir():
        "debug": False,
        "favicon_path": favicon,
        "show_cover_art": True,
        "show_errors": False,
        "icons": False,
        "keyboard_controls": True,
        "logo_path": logo,


@@ 599,6 600,7 @@ def test_browse_file():
        "secret_key": True,
        "site_name": "MousikóFídi - Your Music Cloud",
        "show_cover_art": True,
        "show_errors": False,
        "queue": [],
        "theme": "light",
        "username": None,


@@ 741,6 743,7 @@ def test_request_context():
            "playlists": [],
            "secret_key": True,
            "show_cover_art": True,
            "show_errors": False,
            "site_name": "MousikóFídi - Your Music Cloud",
            "queue": [],
            "theme": "light",


@@ 985,6 988,7 @@ def test_init():
            "icons": False,
            "logo_path": "/fidi.png",
            "show_cover_art": True,
            "show_errors": False,
            "site_name": "MousikóFídi - Your Music Cloud",
            "theme": "light",
        },


@@ 2282,6 2286,7 @@ def test_playlist_detail_real_with_bad(client):

    app.fidiConfig["library"]["dirs"] = [mdir]
    app.fidiConfig["playlists"]["dir"] = pdir
    app.fidiConfig["ui"]["show_errors"] = True
    app.fidiConfig["ui"]["site_name"] = "Pdir Test"

    with app.test_client() as tc: