use flag for $db
This commit is contained in:
parent
3c3a6062d1
commit
0342594993
19
content.sh
19
content.sh
|
@ -2,9 +2,12 @@
|
|||
|
||||
set -e
|
||||
|
||||
while getopts 't:' opt
|
||||
while getopts 'd:t:' opt
|
||||
do
|
||||
case $opt in
|
||||
d)
|
||||
db=$OPTARG
|
||||
;;
|
||||
t)
|
||||
team=$OPTARG
|
||||
;;
|
||||
|
@ -14,17 +17,17 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
if [[ -z $db ]]
|
||||
then
|
||||
echo "$0:" '-d is required' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gamePk=$(./livepk.sh -t $team)
|
||||
if [[ -z $gamePk || "$gamePk" = 'null' ]]
|
||||
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/' | ./writedb.sh -d $DB -t highlights -c ''
|
||||
mlblive content -g $gamePk | jq -Sc --unbuffered "$jqFilter" | sed -u 's/$/0/' | ./writedb.sh -d $db -t highlights -c ''
|
||||
|
|
18
postplays.sh
18
postplays.sh
|
@ -2,10 +2,22 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [[ -z $DB ]]
|
||||
while getopts 'd:' opt
|
||||
do
|
||||
case $opt in
|
||||
d)
|
||||
db=$OPTARG
|
||||
;;
|
||||
?)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z $db ]]
|
||||
then
|
||||
echo "$0:" '$DB not set' >&2
|
||||
echo "$0:" '-d is required' >&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}'
|
||||
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}'
|
||||
|
|
19
subscribe.sh
19
subscribe.sh
|
@ -2,9 +2,12 @@
|
|||
|
||||
set -e
|
||||
|
||||
while getopts 't:' opt
|
||||
while getopts 'd:t:' opt
|
||||
do
|
||||
case $opt in
|
||||
d)
|
||||
db=$OPTARG
|
||||
;;
|
||||
t)
|
||||
team=$OPTARG
|
||||
;;
|
||||
|
@ -14,17 +17,17 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
if [[ -z $db ]]
|
||||
then
|
||||
echo "$0:" '-d is required' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gamePk=$(./livepk.sh -t $team)
|
||||
if [[ -z $gamePk || "$gamePk" = 'null' ]]
|
||||
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/' | ./writedb.sh -d $DB -t playinfo -c ''
|
||||
mlblive subscribe -g $gamePk | jq -Sc --unbuffered "$jqFilter" | sed -u 's/$/0/' | ./writedb.sh -d $db -t playinfo -c ''
|
||||
|
|
Loading…
Reference in New Issue