1398
|
1 #!/usr/bin/perl -w
|
|
2
|
|
3 # Script to configure mplayer
|
|
4 # based on etherconf by John Goerzen <jgoerzen@progenylinux.com>
|
|
5
|
|
6 use Debian::DebConf::Client::ConfModule qw(:all);
|
|
7
|
|
8 my $version = version(2.0);
|
|
9 title('MPlayer Configuration');
|
|
10 my $PRIORITY = 'high';
|
|
11 #TODO: 'medium'
|
|
12 my $next = 'mainmenu';
|
|
13 my $isediting = 0;
|
|
14
|
|
15 my @nextargs = ();
|
|
16
|
|
17 checkupgrade(); # Find out if we have to upgrade.
|
|
18 mainloop(letsgo());
|
|
19
|
|
20 sub checkupgrade {
|
|
21 open(MCFG, "</etc/mplayer.conf") || return 1;
|
|
22 my $line = <MCFG>;
|
|
23 return 1 if ($line =~ /mplayer DEBCONF AREA/);
|
|
24 exit(0) if (input($PRIORITY, 'mplayer/replace-existing-files') eq "question skipped");
|
|
25 go();
|
|
26 if (get('mplayer/replace-existing-files') eq 'false') {
|
|
27 input($PRIORITY, 'mplayer/replace-existing-files-bail');
|
|
28 go();
|
|
29 exit();
|
|
30 }
|
|
31 close MCFG;
|
|
32 }
|
|
33
|
|
34 sub mainloop {
|
|
35 $next = shift @_;
|
|
36 do {
|
|
37 my @retval = &$next(@nextargs);
|
|
38 # if ($retval[0] eq 'BACK') {
|
|
39 # $retval[0] = $backups{$next};
|
|
40 # }
|
|
41 ($next, @nextargs) = @retval;
|
|
42 } while ($next ne 'Exit');
|
|
43 }
|
|
44
|
|
45 sub letsgo {
|
|
46 #useless!
|
|
47 return "configure";
|
|
48 }
|
|
49
|
|
50 sub configure {
|
|
51 subst("mplayer/voutput", "vochoices", "xv, xmga, mga, x11, gl, sdl");
|
|
52 # db_subst mplayer/output vo xc,xmga,mga,x11,gl,sdl
|
|
53 exit(0) if (input($PRIORITY, "mplayer/voutput") eq "question skipped");
|
|
54 go();
|
|
55 exit 0 unless (get("mplayer/voutput") eq 'true');
|
|
56 #return 'audioout';
|
|
57 return 'mainmenu';
|
|
58 }
|
|
59
|
|
60 sub mainmenu {
|
|
61 go(); # To catch spare things from before
|
|
62 my @choices = (
|
|
63 'Video Output: ' . scalar(get("mplayer/voutput")));
|
|
64 #,
|
|
65 $choices = join(', ', @choices);
|
|
66 $isediting = 1;
|
|
67
|
|
68 subst('mplayer/mainmenu', 'choices', $choices);
|
|
69 input($PRIORITY, 'mplayer/mainmenu');
|
|
70 go();
|
|
71
|
|
72 my $selection = get('mplayer/mainmenu');
|
|
73 if ($selection =~ /^Exit/) {
|
|
74 return 'Exit';
|
|
75 }
|
|
76
|
|
77 # Set to redisplay.
|
|
78 fset('mplayer/mainmenu', 'isdefault', 'true');
|
|
79
|
|
80 $_ = $selection;
|
|
81
|
|
82 return 'configure' if /^Video/;
|
|
83 # return 'aoutput' if /^Aoutput/;
|
|
84 return 'Exit';
|
|
85 }
|
|
86
|
|
87 sub editreturn {
|
|
88 my @args = @_;
|
|
89 return 'mainmenu' if $isediting;
|
|
90 return @args;
|
|
91 }
|
|
92
|
|
93 sub editfix {
|
|
94 my $template = shift @_;
|
|
95 if ($isediting) {
|
|
96 fset($template, 'isdefault', 'true');
|
|
97 }
|
|
98 }
|