Skip to main content

KDE Connect bash helper

Project description

kcb

Execute bash scripts on top of KDEConnect's sftp mount

Installation and configuration

pip3 install --user kcb
mkdir .config/kcb
cp https://raw.githubusercontent.com/ReSqAr/kcb/master/Documentation/Examples/My%20Smartphone.sh .config/kcb/PHONENAME.sh
chown u+x .config/kcb/PHONENAME.sh
pico .config/kcb/PHONENAME.sh

One has to repeat the last three lines such that in the end the local .config/kcb/ folder contains bash scripts for all phones, where PHONENAME is a placeholder for the KDEConnect phone name. These scripts can assume that they are run in the sftp mount point, i.e. the folders DCIM, Downloads, Android, etc are actually are directly visible.

Example bash scripts

The following is a sample bash script which backups the photo folder, OSMAnd's GPS tracks and the WhatsApp folder to ~/MySmartphone folder.

set -x

TARGET="~/MySmartphone"

echo "file listing"
ls

echo "GPS Tracks"
rsync --human-readable --progress --archive --ignore-existing --itemize-changes --prune-empty-dirs "Android/data/net.osmand.plus/files/tracks/rec/" "$TARGET/GPS Tracks/"

echo "WhatsApp"
rsync --human-readable --progress --archive --ignore-existing --itemize-changes --prune-empty-dirs "WhatsApp/" "$TARGET/WhatsApp/"

echo "Photos"
rsync --human-readable --progress --archive --ignore-existing --itemize-changes --prune-empty-dirs "DCIM/Camera/" "$TARGET/"

Usage

Since we installed the kcb executable in ~/.local/bin/, we start the application via ~/.local/bin/kcb. There are multiple ways around that, i.e. being able to just type kcb; one could add ~/.local/bin to the $PATH variable for example.

Regarding the command line parameters of kcb, you can run kcb without any parameters in which case all bash scripts of online phones are executed. Or you can list the names of the devices whose bash scripts should be executed.

Example usage

Assume that KDE Connect knows two smartphones named OnePlus and Samsung S8.

  • .local/bin/kcb OnePlus executes just OnePlus.sh (if it exists)
  • .local/bin/kcb "Samsung S8" executes just Samsung S8.sh (if it exists)
  • .local/bin/kcb executes both shell scripts (if they exist)
  • .local/bin/kcb OnePlus "Samsung S8" executes both shell scripts (if they exist)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kcb-0.9.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kcb-0.9.2-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file kcb-0.9.2.tar.gz.

File metadata

  • Download URL: kcb-0.9.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for kcb-0.9.2.tar.gz
Algorithm Hash digest
SHA256 ec7ab3cb316bc7d69bcba11fcc0575cb990517c67fcde1b922e98317803ac582
MD5 2d050f49fb50cc34966515437df4a532
BLAKE2b-256 f936ee0c71fe9be2ea9ea1f71e5fa5843ffb473f8dfd3a7a5f0673406e274908

See more details on using hashes here.

File details

Details for the file kcb-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: kcb-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for kcb-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89620a35aa5e2471924e519a986913537769ff59a928e1078a164cd7114c1d2b
MD5 7018cc3430dbf95ee339d7d836b243a5
BLAKE2b-256 d8ae827a67a2c040c6e267a3333941d0ae946d367b87953f8837eed807b8410e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page