1 ### Start of footer.py ###
3 class MediaEvent(ctypes.Structure):
5 ('media_name', ctypes.c_char_p),
6 ('instance_name', ctypes.c_char_p),
9 class EventUnion(ctypes.Union):
11 ('meta_type', ctypes.c_uint),
12 ('new_child', ctypes.c_uint),
13 ('new_duration', ctypes.c_longlong),
14 ('new_status', ctypes.c_int),
15 ('media', ctypes.c_void_p),
16 ('new_state', ctypes.c_uint),
18 ('new_position', ctypes.c_float),
19 ('new_time', ctypes.c_longlong),
20 ('new_title', ctypes.c_int),
21 ('new_seekable', ctypes.c_longlong),
22 ('new_pausable', ctypes.c_longlong),
23 # FIXME: Skipped MediaList and MediaListView...
24 ('filename', ctypes.c_char_p),
25 ('new_length', ctypes.c_longlong),
26 ('media_event', MediaEvent),
29 class Event(ctypes.Structure):
32 ('object', ctypes.c_void_p),
36 # Decorator for callback methods
37 callbackmethod=ctypes.CFUNCTYPE(None, Event, ctypes.c_void_p)
39 # Example callback method
41 def debug_callback(event, data):
42 print "Debug callback method"
43 print "Event:", event.type
46 if __name__ == '__main__':
49 from msvcrt import getch
55 old_settings=termios.tcgetattr(fd)
60 termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
64 def end_callback(event, data):
69 if sys.platform == 'win32' and plugin_path is not None:
70 i=Instance('--plugin-path', plugin_path)
73 m=i.media_new(sys.argv[1])
74 p=i.media_player_new()
79 e.event_attach(EventType.MediaPlayerStopped, end_callback, None)
82 """Print information about the media."""
84 print "Playing ", m.get_mrl()
85 print "Current time:", p.get_time(), "/", m.get_duration()
86 print "Position", p.get_position()
90 p.set_time(p.get_time() + 1000)
94 p.set_time(p.get_time() - 1000)
100 for k, m in keybindings.iteritems():
101 print " %s: %s" % (k, (m.__doc__ or m.__name__).splitlines()[0])
108 'f': p.toggle_fullscreen,
117 print "Press q to quit, ? to get help."
120 method=keybindings.get(k, None)
121 if method is not None: