From cb7e89be29af8f1bf6a6bd88f476a42254dfeb92 Mon Sep 17 00:00:00 2001 From: Victorious Children Studios Date: Thu, 21 Dec 2023 23:20:12 +0200 Subject: [PATCH] Regular expressions in downloading files. --- network/http_client.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/network/http_client.py b/network/http_client.py index b1539b0..7d396dc 100644 --- a/network/http_client.py +++ b/network/http_client.py @@ -794,6 +794,9 @@ def prompt_layer(win, call): ActiveTab = win.current["remote-folder-data"][cur]["active_tab"] DisplayList = win.current["remote-folder-data"][cur][ActiveTab] + # if win.text["http_client_search"]["text"]: + # DisplayList = fnmatch.filter(DisplayList, win.text["http_client_search"]["text"]) + try: for f in DisplayList: @@ -802,15 +805,24 @@ def prompt_layer(win, call): if fdata.get("finished"): continue - found = True + # found = True + # if win.text["http_client_search"]["text"]: + # for word in win.text["http_client_search"]["text"].split(" "): + # if word.lower() not in f.lower(): + # found = False + # continue if win.text["http_client_search"]["text"]: - for word in win.text["http_client_search"]["text"].split(" "): - if word.lower() not in f.lower(): - found = False - continue - - if not found: - continue + searchtext = win.text["http_client_search"]["text"] + rthings = "[]*?!" + found = False + for thing in rthings: + if thing in searchtext: + found = True + break + if not found: + searchtext = "*"+searchtext+"*" + if not fnmatch.fnmatch(f, searchtext): + continue ticon = "unchecked" if fdata.get("to_download", True):