![]() |
#1 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 110
Karma: 3090
Join Date: Mar 2013
Location: Italy
Device: Kindle Paperwhite 3
|
Integrated units converter on kobo libra 2?
Hi everyone,
I have a kobo libra 2. I wanted to know if there is any way to add an integrated unit converter like feet to meters. There is any way to it? |
![]() |
![]() |
![]() |
#2 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 504
Karma: 2390534
Join Date: Jun 2020
Location: Somewhere in the Universe
Device: Kobo Libra, Glo HD, Touch C/B, Mini, Glo, Aura SE, Clara HD, KT
|
You could try to compile `qalc`from `libqalculate`and run it in the KOReader terminal
This one can convert units Code:
> 200ft to m 200 feet = 60.96 m > 200m to ft 200 meters ≈ 656 ft + 2.015748031 in > |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,801
Karma: 6990707
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
Hmm... it would be theoretically possible to extend the built-in search with libqalculate using NickelHook.
|
![]() |
![]() |
![]() |
#4 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
|
***
Or, just run a shell script like f2c.sh from the terminal: #!/mnt/onboard/.adds/koreader/luajit --f2c.lua print('*** Converting between the different temperature scales ***') print('1. Convert Celsius temperature into Fahrenheit') print('2. Convert Fahrenheit temperatures into Celsius') print('Select your choice (1-2) : ') choice = io.read('*n') if choice==tonumber("1") then print('Enter temperature (C) : ') tc = io.read('*n') -- formula Tf=(9/5)*Tc+32 tf=(9/5) * tc + 32 print('Temperature (F) = ', tf) elseif choice==tonumber("2") then print('Enter temperature (F) : ') tf = io.read('*n') -- formula Tc=(5/9)*(Tf-32) tc=(5/9)*(tf-32) print('Temperature (C) = ', tc) else print('Invalid choice') end *** Or, from NickelMenu: (requires NickelDBus . Add a NickelMenu entry to /mnt/onboard/.adds/nm/config.txt: Code:
menu_item :main :convert :cmd_spawn :quiet:exec /mnt/onboard/.adds/koreader/scripts/convert.sh chain_success :dbg_toast :Started convert chain_failure :dbg_toast :Error And a convert.sh script to /mnt/onboard/.adds/koreader/scripts/: Code:
#!/bin/sh # convert selection menu choice=0 qndb -m dlgConfirmCreate true qndb -m dlgConfirmSetTitle "1- Convert Celsius temperature into Fahrenheit; 2- Convert Fahrenheit temperatures into Celsius; Select option (1-2):" qndb -m dlgConfirmSetLEPlaceholder "1" qndb -m dlgConfirmShow result=$(qndb -s dlgConfirmTextInput) textIn=$(echo $result | sed 's/dlgConfirmTextInput //') choice=$(echo $textIn | sed 's/[^0-9]//g') if [ "$choice" == "1" ]; then tc=0 qndb -m dlgConfirmCreate true qndb -m dlgConfirmSetTitle "Enter temperature (C) : " qndb -m dlgConfirmSetLEPlaceholder "0" qndb -m dlgConfirmShow result=$(qndb -s dlgConfirmTextInput) textIn=$(echo $result | sed 's/dlgConfirmTextInput //') tc=$(echo $textIn | sed 's/[^0-9\-]//g') echo $tc tf=$(/mnt/onboard/.adds/koreader/luajit -e "print((9/5) * tonumber($tc) + 32)") qndb -m mwcToast 3000 "Temperature (F) = $tf" elif [ "$choice" == "2" ]; then tf=0 qndb -m dlgConfirmCreate true qndb -m dlgConfirmSetTitle "Enter temperature (F) : " qndb -m dlgConfirmSetLEPlaceholder "0" qndb -m dlgConfirmShow result=$(qndb -s dlgConfirmTextInput) textIn=$(echo $result | sed 's/dlgConfirmTextInput //') tf=$(echo $textIn | sed 's/[^0-9\-]//g') tc=$(/mnt/onboard/.adds/koreader/luajit -e "print((5/9)*(tonumber($tf)-32))") qndb -m mwcToast 3000 "Temperature (C) = $tc" else qndb -m mwcToast 3000 "You selected an invalid option" fi qndb -m mwcToast 1000 "${fberr:-"Bye!"}" *** Or, make an rmkit Simple App Script: https://www.mobileread.com/forums/sh...d.php?t=356282 Modify the /mnt/onboard/.adds/rmkit/bin/apps/menu.sh to: Code:
while true; do app=" textinput 250 100 200 50 label 250 200 200 50 you entered: ${temp} button 150 400 200 50 c2f button 350 400 200 50 f2c label 250 600 200 50 you clicked: ${option} [paragraph 250 800 500 500 Result = ${output}] " echo "APP IS" echo "${app}" option=`echo "${app}" | /mnt/onboard/.adds/rmkit/bin/apps/simple | grep 'selected:' | sed 's/selected: //'` temp=`echo "${app}" | /mnt/onboard/.adds/rmkit/bin/apps/simple | grep 'input:' | sed 's/input: //'` if (${option} == "c2f") then output=`/mnt/onboard/.adds/koreader/luajit -e "print((9/5) * tonumber(${temp}) + 32 + ' C')"` fi if (${option} == "f2c") then output=`/mnt/onboard/.adds/koreader/luajit -e "print((5/9)*(tonumber(${temp}))-32 + ' F')"` fi sleep 0.1 done UPDATE : Now working! https://www.mobileread.com/forums/sh...57&postcount=8 *** ***BEST SOLUTION*** But why all that if you can just: From: https://koreader.rocks/user_guide/ Search: https://github.com/search?q=koplugin&type=repositories * Edit: on second thought, is unvetted github content becoming a security concern? (re malware found.) Find: https://github.com/zwim/calculator.koplugin zwim/calculator.koplugin $ wget https://github.com/zwim/calculator.k...ugin-1.2.0.zip Install: calculator.koplugin A calculator plugin for KOReader. Installation: Go to https://github.com/zwim/calculator.koplugin/releases and download the desired koreader.plugin-x.x.x.zip and unpack it to koreader/plugins/calculator.koplugin. Predefined physical constants, are in init.calc. You can autoload them (see settings menu). If you don't need them delete init.calc. Usage: You find the calculator in More tools/calculator additionally you can set a gesture (in the device submenu) to call it. *** Last edited by elinkser; 02-15-2024 at 07:22 PM. Reason: rmkit script working |
![]() |
![]() |
![]() |
#5 | |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,506
Karma: 26047190
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
|
There IS something to be said about getting an actual endorsement of a plugin from a subject matter expert like NiLuJe, as opposed to finding something on github using a keyword search, esp. now that we have reports of malware on github.
Even open source is not quite transparent to those of us who don't do lua, whereas I would be surprised if NiLuJe was capable of encountering a KOReader plugin without impulsively doing at least a cursory check. (I suspect InkBox wouldn't allow the plugin to execute at all unless the dev got an explicit endorsement via a key. Though they do provide a built-in calc app, as NiMa modestly restrained himself from pointing out.) So chaotic freedom vs walled garden? Android vs iPhone all over again? |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
NickelMenu: An integrated launcher for Kobo eReaders | geek1011 | Kobo Reader | 1498 | 04-08-2025 06:17 PM |
Forma or Libra -- Current State of these units? (I want one) | jgbout | Kobo Reader | 35 | 03-05-2021 06:47 PM |
Kobo Libra H20 vs Kobo Clara HD vs Pocketbook Touch HD3 | cm1 | Which one should I buy? | 28 | 01-27-2021 01:18 PM |
Transferring books from Kobo Aura H2O to Kobo Libra H20 | gfeps | Kobo Reader | 16 | 09-24-2020 01:45 AM |
Mini New Kobo Mini on sale (old demo units, actually) | peitsao | Kobo Reader | 135 | 03-19-2016 10:19 AM |