From 98301a0861d5532b2d6582ad5fe405da76b5e4c0 Mon Sep 17 00:00:00 2001 From: filifa Date: Wed, 31 Jul 2024 21:42:56 -0500 Subject: [PATCH] add comments --- mlbhighlightpost.sh | 4 ++-- mlbplaypost.sh | 1 + mlbplaysave.sh | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mlbhighlightpost.sh b/mlbhighlightpost.sh index cc4232e..a2222dc 100755 --- a/mlbhighlightpost.sh +++ b/mlbhighlightpost.sh @@ -30,8 +30,8 @@ then fi # summary of what these variables do in the awk script: -# get: download the highlight's url, and wait until it is downloaded before -# continuing +# get: download the highlight from its url, and wait until it is downloaded +# before continuing # fmt: print the text of the post # post: use toot to post the text and the downloaded highlight (also wait until # the toot is posted before continuing) diff --git a/mlbplaypost.sh b/mlbplaypost.sh index 5bc2cc8..4fd4fa7 100755 --- a/mlbplaypost.sh +++ b/mlbplaypost.sh @@ -29,6 +29,7 @@ then exit 1 fi +# format each row of data retreived from the select statement and pipe to toot fmt='printf "%s\n\n%s %s\n#%s %s\n#%s %s\n\n#baseball #live\n", $1, $2, $3, $4, $5, $6, $7' post="toot post --using $account" sqlite3 $db < postplays.sql | awk -F  "{$fmt | \"$post\"}" diff --git a/mlbplaysave.sh b/mlbplaysave.sh index 6a711db..ac4f121 100755 --- a/mlbplaysave.sh +++ b/mlbplaysave.sh @@ -37,5 +37,7 @@ then exit 1 fi +# 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 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 mlbdata'"