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