check games table for live games

This commit is contained in:
filifa 2024-08-03 15:54:35 -05:00
parent e5ff87730e
commit 46148dedf6
2 changed files with 8 additions and 5 deletions

View File

@ -30,8 +30,10 @@ then
exit 1 exit 1
fi fi
# grab most recently started live pk, if multiple # grab the game pk of a single live game, if multiple (in case of spring
gamePk=$(mlblive schedule -t $team | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk') # training)
gamePk=$(sqlite3 $db "select gamePk from games where teamId='$team' and state='In Progress' limit 1")
if [[ -z "$gamePk" ]]
if [[ "$gamePk" = 'null' ]] if [[ "$gamePk" = 'null' ]]
then then
echo "$0:" 'no live games found' >&2 echo "$0:" 'no live games found' >&2

View File

@ -30,9 +30,10 @@ then
exit 1 exit 1
fi fi
# grab most recently started live pk, if multiple # grab the game pk of a single live game, if multiple (in case of spring
gamePk=$(mlblive schedule -t $team | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk') # training)
if [[ "$gamePk" = 'null' ]] gamePk=$(sqlite3 $db "select gamePk from games where teamId='$team' and state='In Progress' limit 1")
if [[ -z "$gamePk" ]]
then then
echo "$0:" 'no live games found' >&2 echo "$0:" 'no live games found' >&2
exit 1 exit 1