pymplayer (version 0.4.0)
index

Thin, out-of-source wrapper and client/server for MPlayer
 
Classes:
 
MPlayer -- thin, out-of-process wrapper for MPlayer
Server -- asynchronous server that manages an MPlayer instance
Client -- client for sending MPlayer commands
 
Function:
 
loop() -- the asyncore.loop function, provided here for convenience
 
Constants:
 
PIPE -- subprocess.PIPE, provided here for convenience
STDOUT -- subprocess.STDOUT, provided here for convenience

 
Modules
       
asynchat
asyncore
socket

 
Classes
       
__builtin__.object
MPlayer
asynchat.async_chat(asyncore.dispatcher)
Client
asyncore.dispatcher
Server

 
class Client(asynchat.async_chat)
    Client()
 
The PyMPlayer Client
 
 
Method resolution order:
Client
asynchat.async_chat
asyncore.dispatcher

Methods defined here:
__init__(self)
collect_incoming_data(self, data)
connect(self, (host, port))
found_terminator(self)
handle_connect(self)
handle_data(self, data)
handle_error(self)
send_command(self, cmd)
Send an MPlayer command to the server
 
@param cmd: valid MPlayer command
 
Valid MPlayer commands are documented in:
http://www.mplayerhq.hu/DOCS/tech/slave.txt

Data and other attributes defined here:
ac_in_buffer_size = 512
ac_out_buffer_size = 512

Methods inherited from asynchat.async_chat:
close_when_done(self)
automatically close this channel once the outgoing queue is empty
discard_buffers(self)
get_terminator(self)
handle_close(self)
handle_read(self)
handle_write(self)
initiate_send(self)
push(self, data)
push_with_producer(self, producer)
readable(self)
predicate for inclusion in the readable for select()
refill_buffer(self)
# refill the outgoing buffer by calling the more() method
# of the first producer in the queue
set_terminator(self, term)
Set the input delimiter.  Can be a fixed string of any length, an integer, or None
writable(self)
predicate for inclusion in the writable for select()

Methods inherited from asyncore.dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
create_socket(self, family, type)
del_channel(self, map=None)
handle_accept(self)
handle_expt(self)
handle_expt_event(self)
handle_read_event(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)

Data and other attributes inherited from asyncore.dispatcher:
accepting = False
addr = None
closing = False
connected = False
debug = False

 
class MPlayer(__builtin__.object)
    MPlayer(args=())
 
An out-of-process wrapper for MPlayer. It provides the basic
interface for sending commands and receiving responses to and from
MPlayer. Take note that MPlayer is always started in 'slave',
'idle', and 'quiet' modes.
 
@class attribute executable: path to or filename of MPlayer
@property args: MPlayer arguments
@property stdout: process' stdout (read-only)
@property stderr: process' stderr (read-only)
 
  Methods defined here:
__del__(self)
__init__(self, args=())
command(self, name, *args)
Send a command to MPlayer.
 
@param name: command string
 
Valid MPlayer commands are documented in:
http://www.mplayerhq.hu/DOCS/tech/slave.txt
is_alive(self)
Check if MPlayer process is alive.
 
Returns True if alive, else, returns False.
query(self, name, timeout=0.25)
Send a query to MPlayer. The result is returned, if there is any.
 
query() will first consume all data in stdout before proceeding.
This is to ensure that it'll get the response from the command
given and not just some random data.
 
WARNING: This function is not thread-safe. You might want to implement
         a locking mechanism to ensure that you get the correct result
quit(self, retcode=0)
Stop the MPlayer process.
 
Returns the exit status of MPlayer or None if not running.
start(self, stdout=None, stderr=None)
Start the MPlayer process.
 
@param stdout: subprocess.PIPE | None
@param stderr: subprocess.PIPE | subprocess.STDOUT | None
 
Returns True on success, False on failure, or None if MPlayer
is already running. stdout/stderr will be PIPEd regardless of
the passed parameters if subscribers were added to them.

Class methods defined here:
introspect(cls) from MPlayer executable
 
Generate methods based on the available commands. The generated
methods check the number and type of the passed parameters.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
args
list of MPlayer arguments
stderr
stderr of the MPlayer process
stdout
stdout of the MPlayer process

Data and other attributes defined here:
executable = 'mplayer'

 
class Server(asyncore.dispatcher)
    Server(mplayer, port, host='', max_conn=1)
 
The log method can be overridden to provide more sophisticated
logging and warning methods.
 
  Methods defined here:
__del__(self)
__init__(self, mplayer, port, host='', max_conn=1)
handle_accept(self)
handle_close(self)
stop = handle_close(self)
writable(self)

Methods inherited from asyncore.dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read(self)
handle_read_event(self)
handle_write(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)

Data and other attributes inherited from asyncore.dispatcher:
accepting = False
addr = None
closing = False
connected = False
debug = False

 
Functions
       
loop(timeout=30.0, use_poll=False, map=None, count=None)

 
Data
        PIPE = -1
STDOUT = -2
__all__ = ['MPlayer', 'Server', 'Client', 'loop', 'PIPE', 'STDOUT']
__author__ = 'Darwin M. Bautista <djclue917 ? gmail : com>'
__version__ = '0.4.0'

 
Author
        Darwin M. Bautista <djclue917 ? gmail : com>