From 5d6f781f154b40968cc2d73563612a3d590453db Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Thu, 18 Aug 2022 00:48:37 +0000 Subject: [PATCH] Add (force) refresh button for media --- server/app.py | 15 ++++++++++++++- server/templates/media_element.htm | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/server/app.py b/server/app.py index 1316b4c..1f4f37e 100644 --- a/server/app.py +++ b/server/app.py @@ -50,7 +50,10 @@ from entertainment_decider.extractors.collection import ( collection_extract_uri, collection_update, ) -from entertainment_decider.extractors.media import media_extract_uri +from entertainment_decider.extractors.media import ( + media_extract_uri, + media_update, +) #### @@ -421,6 +424,16 @@ def force_refresh_collection(collection_id: int): if coll is None: return "404 Not Found", 404 collection_update(coll, check_cache_expired=False) + update_element_lookup_cache([coll.id]) + return redirect_back_or_okay() + + +@flask_app.route("/api/refresh/media/", methods=["POST"]) +def force_refresh_media(media_id: int): + elem: MediaElement = MediaElement.get(id=media_id) + if elem is None: + return "404 Not Found", 404 + media_update(elem, check_cache_expired=False) return redirect_back_or_okay() diff --git a/server/templates/media_element.htm b/server/templates/media_element.htm index fd7ec2c..9f9c50a 100644 --- a/server/templates/media_element.htm +++ b/server/templates/media_element.htm @@ -16,6 +16,7 @@