Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-31-2022, 08:54 AM   #1
not_lucky_luke
Junior Member
not_lucky_luke began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jul 2022
Location: Italy
Device: Kobo Libra 2
How to share screenshots without USB connection

Hi everyone!

Do you know a workaround in order to easily share the screenshots I can take with my Kobo?

At the moment I need to connect the kobo to my pc using the USB cable but that's not very convenient. I thought of something like "KoboCloud" but that would work in a reverse way: it would share the file FROM the Kobo TO the Cloud.

Does anything like that exist?
Do you know other solutions to get the result I'm looking for?

Thanks in advance
not_lucky_luke is offline   Reply With Quote
Old 08-02-2022, 08:57 AM   #2
qkqw
Connoisseur
qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.
 
Posts: 58
Karma: 143000
Join Date: Apr 2022
Device: Kobo Libra 2
I don't know of any existing solution to this, but it shouldn't be too hard to create something like this. Let's suppose you're using Nextcloud/Owncloud, then you could create a share in which you allow uploads. Using curl (which is already included in KoboCloud) you can then upload any file to that share. To summarize:
  • Create public share allowing uploads
  • Use the udev-trick by KoboCloud to run your upload script
  • Add some logic to find your screenshots (Mostly look for /mnt/onboard/Screenshot*.png) files
  • Upload them using curl (comes down to something like curl -T $file -u "$FOLDERTOKEN":"$PASSWORD" "$CLOUDURL/$PUBSUFFIX/$file"

Hope this helps to get you going.
qkqw is offline   Reply With Quote
Advert
Old 08-02-2022, 09:06 AM   #3
Ned
Ebook reader
Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.
 
Ned's Avatar
 
Posts: 390
Karma: 5899335
Join Date: Oct 2008
Location: York, England
Device: Kobo Aura H2O (ed 2, v1), Kobo Forma, Kobo Libra 2
You're going to have to connect USB to charge the thing, so why not just transfer the screenshots then?
Ned is offline   Reply With Quote
Old 08-02-2022, 09:07 AM   #4
xyclonei
Connoisseur
xyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watchxyclonei is clearly one to watch
 
xyclonei's Avatar
 
Posts: 92
Karma: 10988
Join Date: Dec 2018
Device: Kobo Clara HD
You could try running an FTP server (with NickelMenu) on your Kobo device with which you could transfer those screenshots.
xyclonei is offline   Reply With Quote
Old 08-02-2022, 09:13 AM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,027
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Ned View Post
You're going to have to connect USB to charge the thing, so why not just transfer the screenshots then?
Most connect to a USB charger.
JSWolf is offline   Reply With Quote
Advert
Old 08-03-2022, 03:13 AM   #6
not_lucky_luke
Junior Member
not_lucky_luke began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jul 2022
Location: Italy
Device: Kobo Libra 2
Quote:
Originally Posted by qkqw View Post
I don't know of any existing solution to this, but it shouldn't be too hard to create something like this. Let's suppose you're using Nextcloud/Owncloud, then you could create a share in which you allow uploads. Using curl (which is already included in KoboCloud) you can then upload any file to that share. To summarize:
  • Create public share allowing uploads
  • Use the udev-trick by KoboCloud to run your upload script
  • Add some logic to find your screenshots (Mostly look for /mnt/onboard/Screenshot*.png) files
  • Upload them using curl (comes down to something like curl -T $file -u "$FOLDERTOKEN":"$PASSWORD" "$CLOUDURL/$PUBSUFFIX/$file"

Hope this helps to get you going.
Thank you for the idea.
Two days ago I wrote a bash script that I launch through NickelMenu. It checks the internet connection, looks for screenshots in the root directory and it uploads (it's supposed to, at least) to dropbox with curl and deletes them after that. I still have a problem I can't fix: curl throws me an error about some missing certificates. I've already tried to run curl with the
Code:
--cacert
flag and the certs found here but I'm still stuck with the same error.


Quote:
Originally Posted by Ned View Post
You're going to have to connect USB to charge the thing, so why not just transfer the screenshots then?
Quote:
Originally Posted by JSWolf View Post
Most connect to a USB charger.
Why don't I use a USB cable? Because I think it's not convenient looking for a cable and plug it in my pc when I simply want to share something I find interesting as fast as I can with one of the messaging apps I have on my smartphone.
Am I the only one with such a use case?
not_lucky_luke is offline   Reply With Quote
Old 08-03-2022, 03:42 AM   #7
Ned
Ebook reader
Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.Ned ought to be getting tired of karma fortunes by now.
 
Ned's Avatar
 
Posts: 390
Karma: 5899335
Join Date: Oct 2008
Location: York, England
Device: Kobo Aura H2O (ed 2, v1), Kobo Forma, Kobo Libra 2
Each to his own. Nothing implied, I was just trying to help.
By suggesting simply using a USB cable, I was applying Occam's principle of Do it the simple way. For me, but perhaps not for you, putting a lot of effort in to do it a way that I wouldn't find easier anyway, is pointless.
But then my iMac has a USB C and micro USB cable permanently connected so I would say that.
I don't do a lot of sharing, so think we oldies work differently from the way you youngsters do
Ned is offline   Reply With Quote
Old 08-03-2022, 05:36 AM   #8
not_lucky_luke
Junior Member
not_lucky_luke began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jul 2022
Location: Italy
Device: Kobo Libra 2
Quote:
Originally Posted by Ned View Post
Each to his own. Nothing implied, I was just trying to help.
By suggesting simply using a USB cable, I was applying Occam's principle of Do it the simple way. For me, but perhaps not for you, putting a lot of effort in to do it a way that I wouldn't find easier anyway, is pointless.
But then my iMac has a USB C and micro USB cable permanently connected so I would say that.
I don't do a lot of sharing, so think we oldies work differently from the way you youngsters do
I never thought you were implying anything against me

It's not an age-related thing, it's more about the where & when we read
not_lucky_luke is offline   Reply With Quote
Old 08-03-2022, 06:36 AM   #9
Uncle Robin
Diligent dilettante
Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.Uncle Robin ought to be getting tired of karma fortunes by now.
 
Uncle Robin's Avatar
 
Posts: 3,417
Karma: 48736498
Join Date: Sep 2019
Location: in my mind
Device: Kobo Sage; Kobo Libra H2O
Quote:
Originally Posted by not_lucky_luke View Post

Why don't I use a USB cable? Because I think it's not convenient looking for a cable and plug it in my pc when I simply want to share something I find interesting as fast as I can with one of the messaging apps I have on my smartphone.
Am I the only one with such a use case?
Even though I read almost exclusively at home and am never more than 5 metres from my PC when doing so, I share your pain I too would love to be able to share screenshots when I take them. I wonder if the bluetooth functionality in new Kobos might one day make this possible?
Uncle Robin is offline   Reply With Quote
Old 08-03-2022, 12:37 PM   #10
qkqw
Connoisseur
qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.
 
Posts: 58
Karma: 143000
Join Date: Apr 2022
Device: Kobo Libra 2
Quote:
Originally Posted by not_lucky_luke View Post
Thank you for the idea.
Two days ago I wrote a bash script that I launch through NickelMenu. It checks the internet connection, looks for screenshots in the root directory and it uploads (it's supposed to, at least) to dropbox with curl and deletes them after that. I still have a problem I can't fix: curl throws me an error about some missing certificates. I've already tried to run curl with the
Code:
--cacert
flag and the certs found here but I'm still stuck with the same error.
If you want to share your script here I can take a look at it!
qkqw is offline   Reply With Quote
Old 08-05-2022, 09:34 AM   #11
not_lucky_luke
Junior Member
not_lucky_luke began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jul 2022
Location: Italy
Device: Kobo Libra 2
Quote:
Originally Posted by qkqw View Post
If you want to share your script here I can take a look at it!
Sure! You can find it here: https://github.com/luke-gto/kobo-screenshot-uploader

I've decided to upload the screenshots to telegram because it's the messaging app I use the most.

At the moment the script has very few features (only one actually) but at least it does what I need. Feel free to suggest any improvements
not_lucky_luke is offline   Reply With Quote
Old 08-06-2022, 09:25 AM   #12
qkqw
Connoisseur
qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.
 
Posts: 58
Karma: 143000
Join Date: Apr 2022
Device: Kobo Libra 2
Quote:
Originally Posted by not_lucky_luke View Post
At the moment the script has very few features (only one actually) but at least it does what I need. Feel free to suggest any improvements
Your script looks alright. Your problem regarding the missing certificates is indeed that, AFAIK Kobo doesn't offer any certificates. So KoboCloud for example uses its own certificate bundle, see for example: https://github.com/fsantini/KoboClou...fig_kobo.sh#L7

If you have KoboCloud installed, you could just use their cert bundle, or download a bundle from the curl website: https://curl.se/docs/caextract.html - see also https://github.com/fsantini/KoboClou...ateCABundle.sh
qkqw is offline   Reply With Quote
Old 08-06-2022, 10:47 AM   #13
qkqw
Connoisseur
qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.
 
Posts: 58
Karma: 143000
Join Date: Apr 2022
Device: Kobo Libra 2
On a second note I've simplified your script and made it work with Nextcloud/Owncloud. It makes use of KoboCloud's curl and certificate bundle. I am not quite sure how to check for a connection, but wanted to use NickelMenu like this:

Code:
menu_item :main    :Sync Screenshots    :nickel_wifi     :autoconnect
  chain_success                         :cmd_spawn       :quiet:/mnt/onboard/.adds/sync/sync.sh
  chain_success                         :dbg_toast       :Syncing Screenshots

Code:
#!/bin/sh

SCREENSHOTS="/mnt/onboard"
KC_HOME="/usr/local/kobocloud"
CURL="$KC_HOME/curl --cacert $KC_HOME/ca-bundle.crt --fail --silent"
HEADER="X-Requested-With: XMLHttpRequest"
URL="[Your Nextcloud/Owncloud instance]/public.php/webdav"
USER="[Your Share]:"

for i in $(find $SCREENSHOTS -maxdepth 1 -type f -name "screen_*.png"); do
  DATE=$(date -r "$i" "+%Y-%m-%d-%H-%M-%S")
  $CURL -u "$USER" -H "$HEADER" -T "$i" "$URL/kobo-$DATE.png"
  if [ $? -eq 0 ]; then
    rm $i
  fi
done
Feedback welcome!
qkqw is offline   Reply With Quote
Old 08-06-2022, 11:56 AM   #14
not_lucky_luke
Junior Member
not_lucky_luke began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jul 2022
Location: Italy
Device: Kobo Libra 2
Quote:
Originally Posted by qkqw View Post
On a second note I've simplified your script and made it work with Nextcloud/Owncloud. It makes use of KoboCloud's curl and certificate bundle.
I'd rather not add kobocloud as a dependency here but I'll see how can I implement the cert-related "feature".

Btw, feel free to fork the repo and work on that Ah, why don't you open a pull request, I'd like to implement your version of the config file! Let me know how I can attribute the work to you.
Quote:
Originally Posted by qkqw View Post
I am not quite sure how to check for a connection, but wanted to use NickelMenu
Next thing I'm gonna do is implementing NickelMenu signals and slot. I want to have an option that lets the kobo to automatically connect to the wifi when the button for sharing the screenshot is pressed and then turn the wifi off.

Last edited by not_lucky_luke; 08-06-2022 at 12:00 PM.
not_lucky_luke is offline   Reply With Quote
Reply

Tags
cloud, kobo, screenshot, share


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
usb connection lumpynose Onyx Boox 1 04-28-2019 04:57 PM
Share kindle internet connection via usb maribu Kindle Developer's Corner 2 12-28-2014 11:06 AM
Kindle DXG -- share the computer's connection via USB? HansTWN Kindle Developer's Corner 1 01-20-2012 07:21 AM
Hacks Is it possible to share the 3G connection of Kindle via WiFi? palmtenor Amazon Kindle 12 12-05-2010 03:25 PM
USB Connection Kingston iRex 2 04-15-2008 09:36 AM


All times are GMT -4. The time now is 07:41 PM.


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