diff --git a/reflector-simple/PKGBUILD b/reflector-simple/PKGBUILD
index 20f35e3c..bca221d5 100644
--- a/reflector-simple/PKGBUILD
+++ b/reflector-simple/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=reflector-simple
pkgdesc="Simple GUI wrapper for 'reflector'."
pkgver=2023
-pkgrel=3
+pkgrel=4
arch=('any')
license=('GPL')
depends=(
@@ -33,7 +33,7 @@ source=(
$_url/mirrorlist-rank-info
$_url/eos-latest-arch-mirrorlist
)
-sha512sums=('e484f00529cc65f4f76ae7bcb88628ae4b76e6ac8f1d914d3f21a919d8c165dd9ade74ecc35608a3490e780fc22348b7c589c9c7975512d78d8d8eee7e9d6fe6'
+sha512sums=('957e5c8967083d031a032f870edbdd36b34f2149d5cbaa10452a3fbdc3f4d42523b8c1e5a5222d36a12922a70ef804699c03f669e33148484c107cc0eb091825'
'3435d083e8df72f17a291cca4c3cc62ac7824d1f528e746bf689f8962159fbdd97b6a57d45b3b379a2191e2e49536b77040b13d704a58753fbed00017f4403d0'
'aa149c8fc273e6a9fb5ddc38bde8a37b8fb095ec8877a324b957be57e156ef583adbed5988f0184ef06d5d09ec13e01e4a58b81fffef5d6d316405a3881895c3'
'8b101caac9f38238d30f293176a09f1bb483ec1cdc474ef126ec087a8b548b50eee5c35617f0616dd1618e4dce72e14b70270f47658577e20e04a133405510aa'
diff --git a/reflector-simple/reflector-simple b/reflector-simple/reflector-simple
index 5731db22..33092179 100755
--- a/reflector-simple/reflector-simple
+++ b/reflector-simple/reflector-simple
@@ -327,17 +327,27 @@ ChangeNamesToCodes() {
FixCountryName() { # simple fix to country name to be the same as in 'reflector --list-countries'
local name="$1"
- if [ -z "$(CountryToCode "$name")" ] ; then
- local official_name
- name=${name,,} # make lowercase
- for official_name in "${countrynames[@]}" ; do
- if [ "$name" = "${official_name,,}" ] ; then
- name="$official_name"
- break
- fi
- done
+ if [ -n "$(CountryToCode "$name")" ] ; then
+ echo "$name"
+ return 0
fi
- echo "$name"
+ local official_name
+ name=${name,,} # make lowercase
+ for official_name in "${countrynames[@]}" ; do
+ if [ "$name" = "${official_name,,}" ] ; then
+ echo "$official_name"
+ return 0
+ fi
+ done
+ return 1 # country name not found!
+}
+
+ToCountryName() {
+ local item="$1"
+ case "$item" in
+ [a-zA-Z][a-zA-Z]) CodeToCountry "$item" ;;
+ *) FixCountryName "$item" ;;
+ esac
}
IsInSelectedCountries() {
@@ -382,10 +392,9 @@ IsPositiveNumber() {
AskCountriesAndOptions() {
local tips=(
- "Select countries to include in mirror ranking"
- " - select one or more countries"
- " - closest locations are usually the fastest"
- " - https is the preferred protocol"
+ "Mirror ranking preferences"
+ " - select one or more countries"
+ " - select features based on your preferences"
)
if [ -r "$REFLECTOR_X_CONF" ] ; then
tips+=("\nNote: configuration file $REFLECTOR_X_CONF options are in use.")
@@ -396,7 +405,7 @@ AskCountriesAndOptions() {
local command
local default_age=2
local default_sort='age!^rate!country!score!delay'
- local default_number=10
+ local default_number=20
local use_saved=""
Verbose "Creating the yad command..."
@@ -459,6 +468,8 @@ AskCountriesAndOptions() {
fi
command+=(--field="Download timeout in seconds":num 5) # --download-timeout
+ command+=(--field="Threads":num 5) # --threads
+
local free_params=""
if [ -r "$free_params_file" ] ; then
free_params="$(/usr/bin/cat "$free_params_file" | tr '\n' ' ')"
@@ -545,15 +556,34 @@ BuildReflectorCommand() {
fi
((ix++))
reflector_cmd+=(--download-timeout "${reflector_info[$((ix++))]}")
+ reflector_cmd+=(--threads "${reflector_info[$((ix++))]}")
# add optional free parameters to the command and save free params to file
printf "" > "$free_params_file"
+ local prev=""
+ local item items=()
while true ; do
xx="${reflector_info[$((ix++))]}"
- [ -n "$xx" ] || break
+ case "$xx" in
+ "") break ;;
+ -c) prev="-c" ;;
+ *) case "$prev" in
+ -c)
+ # $xx may need some adjustment
+ readarray -t items <<< $(echo "$xx" | tr ',' '\n')
+ for item in "${items[@]}" ; do
+ conf_selected_countries+=("$(ToCountryName "$item")")
+ done
+ prev=""
+ ;;
+ esac
+ ;;
+ esac
reflector_cmd+=("$xx")
echo "$xx" >> "$free_params_file"
done
+
+ # echo "${reflector_cmd[*]}" > /tmp/foobar
}
ShowMirrorlistSaved() {
@@ -751,7 +781,7 @@ Main() {
local countrynames
local countrycodes
local reflector_info
- local reflector_cmd
+ local reflector_cmd=()
local ml=/etc/pacman.d/mirrorlist
local conf_selected_countries=()
local conf_dropped_countries=()