da8606c1d3ac578d47b3ae22ba105d5a8187d42a
[vpproxy.git] / vlcclient / vlcmessages.py
1 '''
2 Minimal VLC client for AceProxy. Messages class.
3 '''
4
5
6 class VlcMessage(object):
7
8     class request(object):
9         SHUTDOWN = 'shutdown'
10
11         @staticmethod
12         def startBroadcast(stream_name, input, out_port, muxer='ts', pre_access='',qtype='default'):
13             command = 'new "' + stream_name + '" broadcast input "' + input + '" output ' + (pre_access + ':' if pre_access else '#')
14             if qtype=='mp4':
15                 command = command + 'transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:'
16             command = command +'http{mux=' + muxer + ',dst=:' + \
17                 str(out_port) + '/' + stream_name + '} option sout-keep option sout-all enabled' + \
18                 "\r\n" + 'control "' + stream_name + '" play'
19             return command    
20
21         @staticmethod
22         def stopBroadcast(stream_name):
23             return 'del "' + stream_name + '"'
24
25         @staticmethod
26         def pauseBroadcast(stream_name):
27             return 'control "' + stream_name + '" pause'
28
29         @staticmethod
30         def playBroadcast(stream_name):
31             return 'control "' + stream_name + '" play'
32
33     class response(object):
34         WRONGPASS = 'Wrong password'
35         AUTHOK = 'Welcome, Master'
36         BROADCASTEXISTS = 'Name already in use'
37         SYNTAXERR = 'Wrong command syntax'
38         STARTOK = 'new'
39         STOPOK = 'del'
40         STOPERR = 'media unknown'
41         SHUTDOWN = 'Bye-bye!'