summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakxtv
blob: 3da06a3ebcf644a736f78fb50a8053304201f636 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/perl
# DrakxTV
# $Id: drakxtv 233182 2008-01-23 12:16:18Z tv $

# Copyright (C) 2002-2008 Mandriva (tvignaud@mandriva.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

use strict;
use lib qw(/usr/lib/libDrakX);

use common;
use standalone; #- warning, standalone must be loaded very first, for 'explanations'

use interactive;
use detect_devices;
use lang;
use log;

$ugtk2::wm_icon = "/usr/share/mcc/themes/default/tv-mdk.png";

my $in = 'interactive'->vnew;

my @devices = detect_devices::getTVcards();
push @devices, { driver => 'bttv', description => 'dummy' } if $::testing && !@devices;
my ($devices, $devices_ok) = partition { detect_devices::isTVcardConfigurable($_) } @devices;

my $modules_conf;

# handle TV cards which driver needs to be configured b/c it cannot autodetect the card & tuner types:
if (@devices = @$devices) {
    my $not_canceled = 1;
    # TODO: That need some work for multiples TV cards
    each_index {
	   if (($< == 0 || $::testing) && (grep { detect_devices::isTVcardConfigurable($_) } @devices)) {
		  require harddrake::v4l;
		  require modules;

		  $modules_conf ||= modules::any_conf->read;
		  $not_canceled &&= harddrake::v4l::config($in, $modules_conf, $_->{driver});
		  $modules_conf->write;
	   }
    } @devices;
}

# handle TV cards that do not require any driver configuration:
if (@devices = @$devices_ok) {
    require modules;
    $modules_conf ||= modules::any_conf->read;
    $modules_conf->write;
}

# we failed to detect any TV card:
if (is_empty_array_ref($devices) && is_empty_array_ref($devices_ok)) {
    $in->ask_warn(N("No TV Card detected!"), formatAlaTeX(
                                                          #-PO: keep the double empty lines between sections, this is formatted a la LaTeX
                                                          N("No TV Card has been detected on your machine. Please verify that a Linux-supported Video/TV Card is correctly plugged in.


You can visit our hardware database at:


http://www.mandrivalinux.com/en/hardware.php3")));
}
$in->exit(0) if defined $in;


# TODO:
# - offer to sort channels after
# - use Video-Capture-V4l-0.221 ?
# - configure kwintv and zapping ? => they've already wizards :-(
# - install xawtv if needed through consolhelper