whoozle / android-file-transfer-linux

Android File Transfer for Linux (and macOS!)
http://whoozle.github.io/android-file-transfer-linux/
GNU Lesser General Public License v2.1
1.47k stars 120 forks source link

Proposal to add get-id command to cli. #341

Closed weetmuts closed 4 months ago

weetmuts commented 4 months ago

The get-id allows me to fetch filtered content quickly after an lsext-r.

I fetch all content using aft-mtp-cli "lsext-r DCIM/Camera"

(The samsung-phone has 8000 images in this dir, with no subdirectories, it takes 8 seconds or so.)

I filter out the images I have already downloaded and then I want to fetch the remaining 1000 images.

If I get each file with: aft-mtp-cli "get DCIM/Camera/20240606_144210.jpg" "get DCIM/Camera/20240607_121212.jpg" ...

then it scans the DCIM/Camera again to translate the file name into the id, and an extra 8 seconds is added on each get for a file that then only takes 200 ms to actually download.

If we add the "get-id" cli command, then I can do: aft-mtp-cli "get-id 2360" "get-id 74622" ... and I get the files immediately.

Forgive me if there is an existing way to do this without get-id. But I haven't found it yet.

whoozle commented 4 months ago

Nice one, thanks!

weetmuts commented 4 months ago

Thanks! When the phone disconnects during transfer, which it does every now and then. :-/

I want to continue where I left off, so my code prompts me to unplug/replug and approve. However if I restart the get-id immediately I get "error: Get: invalid response code GeneralError (0x2002)"

I have to run an lsext-r again, before the get-id works. The id is indeed the same, so the phone does not seem to change the ids. However it seems to need to be primed somehow before get-id works.

Is there a faster way to prime the phone to respond the get-id than lsext-r?

Many thanks for this useful tool!