...
 
Commits (3)
......@@ -45,7 +45,7 @@ def get_metadata(directory: str) -> Metadata:
media_type = json.load(f)["type"]
metadata_cls = get_metadata_class(media_type)
return metadata_cls(directory)
except KeyError:
except (KeyError, ValueError):
raise InvalidMetadata()
......
......@@ -19,6 +19,7 @@ LICENSE"""
import os
from typing import Dict, List, Any, Union
from puffotter.os import listdir
from toktokkie.metadata.types.components.Component import Component
from toktokkie.metadata.ids.IdType import IdType
from toktokkie.metadata.ids.functions import minimize_ids, fill_ids, \
......@@ -70,3 +71,12 @@ class TvSeason(Component):
:return: Whether or not this season is a spinoff
"""
return self.parent_ids.get(IdType.TVDB) != self.ids.get(IdType.TVDB)
@property
def episode_names(self) -> List[str]:
"""
:return: A sorted list of episode names
"""
return [
x[0].rsplit(".", 1)[0] for x in listdir(self.path, no_dirs=True)
]
......@@ -53,4 +53,9 @@ def init_routes():
Initializes the app routes
:return:
"""
import toktokkie.web.routes
import toktokkie.web.routes.directories
import toktokkie.web.routes.update
import toktokkie.web.routes.config
import toktokkie.web.routes.listings
import toktokkie.web.routes.media
import toktokkie.web.routes.root
......@@ -18,7 +18,11 @@ along with toktokkie. If not, see <http://www.gnu.org/licenses/>.
LICENSE"""
import os
import json
from flask import url_for
from toktokkie.web import db
from toktokkie.Directory import Directory
from toktokkie.metadata.functions import get_metadata_class
class CachedDirectory(db.Model):
......@@ -26,6 +30,8 @@ class CachedDirectory(db.Model):
Database table that stores a cached version of a media Directory
"""
__directory = None
__tablename__ = "cached_directories"
"""
The table name
......@@ -58,3 +64,29 @@ class CachedDirectory(db.Model):
@property
def name(self) -> str:
return os.path.basename(os.path.abspath(self.path))
@property
def directory(self) -> Directory:
if self.__directory is None:
json_data = json.loads(self.metadata_json)
metadata = get_metadata_class(json_data["type"])(
self.path,
json_data=json_data,
no_validation=True
)
self.__directory = Directory(self.path, metadata=metadata)
return self.__directory
@property
def icon_url(self) -> str:
return "{}?path={}".format(
url_for("image", image_format="png"),
str(self.directory.metadata.get_icon_file("main"))
)
@property
def directory_url(self) -> str:
return "{}?path={}".format(
url_for("directory"),
self.path
)
......@@ -19,6 +19,7 @@ LICENSE"""
import os
import json
from typing import List, Dict
from flask import render_template, Response, request, redirect, url_for
from puffotter.os import get_ext
from toktokkie.web import app, db
......@@ -29,100 +30,15 @@ from toktokkie.metadata.MediaType import MediaType
from toktokkie.metadata.functions import get_metadata_class
@app.route("/")
def index():
"""
List all directories that were found in the stored content directories
:return: The response
"""
mapped_dirs = {x: [] for x in MediaType}
cached_dirs = CachedDirectory.query.all()
for cached in cached_dirs:
cached_data = json.loads(cached.metadata_json)
metadata = get_metadata_class(cached_data["type"])(
directory_path=cached.path,
json_data=cached_data,
no_validation=True
)
_directory = Directory(cached.path, metadata=metadata)
mapped_dirs[_directory.metadata.media_type()].append(_directory)
media_names = sorted([x for x in MediaType], key=lambda x: x.value)
media_dirs = []
for media_type in media_names:
media_dirs.append((media_type, mapped_dirs[media_type]))
return render_template("index.html", media_dirs=media_dirs)
@app.route("/image/<image_format>")
def image(image_format: str) -> Response:
"""
Sends an image file from the local file system
:return: A PNG image read from a local file
"""
path = request.args.get("path")
ext = get_ext(path)
if path is None or not os.path.isfile(path) or ext != image_format:
return Response(status=404)
else:
with open(path, "rb") as f:
return Response(f.read(), mimetype="image/" + image_format)
@app.route("/content_dirs", methods=["GET"])
def content_dirs():
paths = [x.path for x in MediaLocation.query.all()]
return render_template("content_dirs.html", paths=paths)
@app.route("/delete_content_dir", methods=["POST"])
def delete_content_dir():
target = request.form.get("target")
if target is not None:
location = MediaLocation.query.filter_by(path=target).first()
db.session.delete(location)
db.session.commit()
return redirect(url_for("content_dirs"))
@app.route("/add_content_dir", methods=["POST"])
def add_content_dir():
target = os.path.abspath(request.form.get("target"))
if target is not None and os.path.isdir(target):
location = MediaLocation(path=target)
db.session.add(location)
db.session.commit()
return redirect(url_for("content_dirs"))
@app.route("/directory", methods=["GET"])
def directory():
path = request.args.get("path")
_directory = Directory(path)
return render_template("directory.html", directory=_directory)
@app.route("/update", methods=["GET"])
def update():
for x in CachedDirectory.query.all():
db.session.delete(x)
paths = [x.path for x in MediaLocation.query.all()]
for path in paths:
directories = Directory.load_child_directories(path)
for _directory in directories:
cached = CachedDirectory(
path=_directory.path,
metadata_json=json.dumps(_directory.metadata.json)
)
db.session.add(cached)
db.session.commit()
redirect(url_for("/"))
"""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"""
"""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 render_template, request, redirect, url_for
from toktokkie.web import app, db
from toktokkie.web.models.MediaLocation import MediaLocation
@app.route("/configure")
def configure():
"""
Shows the configuration page
:return: The configuration page
"""
paths = [x.path for x in MediaLocation.query.all()]
return render_template("configure.html", paths=paths)
@app.route("/delete_content_dir", methods=["POST"])
def delete_content_dir():
"""
Deletes a content directory
:return: A redirect to the configuration page
"""
target = request.form.get("target")
if target is not None:
location = MediaLocation.query.filter_by(path=target).first()
db.session.delete(location)
db.session.commit()
return redirect(url_for("configure"))
@app.route("/add_content_dir", methods=["POST"])
def add_content_dir():
"""
Adds a content directory
:return: A redirect to the configuration page
"""
target = os.path.abspath(request.form.get("target"))
if target is not None and os.path.isdir(target):
location = MediaLocation(path=target)
db.session.add(location)
db.session.commit()
return redirect(url_for("configure"))
"""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 flask import render_template, request, Response
from toktokkie.web import app
from toktokkie.web.models.CachedDirectory import CachedDirectory
@app.route("/directory", methods=["GET"])
def directory():
"""
Displays a single directory
:return: The HTML for the directory page
"""
path = request.args.get("path")
cached = CachedDirectory.query.filter_by(path=path).first()
if cached is None:
return Response(404)
else:
return render_template(
"directory.html",
cached=cached,
directory=cached.directory,
metadata=cached.directory.metadata,
icon=cached.icon_url,
title=cached.directory.metadata.name
)
"""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 typing import List, Dict
from flask import render_template
from toktokkie.web import app
from toktokkie.web.models.CachedDirectory import CachedDirectory
from toktokkie.metadata.MediaType import MediaType
@app.route("/listings/<category_method>")
def listings(category_method: str):
"""
Lists all cached directories
:param category_method: Specifies by what metric to categorize the
directories.
:return: The generated HTML
"""
display_data = {} # type: Dict[str, List[CachedDirectory]]
cached_dirs = CachedDirectory.query.all()
if category_method == "media_type":
def fancy_media_type(string) -> str:
strings = string.replace("_", " ").split(" ")
string = " ".join([x[0].upper() + x[1:] for x in strings])
return string
display_data = {fancy_media_type(x.value): [] for x in MediaType}
for cached_dir in cached_dirs:
media_type = fancy_media_type(
cached_dir.directory.metadata.media_type().value
)
display_data[media_type].append(cached_dir)
elif category_method == "tags":
for cached_dir in cached_dirs:
for tag in cached_dir.directory.metadata.tags:
if tag not in display_data:
display_data[tag] = [cached_dir]
else:
display_data[tag].append(cached_dir)
elif category_method == "parent":
for cached_dir in cached_dirs:
parent = os.path.dirname(cached_dir.path)
if parent not in display_data:
display_data[parent] = [cached_dir]
else:
display_data[parent].append(cached_dir)
sorted_directory_data = []
for key in sorted(display_data.keys()):
directories = display_data[key]
directories.sort(key=lambda x: x.directory.metadata.name)
sorted_directory_data.append((key, directories))
return render_template(
"listings.html",
directory_data=sorted_directory_data
)
"""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 Response, request
from puffotter.os import get_ext
from toktokkie.web import app
@app.route("/image/<image_format>")
def image(image_format: str) -> Response:
"""
Sends an image file from the local file system
:return: A PNG image read from a local file
"""
path = request.args.get("path")
ext = get_ext(path)
if path is None or not os.path.isfile(path) or ext != image_format:
return Response(status=404)
else:
with open(path, "rb") as f:
return Response(f.read(), mimetype="image/" + image_format)
"""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 flask import render_template
from toktokkie.web import app
@app.route("/")
def index():
"""
Shows the home page of the web app
:return: The home page HTML
"""
return render_template("index.html")
"""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 json
from flask import redirect, url_for
from toktokkie.web import app, db
from toktokkie.Directory import Directory
from toktokkie.web.models.MediaLocation import MediaLocation
from toktokkie.web.models.CachedDirectory import CachedDirectory
@app.route("/update", methods=["GET"])
def update():
"""
Updates the cache
:return: A redirect to the index page
"""
for x in CachedDirectory.query.all():
db.session.delete(x)
paths = [x.path for x in MediaLocation.query.all()]
for path in paths:
directories = Directory.load_child_directories(path)
for _directory in directories:
cached = CachedDirectory(
path=_directory.path,
metadata_json=json.dumps(_directory.metadata.json)
)
db.session.add(cached)
db.session.commit()
redirect(url_for("index"))
body{
background: #EEEEEE;
line-height:1.6;
font-size:18px;
color:#444444;
}
h1,h2,h3{
line-height:1.2
}
.collapsible {
background-color: #777;
color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.active, .collapsible:hover {
background-color: #555;
}
.collapsible_content {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #f1f1f1;
}
.alternating_table{
width:100%;
border-collapse:collapse;
}
.alternating_table td{
padding:7px; border:#4e95f4 1px solid;
}
/* provide some minimal visual accomodation for IE8 and below */
.alternating_table tr{
background: #b8d1f3;
}
/* Define the background color for all the ODD background rows */
.alternating_table tr:nth-child(odd){
background: #b8d1f3;
}
/* Define the background color for all the EVEN background rows */
.alternating_table tr:nth-child(even){
background: #dae5f4;
}
.season_image {
height: 150px;
}
.listing_icon {
height: 70px;
}
.external_link_image {
height: 50px;
}
/*
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 bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>.
*/
function initializeCollapsibleButtons() {
let coll = document.getElementsByClassName("collapsible");
for (let i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function () {
this.classList.toggle("active");
let content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
this.innerHTML = this.innerHTML.replace("", "");
} else {
content.style.display = "block";
this.innerHTML = this.innerHTML.replace("", "");
}
});
}
}
body{
background: #EEEEEE;
margin:40px auto;
max-width:650px;
line-height:1.6;
font-size:18px;
color:#444444;
padding:0 10px
}
h1,h2,h3{
line-height:1.2
}
{#
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 bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>.
#}
<!DOCTYPE html>
<html lang="en">
{% include "header.html" %}
<head>
<meta charset="UTF-8">
{% if title is defined %}
<title>{{ title }}</title>
{% else %}
<title>toktokkie</title>
{% endif %}
{% if icon is defined %}
<link rel="icon" href="{{ icon }}">
{% else %}
<link rel="icon" href="{{ url_for('static', filename='images/logo.png') }}">
{% endif %}
<link rel="stylesheet" type=text/css href="{{ url_for('static', filename='css/style.css') }}">
<script src="{{ url_for('static', filename='js/dropdown.js') }}"></script>
{% block head %}{% endblock %}
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
{% block body %}{% endblock %}
</body>
</html>
{#
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 bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "base_layout.html" %}
{% block body %}
<h1>Configuration</h1>
<table>
<tbody>
{% for path in paths %}
<tr>
<td>{{ path }}</td>
<td>
<form action="/delete_content_dir" method="post">
<!--suppress HtmlFormInputWithoutLabel -->
<input name="target" value="{{ path }}" hidden>
<input type="submit" value="X" id="{{ path }}">
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<form action="/add_content_dir" method="post">
<label for="add_submit">New Content directory</label>
<input type="text" name="target" value="" id="add_submit">
<input type="submit" value="Submit">
</form>
{% endblock %}
<table>
<tbody>
{% for path in paths %}
<tr>
<td>{{ path }}</td>
<td>
<form action="delete_content_dir" method="post">
<!--suppress HtmlFormInputWithoutLabel -->
<input name="target" value="{{ path }}" hidden>
<input type="submit" value="X" id="{{ path }}">
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<form action="/add_content_dir" method="post">
<label for="add_submit">New Content directory</label>
<input type="text" name="target" value="" id="add_submit">
<input type="submit" value="Submit">
</form>
{% set cover = "{}".format(directory.metadata.get_icon_file("main")) %}
{% set cover_url = url_for('image', image_format='png') + '?path=' + cover %}
{#
Copyright 2015 Hermann Krumrey <hermann@krumreyh.com>
{% set title=directory.metadata.name %}
{% set icon = cover_url if cover != "None" else "static/logo.png" %}
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 bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "base_layout.html" %}
{% block body %}
<h1>{{ directory.metadata.name }}</h1>
<h1>{{ metadata.name }}</h1>
<img src="{{ cached.icon_url }}" alt="{{ metadata.name }}">
{% if cover is not none %}
<img src="{{ icon }}">
{% endif %}
{% if directory.metadata.media_type().value == "tv" %}
<table>
{% for season in directory.metadata.seasons %}
{% set season_cover = "{}".format(directory.metadata.get_icon_file(season.name)) %}
{% set season_cover_url = url_for('image', image_format='png') + '?path=' + season_cover %}
{% if metadata.media_type().value == "tv" %}
<table class="alternating_table">
{% for season in metadata.seasons %}
{% set season_cover = "{}".format(metadata.get_icon_file(season.name)) %}
{% set season_cover_url = "{}?path={}".format(url_for("image", image_format="png"), season_cover) %}
<tr>
<td>
<img src="{{ season_cover_url }}" style="height: 50px;">
<img class="season_image" src="{{ season_cover_url }}" alt="{{ season.name }}">
</td>
<td>
<button type="button" class="collapsible"> ⮞ {{ season.name }}</button>
<table class="collapsible_content alternating_table">
{% for episode_name in season.episode_names %}
<tr>
<td>{{ episode_name }}</td>
</tr>
{% endfor %}
</table>
</td>
<td>{{ season.name }}</td>
</tr>
{% endfor %}
</table>
......@@ -31,15 +51,19 @@
<table>
<tr>
{% for id_type, urls in directory.metadata.urls.items() %}
{% for url in urls %}
{% set image = "static/{}.png".format(id_type.value) %}
<td><a href="{{url}}">
<img src="{{image}}" style="height: 50px;">
</a></td>
{% endfor %}
{% for id_type, urls in metadata.urls.items() %}
{% for url in urls %}
{% set image = "static/images/{}.png".format(id_type.value) %}
<td><a href="{{url}}">
<img class="external_link_image" src="{{image}}" alt="{{ id_type.value }}">
</a></td>
{% endfor %}
{% endfor %}
</tr>
</table>
<script>
initializeCollapsibleButtons()
</script>
{% endblock %}
\ No newline at end of file
<head>
<meta charset="UTF-8">
<title>{{ title }}</title>
<link rel="icon" href="{{ icon }}">
<link rel="stylesheet" type=text/css href="{{ url_for('static', filename='style.css') }}">
{% block head %}{% endblock %}
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
{% set title = "toktokkie" %}
{% set icon = "static/logo.png" %}
{#
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 bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "base_layout.html" %}
{% block body %}
<a href="/content_dirs">Configure</a>
{% for media_type, directories in media_dirs %}
<h1>{{ media_type.value }}</h1>
<table>
{% for directory in directories %}
{% set cover = directory.metadata.get_icon_file("main") %}
<tr>
<td>
{% if cover is not none %}
<img style="max-height: 50px" width="50px" src="{{ url_for('image', image_format='png') + '?path=' + cover }}">
{% endif %}
</td>
<td>
<a href="{{ url_for('directory') + '?path=' + directory.path }}">{{ directory.metadata.name }}</a>
</td>
</tr>
{% endfor %}
</table>
{% endfor %}
<h1>toktokkie</h1>
<img src="{{ url_for("static", filename="images/logo.png") }}" alt="toktokkie">
<h2><a href="{{ url_for("listings", category_method="media_type") }}">Listings (by media type)</a></h2>
<h2><a href="{{ url_for("listings", category_method="tags") }}">Listings (by tags)</a></h2>
<h2><a href="{{ url_for("listings", category_method="parent") }}">Listings (by parent directory)</a></h2>
<h2><a href="{{ url_for("configure") }}">Configuration</a></h2>
{% endblock %}
{#
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 bundesliga-tippspiel. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "base_layout.html" %}
{% block body %}
<h1>Listings</h1>
{% for category, cached_dirs in directory_data %}
<button type="button" class="collapsible"> ⮞ {{ category }}</button>
<table class="collapsible_content alternating_table">
{% for cached_dir in cached_dirs %}
{% set metadata = cached_dir.directory.metadata %}
{% set cover = metadata.get_icon_file("main") %}
<tr>
<td>
{% if cover is not none %}
<img class="listing_icon" src="{{ cached_dir.icon_url }}" alt="{{ metadata.name }}">
{% endif %}
</td>
<td>
<a href="{{ cached_dir.directory_url }}">
{{ metadata.name }}
</a>
</td>
</tr>
{% endfor %}
</table>
{% endfor %}
<script>
initializeCollapsibleButtons()
</script>
{% endblock %}