aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavid <public@beloved.name>2018-07-23 21:19:19 +0200
committerdavid <public@beloved.name>2018-07-23 21:19:19 +0200
commit3085614b00f7efcd46da67d3a24d21a0f4c4ce94 (patch)
tree072f2e5e7b1b95456c2740d77bc5e209452bfdf4
parent85cea3c6634e9af141612a406ba15ebca37e20db (diff)
FreeAMO: Fixed pv bug
-rw-r--r--subprojects/freeamo/freeamo.conf2
-rw-r--r--subprojects/freeamo/src/main_functions4
-rw-r--r--subprojects/freeamo/src/search-pages37
3 files changed, 30 insertions, 13 deletions
diff --git a/subprojects/freeamo/freeamo.conf b/subprojects/freeamo/freeamo.conf
index 910871f..526427f 100644
--- a/subprojects/freeamo/freeamo.conf
+++ b/subprojects/freeamo/freeamo.conf
@@ -13,7 +13,7 @@ sort="users"
type="extension"
# Mozilla API parameters: Add-ons -> Detail
-minimum_average_daily_users=100000
+minimum_average_daily_users=0
# Extra
notes="Extensions for the latest Trisquel GNU/Linux icecat package version."
diff --git a/subprojects/freeamo/src/main_functions b/subprojects/freeamo/src/main_functions
index 7a66cff..782f896 100644
--- a/subprojects/freeamo/src/main_functions
+++ b/subprojects/freeamo/src/main_functions
@@ -203,6 +203,10 @@ function pv__progress {
(pv --progress --line-mode --size "$pv__size" --timer) > /dev/null
+ else
+
+ tee
+
fi
}
diff --git a/subprojects/freeamo/src/search-pages b/subprojects/freeamo/src/search-pages
index bc4e14b..45ed716 100644
--- a/subprojects/freeamo/src/search-pages
+++ b/subprojects/freeamo/src/search-pages
@@ -34,15 +34,24 @@ function search-pages--download() {
page="1";
+ echo "Downloading search page: 1 (to get the number of total pages)"
wget_page
page_count="$(jq ".page_count" "$page.json")";
- pv__size="$page_count"
+ function pv__message {
+
+ regular_message="Download $pv__size pages from: ${base_uri//page=/page=\$page}"
+
+ }
+
if [ "$debug" = true ]; then
pv__size="2";
-
+ pv__discard=false;
+ pv__message
+ echo "$regular_message"
+
elif [ "$minimum_average_daily_users" -gt "0" ]; then
pv__discard=true;
@@ -51,24 +60,22 @@ function search-pages--download() {
else
pv__size="$page_count"
+ pv__discard=false;
+ pv__message
+ echo "$regular_message"
fi
-
-
source "$run_path/src/main_functions"
-
-
- echo "Download $pv__size pages from: ${base_uri//page=/page=\$page}"
-
while [ "$page" -lt "$page_count" ]; do
-
+
((++page))
if ( [ "$debug" = true ] && [ "$page" -le "3" ] || [ "$debug" = false ] ) && ( [ "$average_daily_users" -ge "$minimum_average_daily_users" ] ); then
- echo "$page"
+ source "$run_path/src/main_functions"
+ echo "Downloading search page: $page of $page_count"
wget_page
else
@@ -76,8 +83,14 @@ function search-pages--download() {
exit 0
fi
-
- echo "foo" # Must be here to work with pv
+
+
+ if [ ! "$pv__discard" = true ]; then
+
+ echo "foo" # Must be here to work with pv
+
+ fi
+
done | pv__progress
}