From 7941b0412bcf6ebfc12e598e56b37dc0c1daad75 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 2 Jan 2023 13:28:49 +0700 Subject: [PATCH] set vid_type for pending items in ta_download --- tubearchivist/home/apps.py | 8 ++++++-- tubearchivist/home/templates/home/downloads.html | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tubearchivist/home/apps.py b/tubearchivist/home/apps.py index 1356ac80..14b1d7c5 100644 --- a/tubearchivist/home/apps.py +++ b/tubearchivist/home/apps.py @@ -129,14 +129,18 @@ class StartupCheck: def es_set_vid_type(self): """update path 0.3.0 to 0.3.1, set default vid_type to video""" + index_list = ["ta_video", "ta_download"] data = { "query": { "bool": {"must_not": [{"exists": {"field": "vid_type"}}]} }, "script": {"source": "ctx._source['vid_type'] = 'video'"}, } - response, _ = ElasticWrap("ta_video/_update_by_query").post(data=data) - print(f"ta_video vid_type index update ran: {response}") + + for index_name in index_list: + path = f"{index_name}/_update_by_query" + response, _ = ElasticWrap(path).post(data=data) + print(f"{index_name} vid_type index update ran: {response}") class HomeConfig(AppConfig): diff --git a/tubearchivist/home/templates/home/downloads.html b/tubearchivist/home/templates/home/downloads.html index c4e76349..7b515721 100644 --- a/tubearchivist/home/templates/home/downloads.html +++ b/tubearchivist/home/templates/home/downloads.html @@ -96,7 +96,7 @@ {% else %} - + {% endif %}