check if DB is set
This commit is contained in:
parent
78ce5c08be
commit
4ccb6aa409
|
@ -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'"
|
||||
|
|
|
@ -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}'
|
||||
|
|
|
@ -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'"
|
||||
|
|
Loading…
Reference in New Issue