From c8ffa6722ef948879fa6ed9642ad134a2193fa4b Mon Sep 17 00:00:00 2001 From: Joris Date: Tue, 12 Sep 2023 22:45:16 +0200 Subject: Write metadata in TOML --- bin/get-books | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/get-books b/bin/get-books index d3ac0f6..1c9bf67 100755 --- a/bin/get-books +++ b/bin/get-books @@ -11,13 +11,14 @@ fi echo "const bookLibrary = [" -for METADATA in $(find "$BOOK_DIR" -name 'metadata.json'); do +for METADATA in $(find "$BOOK_DIR" -name 'metadata.toml'); do DIR=$(dirname "$METADATA") COVER=$(ls $DIR/cover.*) - cat "$METADATA" | head -n -1 - echo ", \"cover\": \"$COVER\"" - echo "}," + TOML=$(cat "$METADATA") + WITH_COVER=$(echo -e "$TOML\ncover = \"$COVER\"") + echo "$WITH_COVER" | toml2json + echo "," done echo "]" -- cgit v1.2.3