From 972a6226a256ff49eb60a4245e9ad97c5036d6b1 Mon Sep 17 00:00:00 2001 From: filifa <filifa.breath652@8alias.com> Date: Sun, 4 Aug 2024 14:54:43 -0500 Subject: [PATCH] also write the whole json --- mlbgames.sh | 8 ++++---- schema.sql | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mlbgames.sh b/mlbgames.sh index c20927e..c04965d 100755 --- a/mlbgames.sh +++ b/mlbgames.sh @@ -29,7 +29,7 @@ then exit 1 fi -jqFilter='.dates[].games[] | "\(.gamePk),\(.status.detailedState)"' -fmt="OFS=\",\"; print \$1, \"$team\", \$2, 0" -save="\"sqlite3 $db '.import --csv /dev/stdin games'\"" -mlblive schedule -t $team | jq -r "$jqFilter" | awk -F , "{$fmt | $save; close($save)}" +jqFilter='.dates[].games[] | "\(.gamePk)\(.status.detailedState)\(.)"' +fmt="OFS=\"\"; print \$1, \"$team\", \$2, \$3, 0" +save="\"sqlite3 $db '.mode ascii' '.separator ' '.import /dev/stdin games'\"" +mlblive schedule -t $team | jq -r "$jqFilter" | awk -F "{$fmt | $save; close($save)}" diff --git a/schema.sql b/schema.sql index f7a9d51..cbeda8a 100644 --- a/schema.sql +++ b/schema.sql @@ -20,6 +20,7 @@ create table if not exists games ( gamePk integer, teamId text, state text, + json text, posted integer, unique (teamId, gamePk) on conflict ignore );