summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakxtv
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/drakxtv')
-rwxr-xr-xperl-install/standalone/drakxtv156
1 files changed, 32 insertions, 124 deletions
diff --git a/perl-install/standalone/drakxtv b/perl-install/standalone/drakxtv
index caeebcc59..0fa879ab1 100755
--- a/perl-install/standalone/drakxtv
+++ b/perl-install/standalone/drakxtv
@@ -1,8 +1,7 @@
#!/usr/bin/perl
# DrakxTV
-# $Id$
-# Copyright (C) 2002 MandrakeSoft (tvignaud@mandrakesoft.com)
+# Copyright (C) 2002-2008 Mandriva (thierry.vignaud.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
@@ -18,147 +17,56 @@
# 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 standalone; #- warning, standalone must be loaded very first, for 'explanations'
+use common;
+use standalone; #- warning, standalone must be loaded very first, for 'explanations'
use interactive;
-use strict;
use detect_devices;
use lang;
use log;
-use common;
-
-("@ARGV" =~ /--help|-h/) and die "usage: drakxtv [-h] [--help] [--no-guess]\n";
-
-my $in = 'interactive'->vnew();
+$ugtk3::wm_icon = "/usr/share/mcc/themes/default/tv-mdk.png";
-sub scan4channels {
-# xawtv has been installed by DrakX when/if it's detected a
-# tv card.
-# In the future, we might try to install xawtv if it'sn't there
-# as we're just a, xawtv wraper
-# -x "/usr/bin/scantv" or $in->do_pkgs->install('xawtv');
-# -x "/usr/bin/scantv" or {
-#{ exec {'consolehelper'} $0, ("urpmi", "xawtv") or die N("consolehelper missing");
-# };
- if (! -x "/usr/bin/scantv") {
-# standalone::explanations("package xawtv isn't installed");
- $in->ask_warn("XawTV isn't installed!",
- formatAlaTeX(N("XawTV isn't installed!
+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;
-If you do have a TV card but DrakX has neither detected it (no bttv nor saa7134
-module in \"/etc/modules\") nor installed xawtv, please send the
-results of \"lspcidrake -v -f\" to \"install\@mandrakesoft.com\"
-with subject \"undetected TV card\".
+my $modules_conf;
-
-You can install it by typing \"urpmi xawtv\" as root, in a console.")));
-
- } else {
- my ($ftable_id, $norm);
-
-# my %freqtables = map {$i=$_;$i =~ s/ (.*)/-\1/;_($_) => $i} (...)
-# this table must be checked on each xawtv release:
- my %freqtables =
- ("us-bcast" => N("USA (broadcast)"), "us-cable" => N("USA (cable)"), "us-cable-hrc" => N("USA (cable-hrc)"), "canada-cable" => N("Canada (cable)"),
- "japan-bcast" => N("Japan (broadcast)"), "japan-cable" => N("Japan (cable)"), "china-bcast" => N("China (broadcast)"),
- "europe-west" => N("West Europe"), "europe-east" => N("East Europe"), "italy" => N("Italy"), "ireland" => N("Ireland"), "france" => N("France [SECAM]"),
- "newzealand" => N("Newzealand"), "australia" => N("Australia"),
- "southafrica" => N("South Africa"),
- "argentina" => N("Argentina"),
- "australia-optus" => N("Australian Optus cable TV"),
- -1 =>N("All")
- );
-# Info: HRC means "Harmonically Related Carrier"
-
- # default to pal since most people use that
- $norm = "PAL";
- if ("@ARGV" !~ /--help|-h/) {
- my %countries =
- (
- "ar" => [ "argentina" ],
- "au" => [ "australia" ],
- "(br|fr)" => ["france", "SECAM"],
- "ca" => [ "canada-cable" ],
- "(ga|ie)" => [ "ireland" ],
- "it" => [ "italy" ],
- "jp" => [ "japan-bcast", "NTSC-JP"],
- "nz" => [ "newzealand" ],
- "(at|be|ch|de|eu|gb|se)" => [ "europe-west" ],
- "us" => [ "us-bcast", "NTSC" ],
- "za" => [ "southafrica" ],
- "(zh|TW|Big5|CN.GB2312|CN)" => [ "china-bcast" ]
- );
-
- ($_) = lang::read('', $>);
- foreach my $i (keys %countries) {
- if (/($i|$i.UTF-8)$/i) {
- my $tbl = $countries{$i};
- $ftable_id = $tbl->[0];
- $norm = $tbl->[1] if ($tbl->[1]);
- }
- }
- log::l("[drakxtv] guess lang=>$_, norm=>$norm, area=>$ftable_id");
- }
-
- if ($in->ask_from("TVdrake", N("Please,\ntype in your tv norm and country"),
- [
- { label => N("TV norm:"), val => \$norm, list => ["NTSC", "NTSC-JP","PAL", "PAL-M", "PAL-N", "PAL-NC", "SECAM"], type => 'combo' },
- { label => N("Area:"), val => \$ftable_id, list => [keys %freqtables], format => sub { $freqtables{$_[0]} }, sort => 1},
- ]
- ))
- { my $wait = $in->wait_message(N("Please wait"),
- N("Scanning for TV channels in progress ..."));
-# we provide scantv a bogus table (france) which will
-# will be ignored since "All" is selected (because of -a)
- $ftable_id = "france -a " if ($ftable_id eq -1);
- # Note that this'll be broken if/when we implement interactive::qt
- my $use_X = $in->isa('interactive::gtk') && -x "/usr/X11R6/bin/xvt";
- my $home = $ENV{HOME};
- my $i = system(($use_X ? "xvt -T '" . N("Scanning for TV channels") . " ...' -e " : "") .
- "scantv -n $norm -f $ftable_id -o $home/.xawtv".
- ($use_X ? "" : " &>$home/tmp/scantv.log;"));
- if ($i) {
- $in->ask_warn(N("There was an error while scanning for TV channels"),
- N("XawTV isn't installed!")) }
- else {
- standalone::explanations("created file $home/.xawtv");
- $in->ask_warn(N("Have a nice day!"),
- N("Now, you can run xawtv (under X Window!) !\n")) if (! $use_X);
- };
-
- };
- }
-}
-
-my @devices = grep { $_->{media_type} eq 'MULTIMEDIA_VIDEO' } detect_devices::probeall(1);
-if (@devices) {
+# 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
- foreach (@devices) {
- if (($< == 0) && (grep { $_->{driver} =~ '(bttv|saa7134)' } @devices)) {
+ each_index {
+ if (($< == 0 || $::testing) && (grep { detect_devices::isTVcardConfigurable($_) } @devices)) {
require harddrake::v4l;
require modules;
- no strict 'subs';
- modules::read_conf;
- harddrake::v4l::config($in, $_->{driver});
- modules::write_conf;
- }
- scan4channels();
- $in->exit(0);
- }
-} else {
- $in->ask_warn(N("No TV Card detected!"), formatAlaTeX(
- N("No TV Card has been detected on your machine. Please verify that a Linux-supported Video/TV Card is correctly plugged in.
+ $modules_conf ||= modules::any_conf->read;
+ $not_canceled &&= harddrake::v4l::config($in, $modules_conf, $_->{driver});
+ $modules_conf->write;
+ }
+ } @devices;
+}
-You can visit our hardware database at:
-
+# 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;
+}
-http://www.linux-mandrake.com/en/hardware.php3")));
+# 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(
+ N("No TV Card has been detected on your machine. Please verify that a Linux-supported Video/TV Card is correctly plugged in.")));
}
+$in->exit(0) if defined $in;
# TODO: