View Single Post
Old 03-13-2024, 04:15 PM   #63
neil_swann80
0000000000101010
neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.
 
neil_swann80's Avatar
 
Posts: 5,314
Karma: 10101011
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
This should work across multiple reading profiles:
(and if you've never setup additional profiles)

Code:
local h1 = io.popen('test=$(readlink -f /mnt/ext1/system/profiles/.current); if [ $? != 0 ]; then echo "default"; else echo ${test##*/}; fi')
local h2 = h1:read('*a')
local profile_name = h2:gsub('[\n\r]', '')
h1:close()
local stmt = pocketbookDbConn:prepare("SELECT id FROM profiles WHERE name = ?")
local temp_id = stmt:reset():bind(profile_name):step()
stmt:close()
local profile_id = temp_id[1]
local sql = [[
	REPLACE INTO books_settings
	(bookid, profileid, cpage, npage, completed, opentime)
		VALUES (?, ?, ?, ?, ?, ?)
]]
local stmt = pocketbookDbConn:prepare(sql)
stmt:reset():bind(book_id, profile_id, data.page, data.totalPages, data.completed, data.time):step()
stmt:close()
EDIT: Zip removed. Latest improved version HERE

Last edited by neil_swann80; 03-31-2024 at 12:47 PM.
neil_swann80 is offline   Reply With Quote