From a110c200e86d2325af07167531fac0f61d9681a0 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Fri, 26 Dec 2025 18:41:26 +0100 Subject: Switch to GUI to manage the library Allow to regroup the CLI and the view into one unique tool. --- bin/migrate/1-read-status | 19 ------------------- bin/migrate/2-compress-covers | 27 --------------------------- 2 files changed, 46 deletions(-) delete mode 100755 bin/migrate/1-read-status delete mode 100755 bin/migrate/2-compress-covers (limited to 'bin/migrate') 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) -- cgit v1.2.3