]> git.plutz.net Git - viper/blob - plugins/a_default.py
moved from svn.imp.fu-berlin.de/viper rev33
[viper] / plugins / a_default.py
1 #encoding: utf-8
2 #Copyright 2009 Paul Hänsch
3
4 #This file is part of Viper.
5
6 #Viper is free software: you can redistribute it and/or modify
7 #it under the terms of the GNU General Public License as published by
8 #the Free Software Foundation, either version 3 of the License, or
9 #(at your option) any later version.
10
11 #Viper is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #GNU General Public License for more details.
15
16 #You should have received a copy of the GNU General Public License
17 #along with Viper.  If not, see <http://www.gnu.org/licenses/>
18
19 from plugin import *
20
21 class A_Custom(A_Plugin):
22     def build_dialog(self):
23         self.subgets['desc'] = Label(self, text = 'Enter a piece of mplayer command line\n'+
24                                      'specifying an audio encoder. I.e.:\n' +
25                                      '"-oac pcm"')
26         self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH)
27         self.subgets['line'] = Entry(self)
28         self.subgets['line'].pack(side = TOP, expand = True, fill = X)
29
30     def name(self):
31         return 'Custom'
32
33     def subcommand(self):
34         return self.line.split(' ')
35
36 class A_Nosound(A_Plugin):
37     def build_dialog(self):
38         self.subgets['desc'] = Label(self, text = 'This will produce a silent file.\n' +
39                                      'No audio stream will be stored.')
40         self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH)
41
42     def name(self):
43         return 'Nosound'
44
45     def subcommand(self):
46         return ['-nosound']
47
48 class A_Copy(A_Plugin):
49     def build_dialog(self):
50         self.subgets['desc'] = Label(self, text = 'This will copy an existing audio stream.')
51         self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH)
52
53     def name(self):
54         return 'Copy'
55
56     def subcommand(self):
57         return ['-oac', 'copy']
58
59     def is_available(self):
60         result = False
61         slave = os.popen2(['mencoder', '-oac', 'help'])
62         line = '#'
63         while line != '':
64             line = slave[1].readline()
65             if line.lstrip().find('copy') == 0:
66                 result = True
67         return result
68
69 class A_Pcm(A_Plugin):
70     def build_dialog(self):
71         self.subgets['desc'] = Label(self,
72                                      text = 'This will output an uncompressed audio stream '+
73                                      '(except mpeg2 and ac3).')
74         self.subgets['desc'].grid(row = 0, column = 0, columnspan = 4)
75
76         self.subgets['l_format'] = Label(self, text = 'Format:')
77         self.subgets['l_format'].grid(row = 1, column = 1)
78         self.subgets['format'] = Pmw.OptionMenu(self, initialitem = 5,
79                                                 items = ['s8', 'u8', 's16be', 's16le',
80                                                          'u16be', 'u16le', 's24be', 's24le',
81                                                          'u24be', 'u24le', 's32be', 's32le',
82                                                          'u32be', 'u32le', 'floatbe', 'floatle',
83                                                          'mulaw', 'alaw', 'mpeg2', 'ac3',
84                                                          'imaadpcm'])
85         self.subgets['format'].grid(row = 1, column = 2)
86
87     def name(self):
88         return 'Pcm'
89
90     def subcommand(self):
91         return ['-oac', 'pcm', '-af', 'format='+self.subgets['format'].getvalue()]
92
93     def is_available(self):
94         result = False
95         slave = os.popen2(['mencoder', '-oac', 'help'])
96         line = '#'
97         while line != '':
98             line = slave[1].readline()
99             if line.lstrip().find('pcm') == 0:
100                 result = True
101         return result