From a69b02c7120c7bcfea8adfc322508033c82a602a Mon Sep 17 00:00:00 2001 From: filifa Date: Sat, 3 Aug 2024 17:35:08 -0500 Subject: [PATCH] update table names --- mlbhighlightsave.sh | 2 +- mlbplaysave.sh | 2 +- posthighlights.sql | 4 ++-- postplays.sql | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mlbhighlightsave.sh b/mlbhighlightsave.sh index 6779098..714788d 100755 --- a/mlbhighlightsave.sh +++ b/mlbhighlightsave.sh @@ -43,4 +43,4 @@ fi # grab select data from response with jq, add 0 to the end of each line (to go # in the 'posted' db column), then write each line to db jqFilter='.highlights.highlights.items | map(select(.keywordsAll[].value == "highlight"))[] | {headline, id} + {url: (.playbacks | map(select(.name == "mp4Avc"))[0].url)} | select(.url | startswith("https://mlb-cuts-diamond"))' -mlblive content -g $gamePk | jq -Sc "$jqFilter" | sed 's/$/0/' | sqlite3 $db '.mode ascii' '.separator  \n' '.import /dev/stdin mlbdata' +mlblive content -g $gamePk | jq -Sc "$jqFilter" | sed 's/$/0/' | sqlite3 $db '.mode ascii' '.separator  \n' '.import /dev/stdin highlights' diff --git a/mlbplaysave.sh b/mlbplaysave.sh index bc14061..bfa18fb 100755 --- a/mlbplaysave.sh +++ b/mlbplaysave.sh @@ -42,7 +42,7 @@ fi jqFilter='{gamePk} + (.gameData.teams | {awayTeam: .away.teamName, homeTeam: .home.teamName}) + (.liveData.plays.allPlays[] | (.result + (.about | {atBatIndex, halfInning, inning, isComplete, isScoringPlay, hasReview})))' fmt='OFS=""; print $0, 0' -save="\"sqlite3 $db '.mode ascii' '.separator ' '.import /dev/stdin mlbdata'\"" +save="\"sqlite3 $db '.mode ascii' '.separator ' '.import /dev/stdin plays'\"" # grab select data from each response with jq, add 0 to the end of each line # (to go in the 'posted' db column), then write each line as they come in to db diff --git a/posthighlights.sql b/posthighlights.sql index c8c434a..f095401 100644 --- a/posthighlights.sql +++ b/posthighlights.sql @@ -5,12 +5,12 @@ select json ->> 'headline', json ->> 'id', json ->> 'url' -from mlbdata +from highlights where json ->> 'url' is not null and posted = 0; -update mlbdata +update highlights set posted = 1 where posted = 0; commit; diff --git a/postplays.sql b/postplays.sql index 2a3cc05..7222670 100644 --- a/postplays.sql +++ b/postplays.sql @@ -9,13 +9,13 @@ json ->> 'awayTeam', json ->> 'awayScore', json ->> 'homeTeam', json ->> 'homeScore' -from mlbdata +from plays where json ->> 'description' is not null and json ->> 'isScoringPlay' = 1 and posted = 0; -update mlbdata +update plays set posted = 1 where posted = 0; commit;