View Single Post
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