Skip to main content
# kcb

Python helper to execute bash scripts inside KDEConnect's sshfs mount.
The main motivation behind this helper is to backup my
smartphone's photos and Whatsapp folders with a single command
and without resorting to a file manager.
The approach however allows a whole range of possible use cases.


## Installation and configuration

```
pip3 install --user kcb
mkdir ~/.config/kcb
wget https://raw.githubusercontent.com/ReSqAr/kcb/master/Documentation/Examples/My%20Smartphone.sh -O ~/.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.
Here `PHONENAME` is a placeholder for the KDEConnect phone name
and phones without a corresponding bash script are ignored.
These scripts can assume that they are run in the phone's sftp mount point,
i.e. the folders `DCIM`, `Downloads`, `Android`, etc are actually directly visible.
One should note that the connection can drop,
hence the bash script must be sufficiently resilient to avoid tears.


### Example bash scripts

The following is a sample bash script which backups the photo folder, OSMAnd's GPS tracks and the WhatsApp folder to the local `~/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
or - however use that at your own peril - by running the `pip3` command as `root`.

Regarding the command line parameters of `kcb`,
you can run `kcb` without any parameters
in which case all bash scripts of all phones which are online 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`.

- `kcb OnePlus` executes just `OnePlus.sh` (if it exists)
- `kcb "Samsung S8"` executes just `Samsung S8.sh` (if it exists)
- `kcb` executes both shell scripts (if they exist)
- `kcb OnePlus "Samsung S8"` executes both shell scripts (if they exist)

## License

Released under the [GPL 3](https://opensource.org/licenses/GPL-3.0).

## Contact

For bug reports please use the GitHub bug tracker.
I would love to hear from you about your thoughts/use cases/etc,
just drop me a line via `yasin.zaehringer-kcb@yhjz.de`.



Metadata

Release files for kcb 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kcb 0.9.3
File Size Uploaded Provenance Actions
kcb-0.9.3.tar.gz 6.7 kB Without provenance Details for kcb-0.9.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kcb 0.9.3
File Interpreter ABI Platform Actions
kcb-0.9.3-py3-none-any.whl Python 3 none any Details for kcb-0.9.3-py3-none-any.whl

Total release size: 16.6 kB

Release files / kcb-0.9.3.tar.gz

Download URL kcb-0.9.3.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bae59e4c9d2d442be07f9e9a93931fc3c28ffdfbbb128cde2bb091c15956d5be
BLAKE2b-256 checksum
How to use checksums
90e402c6e9c36bdd0f3664ab9d7974d3dcb94b8aa5dc45d3c56cc2a8b198b6ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.7

Release files / kcb-0.9.3-py3-none-any.whl

Download URL kcb-0.9.3-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25e6b3837edd3fb0710e840b7e3cdd7716889d2f0621ebecd2a403a9b3c61e39
BLAKE2b-256 checksum
How to use checksums
d4927dbb8835a69fe98c0ad9c6dd0b3fc1b2249ebb0b7a769efa4584d3f91b39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.7

Security for kcb 0.9.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page