Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > PocketBook

Notices

Reply
 
Thread Tools Search this Thread
Old 10-20-2024, 05:55 AM   #1
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,887
Karma: 12981955
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
script to enable BT and launch audio apps

I use my PocketBook frequently to play audiobooks and occasionally to listen to MP3s (mainly background noise) whilst reading.
I regularly pair two different sets of BT headphones as well as my car stereo to the Pocketbook.
I find it cumbersome to use the PocketBook menu system to connect across these devices, so wrote a shell script to automate the procedure.
  • The script checks if BT is active, if not it will enable it.
  • The Bluetootth settings page is launched to allow a specific device to be paired.
  • A dialog box then prompts the user to launch the Audiobook or Media player app.
  • Once the audio app is closed, if the script enabled BT it will disable it.

Save the code below as a .app file in /mnt/ext1/applications if you'd like to try it. May need a device reboot before it shows in User's section of the app menu.
Spoiler:
Code:
#!/bin/sh
appDir=/ebrmain/cramfs/bin
BTstatus=$(netagent bt status | grep -o BT_STATE_OFF)
BTisPaired=/sys/class/bluetooth/hci0/hci0:1

if [ $BTstatus == BT_STATE_OFF ]; then initialBT=off; netagent bt on
else initialBT=on; fi

function onExit {
  if [ $initialBT == off ]; then netagent bt off; fi
}
trap onExit 0

function pairBT {
  $appDir/settings.app -o bluetooth
  if [ -d $BTisPaired ]; then :
  else pairBT_dialog; fi
}

function pairBT_dialog {
  $appDir/dialog 3 "" "No BT device connected!" "Try again" "Ignore" "Exit"; ans=$?
  if [ $ans == 2 ]; then :
  elif [ $ans == 3 ]; then exit
  else pairBT; fi
}

function startApps {
  $appDir/dialog 2 "" "Which Audio App?" "Audiobook" "MP3 Player" "Exit"; ans=$?
  if [ $ans == 1 ]; then $appDir/audio_books.app
  elif [ $ans == 2 ]; then $appDir/music_player.app
  elif [ $ans == 3 ]; then exit
  else startApps; fi
}

pairBT
startApps
exit

Last edited by neil_swann80; 10-23-2024 at 12:47 PM. Reason: Improved code
neil_swann80 is offline   Reply With Quote
Old 10-22-2024, 02:18 AM   #2
CrazyGriferman
Member
CrazyGriferman began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Oct 2024
Device: Pocketbook Verse Pro
Hi, thanks for your script
I want to ask for help about writing a script that achieves the following function:
1. Open the last opened book.
2. turn on bluetooth
3. pairing the headphone
4. entering tts mode and start to play

I have CS program but have little experience writing scripts in Linux environment. I am wondering if there is any documentation for this or if you could tell me how you find these api for toggling the interface of the pocketbook.
CrazyGriferman is offline   Reply With Quote
Advert
Old 10-22-2024, 09:37 AM   #3
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,887
Karma: 12981955
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
You can view the PocketBook Inkview APIs HERE
neil_swann80 is offline   Reply With Quote
Old 10-22-2024, 11:07 AM   #4
CrazyGriferman
Member
CrazyGriferman began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Oct 2024
Device: Pocketbook Verse Pro
Thanks for your reply. I did not see api related to TTS mode in that file. Does that mean that the tts could not be toggled by scripts?
CrazyGriferman is offline   Reply With Quote
Old 10-22-2024, 11:23 AM   #5
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,887
Karma: 12981955
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
Soz, try this newer SDK
neil_swann80 is offline   Reply With Quote
Advert
Old 10-26-2024, 02:35 AM   #6
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,887
Karma: 12981955
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
This command should launch the last opened book:
Code:
/ebrmain/cramfs/bin/eink-reader.app "$(head -n 1 /mnt/ext1/system/state/lastopen.txt)"
I'm not sure how or if TTS can be started by passing an additional argument.

I do see:
qml: openVoice
in the terminal output when I manually click on TTS in the reader app.
And when closing it:
close tts panel

Last edited by neil_swann80; 10-26-2024 at 06:44 AM.
neil_swann80 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable Wifi by script? kanataa Kobo Developer's Corner 6 08-07-2019 10:10 AM
how to enable usb audio driver on andriod 4.4 on KPW3? jsjcjsjc Kindle Developer's Corner 6 06-25-2017 05:12 AM
Launch script on sytem events arikfunke Kindle Developer's Corner 0 04-21-2012 03:46 AM
iLiad Launch file from script dedo iRex Developer's Corner 3 07-21-2009 04:32 AM


All times are GMT -4. The time now is 02:14 AM.


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