Добавлена обработка заголовков запроса X-Forwarded...
[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             elif qtype=='ogg':
17                 command = command + 'transcode{vcodec=theora,acodec=vorbis,vb=800,ab=128}:'    
18                 muxer='ogg'
19             elif qtype=='ogv':
20                 command = command + 'transcode{vcodec=theora,acodec=vorbis,vb=8192,ab=256}:'    
21                 muxer='ogg'
22 #            elif qtype=='webm':
23 #                command = command + 'transcode{vcodec=VP80,acodec=vorbis,vb=512,ab=64}:'
24 #                muxer='ffmpeg{mux=ogg}'
25             command = command +'http{mux=' + muxer + ',dst=:' + \
26                 str(out_port) + '/' + stream_name + '} option sout-keep option sout-all enabled' + \
27                 "\r\n" + 'control "' + stream_name + '" play'
28             return command    
29
30         @staticmethod
31         def stopBroadcast(stream_name):
32             return 'del "' + stream_name + '"'
33
34         @staticmethod
35         def pauseBroadcast(stream_name):
36             return 'control "' + stream_name + '" pause'
37
38         @staticmethod
39         def playBroadcast(stream_name):
40             return 'control "' + stream_name + '" play'
41
42     class response(object):
43         WRONGPASS = 'Wrong password'
44         AUTHOK = 'Welcome, Master'
45         BROADCASTEXISTS = 'Name already in use'
46         SYNTAXERR = 'Wrong command syntax'
47         STARTOK = 'new'
48         STOPOK = 'del'
49         STOPERR = 'media unknown'
50         SHUTDOWN = 'Bye-bye!'