aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Cholewiński <harry666t@gmail.com>2015-11-05 18:37:22 +0100
committerKamil Cholewiński <harry666t@gmail.com>2015-11-05 18:37:22 +0100
commit6cd5a4999934a7a593440ce9eb8e6c03eaf39e8e (patch)
tree1b42ae0b47ad4a08a3a2ad86b2d6f3b2e55c013c
parent1a29d54834d671a82fadd34a72eb147f634c60a7 (diff)
downloadmpw-6cd5a4999934a7a593440ce9eb8e6c03eaf39e8e.zip
mpw-6cd5a4999934a7a593440ce9eb8e6c03eaf39e8e.tar.gz
mpw-6cd5a4999934a7a593440ce9eb8e6c03eaf39e8e.tar.bz2
Apparently there might be junk in mpd's listing
-rw-r--r--mpw.py2
-rw-r--r--templates/browse.html14
2 files changed, 10 insertions, 6 deletions
diff --git a/mpw.py b/mpw.py
index 14ae8e8..a08d9f3 100644
--- a/mpw.py
+++ b/mpw.py
@@ -97,6 +97,8 @@ def rehydrate(item):
item.setdefault("path", item["directory"])
item.setdefault("label", os.path.basename(item["path"]))
item.setdefault("icon", symbols["other"]["folder"])
+ else:
+ return {"icon": "?", "label": item}
return item
diff --git a/templates/browse.html b/templates/browse.html
index 919609c..0bd8b08 100644
--- a/templates/browse.html
+++ b/templates/browse.html
@@ -35,12 +35,14 @@
{% for item in listing %}
<tr class="{{ loop.cycle('even', 'odd') }}">
<td>
- <div class="controls">
- {{ button("/library/add/" + item.path,
- symbols.other.add) }}
- {{ button("/library/replace-play/" + item.path,
- symbols.controls.play) }}
- </div>
+ {% if item.path is defined %}
+ <div class="controls">
+ {{ button("/library/add/" + item.path,
+ symbols.other.add) }}
+ {{ button("/library/replace-play/" + item.path,
+ symbols.controls.play) }}
+ </div>
+ {% endif %}
</td>
<td>{{ item.icon }}</td>
<td>