update name of mlbstats
This commit is contained in:
parent
120604c131
commit
a9fe0fbad6
|
@ -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 <filename> < 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.
|
||||
|
|
|
@ -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)}"
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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)}"
|
||||
|
|
Loading…
Reference in New Issue