remove helper scripts to simplify deployment
This commit is contained in:
parent
e873ed44b8
commit
2524f70cb0
|
@ -29,12 +29,13 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
gamePk=$(mlblivepk.sh -t $team)
|
||||
if [[ -z $gamePk || "$gamePk" = 'null' ]]
|
||||
# grab most recently started live pk, if multiple
|
||||
gamePk=$(mlblive schedule -t $team | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk')
|
||||
if [[ "$gamePk" = 'null' ]]
|
||||
then
|
||||
echo "$0:" 'no live games found' >&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/' | writedb.sh -d $db -t mlbdata -c ''
|
||||
mlblive content -g $gamePk | jq -Sc --unbuffered "$jqFilter" | sed -u 's/$/0/' | split -l 1 --filter="sqlite3 $db '.mode ascii' '.separator ' '.import /dev/stdin mlbdata'"
|
||||
|
|
24
mlblivepk.sh
24
mlblivepk.sh
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
while getopts 't:' opt
|
||||
do
|
||||
case $opt in
|
||||
t)
|
||||
team=$OPTARG
|
||||
;;
|
||||
?)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z $team ]]
|
||||
then
|
||||
echo "$0:" '-t is required' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# grab most recently started live pk, if multiple
|
||||
mlblive schedule -t $team | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk'
|
|
@ -29,12 +29,13 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
gamePk=$(mlblivepk.sh -t $team)
|
||||
if [[ -z $gamePk || "$gamePk" = 'null' ]]
|
||||
# grab most recently started live pk, if multiple
|
||||
gamePk=$(mlblive schedule -t $team | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk')
|
||||
if [[ "$gamePk" = 'null' ]]
|
||||
then
|
||||
echo "$0:" 'no live games found' >&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/' | writedb.sh -d $db -t mlbdata -c ''
|
||||
mlblive subscribe -g $gamePk | jq -Sc --unbuffered "$jqFilter" | sed -u 's/$/0/' | split -l 1 --filter="sqlite3 $db '.mode ascii' '.separator ' '.import /dev/stdin mlbdata'"
|
||||
|
|
BIN
writedb.sh
BIN
writedb.sh
Binary file not shown.
Loading…
Reference in New Issue