From 8a2b5bca0f49b8bbb884440439d9eea63d889f13 Mon Sep 17 00:00:00 2001 From: Tangent Date: Wed, 19 Nov 2025 07:40:40 +0000 Subject: [PATCH] Update calibre.lua --- calibre.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/calibre.lua b/calibre.lua index b27ced4..a5271a1 100644 --- a/calibre.lua +++ b/calibre.lua @@ -1,16 +1,17 @@ #!/usr/bin/env luajit +local pause_between_opens = false math.randomseed(os.time()) local books = { - read = 514, - unread = 2682, + read = 857, + unread = 3093, per_calibre_page = 6, } books.total = books.read + books.unread local ratings = { - 47, 51, 84, 76, 31 + 91, 130, 222, 158, 41 } local average_rating = (function() local count, rating = 0, 0 @@ -33,6 +34,11 @@ books.average_page_count = books.average_page_count * 0.75 -- so I guess I should do one more adjustment! books.average_page_count = books.average_page_count * (1 - 0.17) +-- 2025-11-19 +-- this was approximately 124.9, but a current estimate is 148.72 +books.average_page_count = 148.72 +print("Estimated average page count per book: " .. books.average_page_count) + local function to_calibre_pages(count) return math.ceil(count / books.per_calibre_page) end @@ -52,7 +58,9 @@ local function open_random_links(_type, count) for i = 1, count do local page_number = math.random(calibre_pages[_type]) os.execute("open \"" .. calibre_links[_type] .. page_number .. "\"") - os.execute("sleep 1") + if pause_between_opens then + os.execute("sleep 1") + end end end