Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > PocketBook > PocketBook Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 05-18-2023, 03:07 PM   #1
phaeri
Junior Member
phaeri began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2013
Device: Pocketbook lux 4
Lightbulb Programming app for pocketbook advice

Help, I have pocketbook lux 4, I know java but I'm willing to learn C for this.
I really really really want to have a function which allows me to randomly open a book in my library. For those moments when I can't decide what to read among my 200 ebooks.

First, Is this doable? As in, what are the limits of the apps.
Second, where can I find actual documentation. What I find is like 10 years old, so not sure I can use on lux 4.

Seeing how active this forum is, thought I might ask here. I did find some recent github projects but not sure if i can program something that has access to the library.
phaeri is offline   Reply With Quote
Old 05-18-2023, 06:10 PM   #2
EastEriq
Groupie
EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!
 
Posts: 180
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
Speaking off the head without looking into, but I have the impression that for that a shell script in the applications/ directory should be easier to put together than a compiled executable linked with whatever sdk. Like in, count all the *.epub files in candidate directories, pick the $RANDOM-th pathname, and call the reader app with that as argument. Of course there might be fancier or obscurer ways, like querying the native book database.
EastEriq is offline   Reply With Quote
Old 05-18-2023, 08:59 PM   #3
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
Shell script is easiest way to go

Some psedo code(not tested just how I would approach it)

#!/bin/sh
#Get connection to DB and select the count of book IDs
declare -a numOfBooks=$(sqlite3 /system/explorer-3/exlplorer-3.db "SELECT ID FROM BOOKS_IMPL")

#Use random to get an ID
size=${#numOfBooks[@]}
randomBookID=$(($RANDOM % $size))

#Somehow, invoke reader program to open the ID
jrw174 is offline   Reply With Quote
Old 05-19-2023, 02:08 AM   #4
phaeri
Junior Member
phaeri began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2013
Device: Pocketbook lux 4
that is a great starting point! thank you! I will experiment a bit!
phaeri is offline   Reply With Quote
Old 05-19-2023, 01:32 PM   #5
dmalinovsky
Connoisseur
dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.dmalinovsky ought to be getting tired of karma fortunes by now.
 
Posts: 65
Karma: 388296
Join Date: Aug 2022
Location: USA
Device: Pocketbook Inkpad Color 3
Quote:
Originally Posted by phaeri View Post
I really really really want to have a function which allows me to randomly open a book in my library. For those moments when I can't decide what to read among my 200 ebooks.
I have similar problem choosing a random book to read but I went the other way using book tracking websites like GoodReads or StoryGraph. They both allow to sort items in the random order.

It sound like an overkill but this way you can also populate your to-read list.
dmalinovsky is offline   Reply With Quote
Old 05-20-2023, 05:40 PM   #6
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
See my GitHub link for a sample shell script I made that interacts with the databases for a better idea than the pseudo code I wrote above.

https://github.com/jjrrw174/PocketBo...ith-PB-Library
jrw174 is offline   Reply With Quote
Old 05-21-2023, 07:28 PM   #7
imustafin
Member
imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.imustafin knows how to set a laser printer to stun.
 
Posts: 13
Karma: 95478
Join Date: Mar 2022
Device: Pocketbook X (1040), Pocketbook 602 pro
If you really want to learn some C or C++ you still can!

Not much has changed and the "10 years old" documentation is pretty relevant today. I found the code examples from https://github.com/pmartin/pocketbook-demo/tree/master very helpful. For the SDK usage, I followed https://github.com/Skeeve/SDK_6.3.0.

I guess it should be possible to connect to PB's sqlite databases similarly to the scripts from this thread.

Also, there are some projects allowing you to write programs in other languages:
imustafin is offline   Reply With Quote
Old 07-19-2024, 07:49 AM   #8
Biep
Enthusiast
Biep began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jun 2018
Device: Tobo Touch 2.0; Kobo Aura One; PocketBook Era
KOReader is mostly in Lua - and that runs on PocketPooks.
You could just copy the code they use for invoking Lua, and then write in that.
Biep is offline   Reply With Quote
Reply

Tags
programming, random book


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sync Pocketbook eReader with Pocketbook Android App duskwind PocketBook 13 04-01-2020 05:00 PM
PocketBook Basic 2 Screen Advice Staphoent PocketBook 5 10-30-2014 02:21 PM
App advice for a newbie? ryublu Android Devices 23 08-28-2011 06:30 AM
Need advice from Pocketbook 902 Users Anthony.h80 Which one should I buy? 2 08-14-2011 06:22 AM
Android Interested in Developing an Android App, but Deficient in Programming Skills? walt526 enTourage Archive 6 07-13-2010 12:49 PM


All times are GMT -4. The time now is 05:43 AM.


MobileRead.com is a privately owned, operated and funded community.