diff options
author | Aleksandr Zatsepin <alexzatsepin@users.noreply.github.com> | 2019-01-09 11:46:47 +0300 |
---|---|---|
committer | Maksim Andrianov <maksimandrianov1@gmail.com> | 2019-01-09 11:46:47 +0300 |
commit | 92e3469b3d151aed60a4703e3ad8d4ca754eb5bd (patch) | |
tree | 13cbd5d0f48a02968d031aedee6aa412d7024a43 /tools | |
parent | ae2609e2bf6301d1f0071f352dc8d2a8bdc33948 (diff) |
Removed viator code (#9917)
* Removed viator code from core, android and ios.
* Removed redundant viator strings
* [android][ios] Generated localizations
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/viator_cities.py | 70 | ||||
-rwxr-xr-x | tools/unix/generate_planet.sh | 22 |
2 files changed, 0 insertions, 92 deletions
diff --git a/tools/python/viator_cities.py b/tools/python/viator_cities.py deleted file mode 100644 index 10dc489420..0000000000 --- a/tools/python/viator_cities.py +++ /dev/null @@ -1,70 +0,0 @@ -from __future__ import print_function - -import argparse -import json -import logging -import os -import urllib2 - -logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s] %(levelname)s: %(message)s') - - -class ViatorApi(object): - def __init__(self, apikey): - self.apikey = apikey - - def get_locations(self): - url = 'https://viatorapi.viator.com/service/taxonomy/locations?apiKey=' + self.apikey - stream = urllib2.urlopen(url) - return json.load(stream) - - -def check_errors(locations): - if not locations['success']: - raise Exception('Viator error, error codes:{} error text:{}' - .format(locations['errorCodes'], locations['errorMessageText'])) - - -def save_cities(locations, output_file_name): - with open(output_file_name, 'w') as output_file: - for l in locations['data']: - is_object_supported = (l['destinationType'] == 'CITY' and l['destinationId'] and - l['destinationName'] and l['latitude'] and l['longitude']) - if is_object_supported: - city = '\t'.join([ - str(l['destinationId']), - l['destinationName'], - str(l['latitude']), - str(l['longitude']) - ]) - print(city.encode('utf-8'), file=output_file) - - -def run(options): - try: - api = ViatorApi(options.apikey) - locations = api.get_locations() - check_errors(locations) - save_cities(locations, options.output) - except Exception as e: - logging.exception(e) - - -def process_options(): - parser = argparse.ArgumentParser(description='Download and process viator cities.') - - parser.add_argument('--apikey', dest='apikey', help='Viator apikey', required=True) - parser.add_argument('--output', dest='output', help='Destination file', required=True) - - options = parser.parse_args() - - return options - - -def main(): - options = process_options() - run(options) - - -if __name__ == '__main__': - main() diff --git a/tools/unix/generate_planet.sh b/tools/unix/generate_planet.sh index b828ba45c8..b1b6598443 100755 --- a/tools/unix/generate_planet.sh +++ b/tools/unix/generate_planet.sh @@ -189,8 +189,6 @@ BOOKING_SCRIPT="$PYTHON_SCRIPTS_PATH/booking_hotels.py" BOOKING_FILE="${BOOKING_FILE:-$INTDIR/hotels.csv}" OPENTABLE_SCRIPT="$PYTHON_SCRIPTS_PATH/opentable_restaurants.py" OPENTABLE_FILE="${OPENTABLE_FILE:-$INTDIR/restaurants.csv}" -VIATOR_SCRIPT="$PYTHON_SCRIPTS_PATH/viator_cities.py" -VIATOR_FILE="${VIATOR_FILE:-$INTDIR/viator.csv}" CITIES_BOUNDARIES_DATA="${CITIES_BOUNDARIES_DATA:-$INTDIR/cities_boundaries.bin}" TESTING_SCRIPT="$SCRIPTS_PATH/test_planet.sh" PYTHON="$(which python2.7)" @@ -307,25 +305,6 @@ if [ ! -f "$OPENTABLE_FILE" -a -n "${OPENTABLE_USER-}" -a -n "${OPENTABLE_PASS-} ) & fi -# Download viator.com cities. This takes around 3 seconds. -if [ ! -f "$VIATOR_FILE" -a -n "${VIATOR_KEY-}" ]; then - log "STATUS" "Step S3: Starting background viator cities downloading" - ( - $PYTHON $VIATOR_SCRIPT --apikey $VIATOR_KEY --output "$VIATOR_FILE" 2>"$LOG_PATH"/viator.log || true - if [ -f "$VIATOR_FILE" -a "$(wc -l < "$VIATOR_FILE" || echo 0)" -gt 100 ]; then - echo "Viator cities have been downloaded. Please ensure this line is before Step 4." >> "$PLANET_LOG" - else - if [ -n "${OLD_INTDIR-}" -a -f "${OLD_INTDIR-}/$(basename "$VIATOR_FILE")" ]; then - cp "$OLD_INTDIR/$(basename "$VIATOR_FILE")" "$INTDIR" - warn "Failed to download viator cities! Using older viator cities list." - else - warn "Failed to download viator cities!" - fi - [ -n "${MAIL-}" ] && tail "$LOG_PATH/viator.log" | mailx -s "Failed to download viator cities at $(hostname), please hurry to fix" "$MAIL" - fi - ) & -fi - # Download UGC (user generated content) database. if [ ! -f "$UGC_FILE" -a -n "${UGC_DATABASE_URL-}" ]; then putmode "Step UGC: Dowloading UGC database" @@ -473,7 +452,6 @@ if [ "$MODE" == "features" ]; then [ -n "$OPT_WORLD" -a "$NODE_STORAGE" == "map" ] && warn "generating world files with NODE_STORAGE=map may lead to an out of memory error. Try NODE_STORAGE=mem if it fails." [ -f "$BOOKING_FILE" ] && PARAMS_SPLIT="$PARAMS_SPLIT --booking_data=$BOOKING_FILE" [ -f "$OPENTABLE_FILE" ] && PARAMS_SPLIT="$PARAMS_SPLIT --opentable_data=$OPENTABLE_FILE" - [ -f "$VIATOR_FILE" ] && PARAMS_SPLIT="$PARAMS_SPLIT --viator_data=$VIATOR_FILE" [ -f "$POPULAR_PLACES_FILE" ] && PARAMS_SPLIT="$PARAMS_SPLIT --popular_places_data=$POPULAR_PLACES_FILE" "$GENERATOR_TOOL" --intermediate_data_path="$INTDIR/" \ --node_storage=$NODE_STORAGE \ |