set vid_type for pending items in ta_download

This commit is contained in:
simon 2023-01-02 13:28:49 +07:00
parent 3db6077adf
commit 7941b0412b
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 7 additions and 3 deletions

View File

@ -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):

View File

@ -96,7 +96,7 @@
<button data-id="{{ video.source.youtube_id }}" onclick="addSingle(this)">Add to queue</button>
{% else %}
<button data-id="{{ video.source.youtube_id }}" onclick="toIgnore(this)">Ignore</button>
<button id="{{ video.source.youtube_id }}" data-id="{{ video.source.youtube_id }}" onclick="downloadNow(this)">Download now</button>
<button id="{{ video.source.youtube_id }}" data-id="{{ video.source.youtube_id }}" data-type="{{ video.source.vid_type }}" onclick="downloadNow(this)">Download now</button>
{% endif %}
</div>
</div>