From 651a642e71f18aef15fe65ee3fbfe755cae9cda0 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 29 Oct 2022 21:33:16 +0700 Subject: [PATCH 1/6] bump pillow --- tubearchivist/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tubearchivist/requirements.txt b/tubearchivist/requirements.txt index a1ea488..c185f8d 100644 --- a/tubearchivist/requirements.txt +++ b/tubearchivist/requirements.txt @@ -4,7 +4,7 @@ Django==4.1.2 django-auth-ldap==4.1.0 django-cors-headers==3.13.0 djangorestframework==3.14.0 -Pillow==9.2.0 +Pillow==9.3.0 redis==4.3.4 requests==2.28.1 ryd-client==0.0.6 From 749261c14632a8b847535ec99b97777c7c3495a5 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 2 Nov 2022 10:17:27 +0700 Subject: [PATCH 2/6] take snapshot at 12 localtime --- tubearchivist/home/src/es/snapshot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tubearchivist/home/src/es/snapshot.py b/tubearchivist/home/src/es/snapshot.py index 35ce12c..b665ba2 100644 --- a/tubearchivist/home/src/es/snapshot.py +++ b/tubearchivist/home/src/es/snapshot.py @@ -107,8 +107,11 @@ class ElasticSnapshot: def _build_policy_data(self): """build policy dict from config""" + at_12 = datetime.now().replace(hour=12, minute=0, second=0) + hour = at_12.astimezone(ZoneInfo("UTC")).hour + return { - "schedule": "0 30 1 * * ?", + "schedule": f"0 0 {hour} * * ?", "name": f"<{self.POLICY}_>", "repository": self.REPO, "config": { From dcf317e47116f51c782bf77fbc41d252a33538dc Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 2 Nov 2022 10:30:21 +0700 Subject: [PATCH 3/6] form validate channel pagesize greater than 0, #334 --- tubearchivist/home/src/frontend/forms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tubearchivist/home/src/frontend/forms.py b/tubearchivist/home/src/frontend/forms.py index 90927c4..1e4365c 100644 --- a/tubearchivist/home/src/frontend/forms.py +++ b/tubearchivist/home/src/frontend/forms.py @@ -98,7 +98,9 @@ class ApplicationSettingsForm(forms.Form): ("1", "enable cookie"), ] - subscriptions_channel_size = forms.IntegerField(required=False) + subscriptions_channel_size = forms.IntegerField( + required=False, min_value=1 + ) downloads_limit_count = forms.IntegerField(required=False) downloads_limit_speed = forms.IntegerField(required=False) downloads_throttledratelimit = forms.IntegerField(required=False) From 0f191d8a3e65b58a469d9043722d2497fd87a6c2 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 2 Nov 2022 11:59:31 +0700 Subject: [PATCH 4/6] configure fuzziness in search --- tubearchivist/home/src/frontend/searching.py | 37 ++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/tubearchivist/home/src/frontend/searching.py b/tubearchivist/home/src/frontend/searching.py index ce3209a..839e196 100644 --- a/tubearchivist/home/src/frontend/searching.py +++ b/tubearchivist/home/src/frontend/searching.py @@ -191,7 +191,7 @@ class SearchParser: def __init__(self, search_query): self.query_words = search_query.lower().split() - self.query_map = False + self.query_map = {"term": [], "fuzzy": []} self.append_to = "term" def run(self): @@ -214,11 +214,11 @@ class SearchParser: if ":" in first_word: index_match, query_string = first_word.split(":") if index_match in key_word_map: - self.query_map = key_word_map.get(index_match) + self.query_map.update(key_word_map.get(index_match)) self.query_words[0] = query_string return index_match - self.query_map = key_word_map.get("simple") + self.query_map.update(key_word_map.get("simple")) print(f"query_map: {self.query_map}") return "simple" @@ -229,29 +229,24 @@ class SearchParser: return { "simple": { "index": "ta_video,ta_channel,ta_playlist", - "term": [], }, "video": { "index": "ta_video", - "term": [], "channel": [], "active": [], }, "channel": { "index": "ta_channel", - "term": [], "active": [], "subscribed": [], }, "playlist": { "index": "ta_playlist", - "term": [], "active": [], "subscribed": [], }, "full": { "index": "ta_subtitle", - "term": [], "lang": [], "source": [], }, @@ -329,6 +324,20 @@ class QueryBuilder: return query + def _get_fuzzy(self): + """return fuziness valuee""" + fuzzy_value = self.query_map.get("fuzzy", ["auto"])[0] + if fuzzy_value == "no": + return 0 + + if not fuzzy_value.isdigit(): + return "auto" + + if int(fuzzy_value) > 2: + return "2" + + return fuzzy_value + def _build_simple(self): """build simple cross index query""" must_list = [] @@ -339,7 +348,7 @@ class QueryBuilder: "multi_match": { "query": term, "type": "bool_prefix", - "fuzziness": "auto", + "fuzziness": self._get_fuzzy(), "operator": "and", "fields": [ "channel_name._2gram", @@ -368,7 +377,7 @@ class QueryBuilder: "multi_match": { "query": term, "type": "bool_prefix", - "fuzziness": "auto", + "fuzziness": self._get_fuzzy(), "operator": "and", "fields": [ "title._2gram^2", @@ -390,7 +399,7 @@ class QueryBuilder: "multi_match": { "query": channel, "type": "bool_prefix", - "fuzziness": "auto", + "fuzziness": self._get_fuzzy(), "operator": "and", "fields": [ "channel.channel_name._2gram", @@ -413,7 +422,7 @@ class QueryBuilder: "multi_match": { "query": term, "type": "bool_prefix", - "fuzziness": "auto", + "fuzziness": self._get_fuzzy(), "operator": "and", "fields": [ "channel_description", @@ -445,7 +454,7 @@ class QueryBuilder: "multi_match": { "query": term, "type": "bool_prefix", - "fuzziness": "auto", + "fuzziness": self._get_fuzzy(), "operator": "and", "fields": [ "playlist_description", @@ -477,7 +486,7 @@ class QueryBuilder: "match": { "subtitle_line": { "query": term, - "fuzziness": "auto", + "fuzziness": self._get_fuzzy(), } } } From e9c457cac299ff43c50e007a72d4e6e55670536b Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 2 Nov 2022 12:18:17 +0700 Subject: [PATCH 5/6] bump django --- tubearchivist/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tubearchivist/requirements.txt b/tubearchivist/requirements.txt index c185f8d..3d6996a 100644 --- a/tubearchivist/requirements.txt +++ b/tubearchivist/requirements.txt @@ -1,6 +1,6 @@ beautifulsoup4==4.11.1 celery==5.2.7 -Django==4.1.2 +Django==4.1.3 django-auth-ldap==4.1.0 django-cors-headers==3.13.0 djangorestframework==3.14.0 From 10fbfadf510bc29df4f259c948c4a07fd7f71e19 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 2 Nov 2022 12:23:34 +0700 Subject: [PATCH 6/6] bump TA_VERSION unstable --- tubearchivist/config/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tubearchivist/config/settings.py b/tubearchivist/config/settings.py index 9e5f016..deecb8e 100644 --- a/tubearchivist/config/settings.py +++ b/tubearchivist/config/settings.py @@ -262,4 +262,4 @@ CORS_ALLOW_HEADERS = list(default_headers) + [ # TA application settings TA_UPSTREAM = "https://github.com/tubearchivist/tubearchivist" -TA_VERSION = "v0.2.3" +TA_VERSION = "v0.2.4-unstable"