Update calibre.lua
This commit is contained in:
16
calibre.lua
16
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user