diff options
author | david <public@beloved.name> | 2018-07-17 15:52:52 +0200 |
---|---|---|
committer | david <public@beloved.name> | 2018-07-17 15:52:52 +0200 |
commit | 1ae516a7bab1d5d9f02ab00c4ac13c219f43c1a1 (patch) | |
tree | 1733cb2fb3b2db132b4fc4fc433fc38a68062c12 /subprojects/freeamo/src/unmaintained/bad_names | |
parent | 3aa358cf718f8fc15952757cd04489b26770ac74 (diff) |
Renamed the AMO/FSD project to FreeAMO, and rewrote its architecture.
Diffstat (limited to 'subprojects/freeamo/src/unmaintained/bad_names')
-rw-r--r-- | subprojects/freeamo/src/unmaintained/bad_names | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/subprojects/freeamo/src/unmaintained/bad_names b/subprojects/freeamo/src/unmaintained/bad_names new file mode 100644 index 0000000..6ba8891 --- /dev/null +++ b/subprojects/freeamo/src/unmaintained/bad_names @@ -0,0 +1,31 @@ + + +function search-pages--filter__bad_names() { + +name=$(jq .results[$entry].name "$run_path/build/json/$file" | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;"); + +if [ "$name" == "null" ]; then + +name=$(jq .results[$entry].name "$run_path/build/json/$file" | sed "s|en-GB|enGB|;" | jq .enGB | sed "s|^\"||; s|\"$||;"); + +fi + +# The API `name` parameter makes bad MediaWiki URL's - https://github.com/mozilla/addons-server/issues/8790 +# Clean titles. Example of bad titles: "Ghostery – Privacy Ad Blocker" + +# - +# Hard to filter out "-" since many add-ons use it, see for example https://addons.mozilla.org/en-US/firefox/search/?platform=linux&q=1-click +# Flash Video Downloader - YouTube HD Download [4K] + +# Find all names that don't contain Aa-Zz 0-9 and white spaces should be much more reliable than this: +name=$(echo "$name" | sed ' +s/ — /\n/g; +s/ – /\n/g; +s/ - /\n/g; # looks identical to the prevoius line but is unique +s/: /\n/g; +s/(/\n/g; +s/,/\n/g; +s/™/\n/g; +' | head -n 1 | sed 's/ $//'); + +} |