check if DB is set

This commit is contained in:
filifa 2024-07-25 22:48:57 -05:00
parent 78ce5c08be
commit 4ccb6aa409
3 changed files with 18 additions and 0 deletions

View File

@ -20,5 +20,11 @@ then
exit 1
fi
if [[ -z $DB ]]
then
echo "$0:" '$DB not set' >&2
exit 1
fi
jqFilter='.highlights.highlights.items | map(select(.keywordsAll[].value == "highlight"))[] | {headline, id} + {url: (.playbacks | map(select(.name == "mp4Avc"))[0].url)}'
mlblive content -g $gamePk | jq -Sc --unbuffered "$jqFilter" | sed -u 's/$/0/' | split -l 1 --filter="sqlite3 $DB '.mode ascii' '.separator ' '.import /dev/stdin highlights'"

View File

@ -2,4 +2,10 @@
set -e
if [[ -z $DB ]]
then
echo "$0:" '$DB not set' >&2
exit 1
fi
sqlite3 $DB < postplays.sql | awk -F  '{printf "%s\n\n%s %s\n#%s %s\n#%s %s\n\n#baseball #live\n", $1, $2, $3, $4, $5, $6, $7}'

View File

@ -20,5 +20,11 @@ then
exit 1
fi
if [[ -z $DB ]]
then
echo "$0:" '$DB not set' >&2
exit 1
fi
jqFilter='{gamePk} + (.gameData.teams | {awayTeam: .away.teamName, homeTeam: .home.teamName}) + (.liveData.plays.allPlays[] | (.result + (.about | {atBatIndex, halfInning, inning, isComplete, isScoringPlay, hasReview})))'
mlblive subscribe -g $gamePk | jq -Sc --unbuffered "$jqFilter" | sed -u 's/$/0/' | split -l 1 --filter="sqlite3 $DB '.mode ascii' '.separator ' '.import /dev/stdin playinfo'"