Skip to main content

A simple library and commandline tool to access EzShare WiFi SD Cards

Project description

What is it?

A python library and commandline tool to access and sync data from a ezShare WIFI SD Card.

asciicast

How to install?

    pip install ezshare

How to use the commandline?

The commandline is really dead simple. It allows to list the card contents (-l, --list) and download (-d, --download) files off the card. -r, --recursive makes these operations recursive.

The source can be either a file or a directory (specified with -d). The target directory is the current working directory, unless specified otherwise with -t option. The target can be either a file for single-file downloads, or a dir (ending with /)

When downloading directories recursively the behavior is as follows:

  • If the file doesn't exist on the local machine - create it and download

  • If the file exists but differs in size - assume a broken download and download it again

  • If the file exists and the size is the same as the remote - assume it's been already downloaded and skip it

There are also two weird, but most useful options:

  • -w, --wait - Ping the card until it's detected.
  • --live - Live mode.

See --help for up-to-date options. Typical usage examples are below.

~# ezshare-cli [-h] [-l LIST] [-d DOWNLOAD] [-r] [-t TARGET] [-w] [--live LIVE]

Unofficial ezShare cli tool

optional arguments:
  -h, --help            show this help message and exit
  -l LIST, --list LIST  List remote directory
  -d DOWNLOAD, --download DOWNLOAD
                        Download a remote file or directory
  -r, --recursive       Recurse to subdirs on list/download
  -t TARGET, --target TARGET
                        Specify target directory for downloads
  -w, --wait            Wait for WiFi SD to appear on the network
  --live LIVE           Live mode. Don't exit after syncronisation.The argument specifies cooldown in seconds
                        between sync. See docs for details

List card contents

In a single directory

$ ezshare-cli -l /
Listing remote directory: /
 DCIM/

or recursively

Listing remote directory: /
 DCIM/
  101CANON/
   IMG_0356.JPG
   IMG_0357.JPG

Download a single file to current directory

ezshare-cli -d /DCIM/101CANON/IMG_0356.JPG 
Synchronizing remote /DCIM/101CANON/IMG_0356.JPG -> .
./IMG_0356.JPG: 100%|██████████████████| 4.45M/4.45M [00:02<00:00, 1.71MB/s]

Download a single file to a custom destination

Synchronizing remote /DCIM/101CANON/IMG_0356.JPG -> /tmp/
/tmp/IMG_0356.JPG: 100%|███████████████| 4.45M/4.45M [00:02<00:00, 1.68MB/s]

Recursively download a directory

$ ezshare-cli -r -d / -t /tmp/SD_CONTENTS/
Synchronizing remote / -> /tmp/SD_CONTENTS/
/tmp/SD_CONTENTS/DCIM/101CANON/IMG_0356.JPG: 100%|███████████████| 4.45M/4.45M [00:05<00:00, 862kB/s]
/tmp/SD_CONTENTS/DCIM/101CANON/IMG_0357.JPG: 100%|███████████████| 2.86M/2.86M [00:02<00:00, 1.04MB/s]

Wait for the card connection and synchronize contents when the card is available

$ ezshare-cli -w -r -d / -t /tmp/SD_CONTENTS/
Waiting for ezShare card...ONLINE!
Synchronizing remote / -> /tmp/SD_CONTENTS/
/tmp/SD_CONTENTS/DCIM/101CANON/IMG_0356.JPG: 100%|███████████████| 4.45M/4.45M [00:05<00:00, 862kB/s]
/tmp/SD_CONTENTS/DCIM/101CANON/IMG_0357.JPG: 100%|███████████████| 2.86M/2.86M [00:02<00:00, 1.04MB/s]
0 ✓ necromant @ silverblade /tmp $ 

Continuous sync mode

Now this should be the most useful. In this mode the app pings the card until it's available, syncs the directories as specified, and sleeps for a timeout of seconds that is specified after the live option. You can specify the target directory in your nextcloud/dropbox/whatever directory and all the photos will automagically sync to the cloud as soon as you connect your card.

$ ezshare-cli -w -r -d / -t /tmp/SD_CONTENTS/ --live 10
Waiting for ezShare card.ONLINE!
Synchronizing remote / -> /tmp/SD_CONTENTS/
/tmp/SD_CONTENTS/DCIM/101CANON/IMG_0356.JPG: 100%|████████████████| 4.45M/4.45M [00:05<00:00, 904kB/s]
/tmp/SD_CONTENTS/DCIM/101CANON/IMG_0357.JPG: 100%|████████████████| 2.86M/2.86M [00:02<00:00, 1.08MB/s]
Live mode. Next sync in 10 seconds
Waiting for ezShare card.ONLINE!
Synchronizing remote / -> /tmp/SD_CONTENTS/
Skipping file /tmp/SD_CONTENTS/DCIM/101CANON/IMG_0356.JPG (same size)
Skipping file /tmp/SD_CONTENTS/DCIM/101CANON/IMG_0357.JPG (same size)
Live mode. Next sync in 10 seconds
...

Limitations

  • There's no way to actually remove or upload files to the card. This is the hardware limitation;

  • There's no way to make the card work in client mode or change the IP address. But you can work this around with an OpenWRT router. Check out my blog for a neat trick: TODO

Extra

Check out the docker-compose.yml and Dockerfile for an automated webdav uploader that I'm running. It's not yet up at dockerhub, but I plan to fix it soon.

The idea is simple:

  • Mount webdav via fuse inside the docker container,
  • Run the 'live' mode of ezshare,
  • Get all the photos delivered into your cloud file storage.
  • ...
  • PROFIT!

Changelog

v0.0.11 - bugfix release

  • Fixed handling empty dirs (#1). Thanks to @gustou.
  • Implement retry logic on buggy cards. Thanks to @dieu

v0.0.10 - initial release.

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

ezshare-0.0.11.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

ezshare-0.0.11-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file ezshare-0.0.11.tar.gz.

File metadata

  • Download URL: ezshare-0.0.11.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for ezshare-0.0.11.tar.gz
Algorithm Hash digest
SHA256 3e1e013d14195f65ac38cb961dd3ecc2e04ed64b2746706b4d50d6453a6f3ec2
MD5 63bc06fe8e0d722c5f603b243eaf2271
BLAKE2b-256 2f8eb4575bcbd265160339a247d6d156b31487f6f150015b5be4913b9501cb07

See more details on using hashes here.

File details

Details for the file ezshare-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: ezshare-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for ezshare-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 37c484dd247e4299591c0eb1604ed88fa36c55561dd5c315efd3872fe0d081b6
MD5 e1c773afd5f433a7fc4d296f3cfe6cfa
BLAKE2b-256 ca80b7a06472e90c01f65ec2c2130c3208cb360c53ba969b6f984cd8c7a285e3

See more details on using hashes here.

Supported by

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