aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJoris Guyonvarch2025-12-26 18:41:26 +0100
committerJoris Guyonvarch2025-12-27 20:41:44 +0100
commita110c200e86d2325af07167531fac0f61d9681a0 (patch)
tree90e843f915a2e153ba735849afd83710d90560bf /bin
parenta26d92ad5055fa057647158eb79511e7b1841162 (diff)
Switch to GUI to manage the library
Allow to regroup the CLI and the view into one unique tool.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dev-server28
-rwxr-xr-xbin/migrate/1-read-status19
-rwxr-xr-xbin/migrate/2-compress-covers27
-rwxr-xr-xbin/test4
4 files changed, 0 insertions, 78 deletions
diff --git a/bin/dev-server b/bin/dev-server
deleted file mode 100755
index 7351209..0000000
--- a/bin/dev-server
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-cd $(dirname "$0")/..
-
-if [ "$#" == 1 ]; then
- BOOKS_LIBRARY="$1"
-else
- echo "usage: $0 path-to-book-directory"
- exit 1
-fi
-
-# Watch books
-
-BUILD_BOOKS_CMD="echo \"const bookLibrary=\" > library/public/books.js && ./books library >> library/public/books.js && echo library/public/books.js updated."
-watchexec \
- --watch "$BOOKS_LIBRARY" \
- -- "$BUILD_BOOKS_CMD" &
-
-# Watch TypeScript
-
-cd library
-CHECK="echo -e 'Checking TypeScript…\n' && tsc --checkJs"
-BUILD="esbuild --bundle main.ts --target=es2017 --outdir=public"
-SHOW="echo -e '\nOpen $PWD/public/index.html'"
-watchexec \
- --clear \
- --watch client \
- -- "$CHECK && $BUILD && $SHOW"
diff --git a/bin/migrate/1-read-status b/bin/migrate/1-read-status
deleted file mode 100755
index 5f4b61d..0000000
--- a/bin/migrate/1-read-status
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-if [ "$#" == 1 ]; then
- BOOK_DIR="$1"
-else
- echo "usage: $0 path-to-book-directory"
- exit 1
-fi
-
-for FILE in $(find "$BOOK_DIR" -name 'metadata.json'); do
- METADATA=$(cat "$FILE")
- READ=$(echo "$METADATA" | jq .read)
- if [ "$READ" == "true" ]; then
- echo "$METADATA" | jq '.read = "Read"' > "$FILE"
- else
- echo "$METADATA" | jq '.read = "Unread"' > "$FILE"
- fi
-done
diff --git a/bin/migrate/2-compress-covers b/bin/migrate/2-compress-covers
deleted file mode 100755
index 0398689..0000000
--- a/bin/migrate/2-compress-covers
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env nix-shell
-#!nix-shell -i python3 -p python3Packages.pillow
-
-import PIL.Image
-import glob
-import os
-import sys
-
-if len(sys.argv) == 2 and os.path.exists(sys.argv[1]):
- book_directory = sys.argv[1]
-else:
- print(f'Usage: {sys.argv[0]} book-directory')
- exit(1)
-
-def compress(path):
- directory = os.path.dirname(os.path.realpath(path))
- image = PIL.Image.open(path)
- width, height = image.size
- if width > 300:
- image = image.resize((300, int(300 * height / width)), PIL.Image.LANCZOS)
- image = image.convert('RGB')
- image.save(f'{directory}/tmp.webp', 'WEBP', optimize=True, quality=85)
- os.remove(path)
- os.rename(f'{directory}/tmp.webp', f'{directory}/cover.webp')
-
-for path in glob.glob(f'{book_directory}/**/cover.*', recursive=True):
- compress(path)
diff --git a/bin/test b/bin/test
deleted file mode 100755
index cd6c0de..0000000
--- a/bin/test
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-cd "$(dirname $0)/.."
-python -m pytest