fix
[mplayer/glamo.git] / debian / config
blob5a342d139c0a3c7764919c98057b725e5e26e0bf
1 #!/usr/bin/perl -w
3 # Script to configure mplayer
4 # based on etherconf by John Goerzen <jgoerzen@progenylinux.com>
6 use Debconf::Client::ConfModule qw(:all);
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;
16 my @nextargs = ();
18 checkupgrade(); # Find out if we have to upgrade.
19 mainloop(letsgo());
21 sub checkupgrade {
22 open(MCFG, "</etc/mplayer/mplayer.conf") || return 1;
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();
32 close MCFG;
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');
46 sub letsgo {
47 #useless!
48 return "configure";
51 sub configure {
52 subst("mplayer/voutput", "vochoices", "xv, xmga, mga, x11, gl, sdl, xvidix");
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';
61 sub mainmenu {
62 go(); # To catch spare things from before
63 my @choices = (
64 'Video Output: ' . scalar(get("mplayer/voutput")));
66 $choices = join(', ', @choices);
67 $isediting = 1;
69 subst('mplayer/mainmenu', 'choices', $choices);
70 input($PRIORITY, 'mplayer/mainmenu');
71 go();
73 my $selection = get('mplayer/mainmenu');
74 if ($selection =~ /^Exit/) {
75 return 'Exit';
78 # Set to redisplay.
79 fset('mplayer/mainmenu', 'isdefault', 'true');
81 $_ = $selection;
83 return 'configure' if /^Video/;
84 # return 'aoutput' if /^Aoutput/;
85 return 'Exit';
88 sub editreturn {
89 my @args = @_;
90 return 'mainmenu' if $isediting;
91 return @args;
94 sub editfix {
95 my $template = shift @_;
96 if ($isediting) {
97 fset($template, 'isdefault', 'true');