pure-python-adb icon indicating copy to clipboard operation
pure-python-adb copied to clipboard

device shell push audio file has % progress on stdout, how do I get it?

Open enjoysmath opened this issue 6 years ago • 1 comments

When we push an audio file normally (using Cygwin terminal) there's a progress % that gets printed every 50 milliseconds on the shell's stdout. Was wondering how can I get that stdout as a string until it is finished?

      devices = self.adb_client.devices()
      if devices:
         device = devices[0]
         self.status_message('Pushing audio file......')
         device.push('audio/SRV.wav', '/sdcard/music/srv.wav')
         
         while True:
            with self.adb_client.create_connection() as conn:
               result = conn.receive()
               print(result)

enjoysmath avatar Dec 06 '19 19:12 enjoysmath

Hi enjoysmath,

The progress bar is printed by the adb application when the adb application opens a socket connection then sends the file data to the device. This is not printed by the adb server or adb daemon ( device ).

If you want to print the progress, you need to implement yourself push function.

Reference code: https://github.com/Swind/pure-python-adb/blob/master/ppadb/sync/init.py#L25

adb protocol spec: https://android.googlesource.com/platform/system/core/+/master/adb/SYNC.TXT

Thanks

Swind avatar Dec 20 '19 19:12 Swind