initial commit
This commit is contained in:
commit
6f25185b92
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
gamePk=$(./livepk.sh)
|
||||
if [[ "$gamePk" = 'null' ]]
|
||||
then
|
||||
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'"
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
# grab most recently started live pk, if multiple
|
||||
echo $(mlblive schedule -t $TEAM | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk')
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
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}'
|
|
@ -0,0 +1,19 @@
|
|||
.separator
|
||||
|
||||
begin;
|
||||
select
|
||||
json ->> 'description',
|
||||
json ->> 'halfInning',
|
||||
json ->> 'inning',
|
||||
json ->> 'awayTeam',
|
||||
json ->> 'awayScore',
|
||||
json ->> 'homeTeam',
|
||||
json ->> 'homeScore'
|
||||
from playinfo
|
||||
where
|
||||
json ->> 'description' is not null and
|
||||
json ->> 'isScoringPlay' = 1 and
|
||||
posted = 0;
|
||||
|
||||
-- update posted here
|
||||
commit;
|
|
@ -0,0 +1,17 @@
|
|||
create table if not exists playinfo (
|
||||
"json" text unique on conflict ignore,
|
||||
"posted" integer check ("posted" in (0, 1))
|
||||
);
|
||||
|
||||
create index if not exists nonposted_playinfo
|
||||
on playinfo(posted)
|
||||
where posted = 0;
|
||||
|
||||
create table if not exists highlights (
|
||||
"json" text unique on conflict ignore,
|
||||
"posted" integer check ("posted" in (0, 1))
|
||||
);
|
||||
|
||||
create index if not exists nonposted_highlights
|
||||
on highlights(posted)
|
||||
where posted = 0;
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
gamePk=$(./livepk.sh)
|
||||
if [[ "$gamePk" = 'null' ]]
|
||||
then
|
||||
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