From a9fe0fbad615d49d5559c6a6a52518a1368b87a1 Mon Sep 17 00:00:00 2001 From: filifa Date: Sun, 11 May 2025 19:55:01 -0400 Subject: [PATCH] update name of mlbstats --- README.md | 6 +++--- games/mlbgames.sh | 2 +- highlights/mlbhighlightsave.sh | 2 +- plays/mlbplaysave.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index abbadcb..f53aca3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# mlblive-mastodon-scripts +# mlbstats-mastodon-scripts This repo contains some scripts to help automate posting live MLB game updates to Mastodon. @@ -23,7 +23,7 @@ These are used as delimiters when processing the data. ## How to use ### Dependencies To run these scripts, you'll need a few other programs: -* [mlblive](https://scm.dairydemon.net/filifa/mlblive), another program I wrote +* [mlbstats](https://scm.dairydemon.net/filifa/mlbstats), another program I wrote for retrieving data from MLB's Stats API * `toot`, a CLI program for Mastodon * `jq`, a program for processing JSON data @@ -38,7 +38,7 @@ scripts: 1. Put all the shell scripts somewhere convenient (I put them in `~/.local/bin`). 2. Pick a directory to keep the SQLite database in (I picked - `~/.local/share/mlblive`). + `~/.local/share/mlbstats`). 3. Create the database with `sqlite3 < schema.sql` * I recommend making one database for plays and one for highlights (assuming you wish to process both) for each team you want to follow. diff --git a/games/mlbgames.sh b/games/mlbgames.sh index aa90e10..970bc5b 100755 --- a/games/mlbgames.sh +++ b/games/mlbgames.sh @@ -32,4 +32,4 @@ fi jqFilter='.dates[].games[]' fmt="OFS=\"\"; print \$0, 0" save="\"sqlite3 $db '.mode ascii' '.separator ' '.import /dev/stdin games'\"" -mlblive schedule -t $team | jq -Sc "$jqFilter" | awk -F  "{$fmt | $save; close($save)}" +mlbstats schedule -t $team | jq -Sc "$jqFilter" | awk -F  "{$fmt | $save; close($save)}" diff --git a/highlights/mlbhighlightsave.sh b/highlights/mlbhighlightsave.sh index 0a5df96..c06f4f6 100755 --- a/highlights/mlbhighlightsave.sh +++ b/highlights/mlbhighlightsave.sh @@ -33,4 +33,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 highlights' +mlbstats content -g $gamePk | jq -Sc "$jqFilter" | sed 's/$/0/' | sqlite3 $db '.mode ascii' '.separator  \n' '.import /dev/stdin highlights' diff --git a/plays/mlbplaysave.sh b/plays/mlbplaysave.sh index 2b95c70..04743b9 100755 --- a/plays/mlbplaysave.sh +++ b/plays/mlbplaysave.sh @@ -37,4 +37,4 @@ 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 -mlblive subscribe -g $gamePk | jq -Sc "$jqFilter" | awk "{$fmt | $save; close($save)}" +mlbstats subscribe -g $gamePk | jq -Sc "$jqFilter" | awk "{$fmt | $save; close($save)}"