add a button to refresh the metadata
- ID
7ad4596- date
2023-05-14 21:31:03+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
fa8fa66- message
add a button to refresh the metadata- changed files
2 files, 24 additions, 5 deletions
Changed files
server.py (6755) → server.py (6867)
diff --git a/server.py b/server.py
index 0bc936f..f374888 100755
--- a/server.py
+++ b/server.py
@@ -221,5 +221,12 @@ def open_photo():
return b"", 204
+@app.route("/refresh", methods=["POST"])
+def refresh():
+ photos_data.fetch_metadata()
+
+ return b"", 204
+
+
if __name__ == "__main__":
app.run(debug="--debug" in sys.argv)
templates/index.html (6356) → templates/index.html (6644)
diff --git a/templates/index.html b/templates/index.html
index 9cf0bb2..24653a8 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -6,11 +6,6 @@
<summary>debug</summary>
<ul>
<li><strong>this asset:</strong> {{ this_asset['localIdentifier'] }}</li>
- {% if next_asset_id_to_review %}
- <li>
- <a href="/?localIdentifier={{ next_asset_id_to_review }}">jump to next unreviewed photo</a>
- </li>
- {% endif %}
<li><strong>stats:</strong>
{{ states["Approved"] | intcomma}} approved,
{{ states["Rejected"] | intcomma }} rejected,
@@ -18,6 +13,14 @@
{{ states["Unknown"] | intcomma }} remaining
({{ states.values() | sum | intcomma }} total)
</li>
+ <li>
+ <a href="#" onclick="httpPOST('/refresh')">refresh photos metadata</a>
+ </li>
+ {% if next_asset_id_to_review %}
+ <li>
+ <a href="/?localIdentifier={{ next_asset_id_to_review }}">jump to next unreviewed photo</a>
+ </li>
+ {% endif %}
</ul>
</details>
@@ -67,6 +70,15 @@
return xmlHttp.responseText;
}
+ function httpDELETE(url) {
+ var xmlHttp = null;
+
+ xmlHttp = new XMLHttpRequest();
+ xmlHttp.open("DELETE", url, false);
+ xmlHttp.send(null);
+ return xmlHttp.responseText;
+ }
+
document.onkeydown = function(e) {
if (e.key === "ArrowLeft") {
window.location = "/?localIdentifier={{ prev_five[-1]['localIdentifier'] }}";