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.

read(size)

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

write(data)

Writes a block of data to the interface.

tell()

Returns current position in the file.

rewind()

Seeks to beginning of file.

seek(offset, whence=0)

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

size

Total size of file in bytes.