#!/bin/bash # file in which data got stored OUTPUT_FILE="../oe3.csv" # temp file for new data TEMP_FILE="temp_output.csv" # if file not exist, create and add header if [ ! -f "$OUTPUT_FILE" ]; then echo "startISO;interpreter;title" > "$OUTPUT_FILE" fi while true; do # call api and filter it curl -s "https://audioapi2.orf.at/oe3/json/4.0/live?_o=oe3.orf.at" | \ jq -r '.[].items[] | select(.interpreter != null and .title != null) | "\(.startISO);\(.interpreter);\(.title)"' > "$TEMP_FILE" # find new entries and add to main file grep -Fxv -f "$OUTPUT_FILE" "$TEMP_FILE" >> "$OUTPUT_FILE" # debug echo "List updated: $(date)" # wait 20 minutes # sleep 1200 sleep 300 done