mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
feat: filter official
This commit is contained in:
1 parent
6219fb6a78
commit
133966ef36
3 files changed
+28
-8
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
version=5.8.0-beta.1
|
version=5.8.0-beta.2
|
||||||
|
|
||||||
#CONSTANTS
|
#CONSTANTS
|
||||||
aid=221100
|
aid=221100
|
||||||
@@ -585,10 +585,10 @@ fetch_helpers_by_sum(){
|
|||||||
[[ -f "$config_file" ]] && source "$config_file"
|
[[ -f "$config_file" ]] && source "$config_file"
|
||||||
declare -A sums
|
declare -A sums
|
||||||
sums=(
|
sums=(
|
||||||
["ui.py"]="a6fdbf3e3eb92b7bc78e6ae23882b10b"
|
["ui.py"]="ad3433f2c2d1ca6dc1d6c88912a5bb62"
|
||||||
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
|
||||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||||
["funcs"]="f6e8b113e586a4bb2ea40c9ee56ebc95"
|
["funcs"]="942902d9c38c8d675b5e48a7b7a34d93"
|
||||||
["lan"]="c62e84ddd1457b71a85ad21da662b9af"
|
["lan"]="c62e84ddd1457b71a85ad21da662b9af"
|
||||||
)
|
)
|
||||||
local author="aclist"
|
local author="aclist"
|
||||||
|
|||||||
+18
-1
@@ -605,6 +605,20 @@ filter_servers(){
|
|||||||
<<< "$filtered" awk -F$separator '!seen[$1]++'
|
<<< "$filtered" awk -F$separator '!seen[$1]++'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
filter_official(){
|
||||||
|
if [[ ${filters[*]} =~ Official ]]; then
|
||||||
|
echo -n "$filtered"
|
||||||
|
else
|
||||||
|
<<< "$filtered" awk -F$separator '$10 == "Community"'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
filter_community(){
|
||||||
|
if [[ ${filters[*]} =~ Unoffic ]]; then
|
||||||
|
echo -n "$filtered"
|
||||||
|
else
|
||||||
|
<<< "$filtered" awk -F$separator '$10 == "Official"'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
filtered=$(filter_perspective)
|
filtered=$(filter_perspective)
|
||||||
filtered=$(filter_full)
|
filtered=$(filter_full)
|
||||||
@@ -615,6 +629,8 @@ filter_servers(){
|
|||||||
filtered=$(filter_ascii)
|
filtered=$(filter_ascii)
|
||||||
filtered=$(filter_duplicates)
|
filtered=$(filter_duplicates)
|
||||||
filtered=$(filter_keyword)
|
filtered=$(filter_keyword)
|
||||||
|
filtered=$(filter_official)
|
||||||
|
filtered=$(filter_community)
|
||||||
|
|
||||||
if [[ -z "$filtered" ]]; then
|
if [[ -z "$filtered" ]]; then
|
||||||
logger WARN "Filter result is empty"
|
logger WARN "Filter result is empty"
|
||||||
@@ -652,7 +668,8 @@ parse_server_json(){
|
|||||||
"\(.max_players)␞" +
|
"\(.max_players)␞" +
|
||||||
"\(if .gametype == null then "0" elif .gametype|split("lqs")[1] == null then "0" else .gametype|split("lqs")[1]|split(",")[0] end)␞" +
|
"\(if .gametype == null then "0" elif .gametype|split("lqs")[1] == null then "0" else .gametype|split("lqs")[1]|split(",")[0] end)␞" +
|
||||||
"\(.addr|split(":")[0]):\(if .gameport == null then "XXXX" else .gameport end)␞" +
|
"\(.addr|split(":")[0]):\(if .gameport == null then "XXXX" else .gameport end)␞" +
|
||||||
"\(.addr|split(":")[1])"
|
"\(.addr|split(":")[1])␞" +
|
||||||
|
"\(if .gametype == null then "null" else (.gametype|split(",")|if any(. == "external") then "Community" else "Official" end) end)"
|
||||||
' | sort -k1
|
' | sort -k1
|
||||||
}
|
}
|
||||||
align_versions_file(){
|
align_versions_file(){
|
||||||
|
|||||||
+7
-4
@@ -38,7 +38,7 @@ mod_store = Gtk.ListStore(str, str, str, float, str)
|
|||||||
#cf. log_cols
|
#cf. log_cols
|
||||||
log_store = Gtk.ListStore(str, str, str, str)
|
log_store = Gtk.ListStore(str, str, str, str)
|
||||||
#cf. browser_cols
|
#cf. browser_cols
|
||||||
server_store = Gtk.ListStore(str, str, str, str, int, int, int, str, int)
|
server_store = Gtk.ListStore(str, str, str, str, int, int, int, str, int, str)
|
||||||
|
|
||||||
default_tooltip = "Select a row to see its detailed description"
|
default_tooltip = "Select a row to see its detailed description"
|
||||||
server_tooltip = [None, None]
|
server_tooltip = [None, None]
|
||||||
@@ -96,7 +96,9 @@ filters = {
|
|||||||
"Full": False,
|
"Full": False,
|
||||||
"Low pop": True,
|
"Low pop": True,
|
||||||
"Non-ASCII": False,
|
"Non-ASCII": False,
|
||||||
"Duplicate": False
|
"Duplicate": False,
|
||||||
|
"Official": True,
|
||||||
|
"Unoffic.": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -553,7 +555,7 @@ def parse_server_rows(data):
|
|||||||
lines = data.stdout.splitlines()
|
lines = data.stdout.splitlines()
|
||||||
reader = csv.reader(lines, delimiter=delimiter)
|
reader = csv.reader(lines, delimiter=delimiter)
|
||||||
try:
|
try:
|
||||||
rows = [[row[0], row[1], row[2], row[3], int(row[4]), int(row[5]), int(row[6]), row[7], int(row[8])] for row in reader if row]
|
rows = [[row[0], row[1], row[2], row[3], int(row[4]), int(row[5]), int(row[6]), row[7], int(row[8]), row[9]] for row in reader if row]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return 1
|
return 1
|
||||||
for row in rows:
|
for row in rows:
|
||||||
@@ -1609,7 +1611,8 @@ class TreeView(Gtk.TreeView):
|
|||||||
if (column_title == "Map"):
|
if (column_title == "Map"):
|
||||||
column.set_fixed_width(300)
|
column.set_fixed_width(300)
|
||||||
|
|
||||||
self.append_column(column)
|
if i != 10:
|
||||||
|
self.append_column(column)
|
||||||
|
|
||||||
self.update_first_col(mode.dict["label"])
|
self.update_first_col(mode.dict["label"])
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user