From 85cea3c6634e9af141612a406ba15ebca37e20db Mon Sep 17 00:00:00 2001 From: david Date: Mon, 23 Jul 2018 19:45:17 +0200 Subject: FreeAMO: Improved terminal output --- subprojects/freeamo/src/get-licenses | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'subprojects/freeamo/src/get-licenses') diff --git a/subprojects/freeamo/src/get-licenses b/subprojects/freeamo/src/get-licenses index 79b6da4..4298962 100644 --- a/subprojects/freeamo/src/get-licenses +++ b/subprojects/freeamo/src/get-licenses @@ -23,10 +23,23 @@ cd "build/json/search-pages" || exit function get-licenses--download { # API: Add "last_license" to the search pages - https://github.com/mozilla/addons-server/issues/8945 - + output_file="$output_file_1"; - pv__size="$(wc -l < "$output_file")" + + if [ "$debug" = true ]; then + + pv__size=$(cat "$output_file" | head -n 3 | wc -l) + + else + + pv__size="$(wc -l < "$output_file")" + + fi + source "$run_path/src/main_functions" + + echo "Download $pv__size current_versions files that contain license information." + while IFS= read -r table; do @@ -44,7 +57,7 @@ function get-licenses--download { # echo -e "#================== #Entry $line (of $total): $name\n" - # Do now download the same license files over and over + # Do not download the same license files over and over wget -nc -q "https://addons.mozilla.org/api/v3/addons/addon/$slug/versions/$current_version__id/" -O "$run_path/build/json/current_versions/$current_version__id.json" fi @@ -58,10 +71,21 @@ function get-licenses--download { function get-licenses--filter { output_file="$output_file_1"; - pv__size="$(wc -l < "$output_file")" + + if [ "$debug" = true ]; then + + pv__size=$(cat "$output_file" | head -n 3 | wc -l) + + else + + pv__size="$(wc -l < "$output_file")" + + fi + source "$run_path/src/main_functions" rm -f "$run_path/build/index-search-pages--free-licenses.txt" + echo "Filter free licenses for $pv__size entries." while IFS= read -r table; do -- cgit v1.2.3