0.22 Python bindings/FileTransfer

From MythTV Official Wiki
Jump to: navigation, search

This class is to provide read/write access to files in storage groups through the mythbackend socket. It is designed to emulate the operation of open().

FileTransfer(file, mode)

Opens a file transfer socket for pulling data over mythprotocol. Accepts 'file' in the following formats

   Program object
   tuple:  (hostname, filename, storagegroup)
   str:    myth://<storagegroup>@<hostname>[:port]/<filename>

Where filename is a relative path from the base of the storagegroup.


Reads a block of data of 'size' bytes from the interface.


Writes a block of data to the interface.


Returns current position in the file.


Seeks to beginning of file.

seek(offset, whence=0)

Seeks offset bytes from beginning of file (whence==0), current position (whence==1).


Total size of file in bytes.