From 29b7728d89b8c64220ffd06e268fdaa35dac7f45 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 20 Jul 2018 12:45:24 +0200 Subject: FreeAMO. General bug fixes. Fixed the description fields for .wiki pages --- subprojects/freeamo/src/search-pages | 43 +++++++++++------------------------- 1 file changed, 13 insertions(+), 30 deletions(-) (limited to 'subprojects/freeamo/src/search-pages') diff --git a/subprojects/freeamo/src/search-pages b/subprojects/freeamo/src/search-pages index a723601..3e894dc 100644 --- a/subprojects/freeamo/src/search-pages +++ b/subprojects/freeamo/src/search-pages @@ -17,22 +17,11 @@ cd "$run_path/build/json/search-pages" || exit -base_uri="https://addons.mozilla.org/api/v3/addons/search/?platform=$platform&sort=$sort&type=$type&app=$app&appversion=$appversion&page_size=$page_size&page="; +base_uri="https://addons.mozilla.org/api/v$api_version/addons/search/?platform=$platform&sort=$sort&type=$type&app=$app&appversion=$appversion&page_size=$page_size&page="; +echo "$base_uri" function search-pages--download() { - echo -e "\\nDownloading search pages from $base_uri :" | sed "s|page=|page=\$page|" - - echo "This file is used to describe the settings that were used to generate the files. - -build/json/search-pages/ -$wget_uri" > "$run_path/build/declared_settings.txt" - # indicate that the page page variable are the page files - sed -i "s|page=1|page=\$page|g" "$run_path/build/declared_settings.txt" - - - - ##################################################### function wget_page { @@ -57,12 +46,16 @@ $wget_uri" > "$run_path/build/declared_settings.txt" pv__size="2"; + elif [ "$minimum_average_daily_users" -gt "0" ]; then + + pv__discard=true; + echo "Cannot show a progress counter since minimum_average_daily_users is set to more than 0 in freeamo.conf." + else pv__size="$page_count" fi - while [ "$page" -lt "$page_count" ]; do @@ -80,28 +73,17 @@ $wget_uri" > "$run_path/build/declared_settings.txt" fi echo "foo" # Must be here to work with pv - done | progress + done | pv__progress } function search-pages--filter() { - - echo -e "\\nFilter search pages -- no EULA, no native messaging, and minimum average daily users ($minimum_average_daily_users):" - - # source "$run_path/src/main_functions" - # amo_variables - echo " -build/index-search-pages.txt -has_eula=false -nativeMessaging__pass=true -minimum_average_daily_users=$minimum_average_daily_users" >> "$run_path/build/declared_settings.txt" - - pv__size=$(ls . | wc -l) + pv__size=$(find . -not -name . | wc -l) output_file="$output_file_1"; source "$run_path/src/main_functions" - rm -f $output_file_1 + rm -f "$output_file_1" # Sort by file modification time stamp for the downloaded JSON files find . -type f | sort -n | while read -r file; do @@ -111,6 +93,7 @@ minimum_average_daily_users=$minimum_average_daily_users" >> "$run_path/build/de entry="0"; # Should not be 1 + # Should not be limited to 3 in --debug mode. for id in $(jq ".results[].average_daily_users" "$file"); do source "$run_path/src/main_functions" @@ -119,7 +102,7 @@ minimum_average_daily_users=$minimum_average_daily_users" >> "$run_path/build/de essential_addon if [ "$essential_addon" = true ]; then - echo -e "$filename\\t$entry" >> "$output_file_1" + echo -e "$filename\\t$entry\\t$slug" >> "$output_file_1" fi @@ -131,6 +114,6 @@ minimum_average_daily_users=$minimum_average_daily_users" >> "$run_path/build/de echo "foo" # Must be here to work with pv - done | progress + done | pv__progress } -- cgit v1.2.3