From d3b0d22130a37d93c4f234fd3f57e87cf4fa23c0 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 20 May 2025 12:00:52 +0300 Subject: [PATCH] GTFS indexing tolerates packages without stops.txt --- scripts/dl-and-index.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/dl-and-index.sh b/scripts/dl-and-index.sh index cc2cdce06..8021dcec4 100755 --- a/scripts/dl-and-index.sh +++ b/scripts/dl-and-index.sh @@ -54,11 +54,12 @@ rm -rf tpdc # param2: import folder name function import_gtfs { unzip -o $1 - - # extract feed id - index=$(sed -n $'1s/,/\\\n/gp' feed_info.txt | grep -nx 'feed_id' | cut -d: -f1) - prefix=$(cat feed_info.txt | sed -n 2p | cut -d "," -f $index) - node $TOOLS/pelias-gtfs/import -d $DATA/$2 --prefix=$prefix + if [ -f stops.txt ]; then + # extract feed id + index=$(sed -n $'1s/,/\\\n/gp' feed_info.txt | grep -nx 'feed_id' | cut -d: -f1) + prefix=$(cat feed_info.txt | sed -n 2p | cut -d "," -f $index) + node $TOOLS/pelias-gtfs/import -d $DATA/$2 --prefix=$prefix + fi # remove already parsed gtfs files rm *.txt }