#!/usr/bin/perl # DrakxTV # $Id$ # Copyright (C) 2002 MandrakeSoft (tvignaud@mandrakesoft.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. # If we ever want to autoconf the tv card at install time, we should # make a package out of this. # Maybe we'll have to for harddrake2 # #package tvdrake; use lib qw(/usr/lib/libDrakX); use interactive; use strict; use detect_devices; sub scan4channels { my $in = shift; my $wait; if ( ! -f "/usr/bin/scantv" ) { $wait = $in->ask_warn(_('Error'), _("XawTV isn't installed ...\nYou should install it.\n Just type \"urpmi xawtv\"")); $in->exit(0); return; } my ($i, $ftable_id, $norm, $check); # my %freqtables = map {$i=$_;$i =~ s/ (.*)/-\1/;_($_) => $i} (...) # this table must be checked on each xawtv release : my %freqtables = ("us-bcast" => _("USA (bcast)"), "us-cable" => _("USA (cable)"), "us-cable-hrc" => _("USA (cable-hrc)"), "canada-cable" => _("Canada (cable)"), "japan-bcast" => _("Japan (bcast)"), "japan-cable" => _("Japan (cable)"), "china-bcast" => _("China (bcast)"), "europe-west" => _("West Europe"), "europe-east" => _("East Europe"), "italy" => _("Italy"), "ireland" => _("Ireland"), "france" => _("France"), "newzealand" => _("Newzealand"), "australia" => _("Australia"), "southafrica" => _("South Africa"), "argentina" => _("Argentina"), -1 =>_("All") ); # HRC means Harmonically Related Carrier if ($in->ask_from("TVdrake", _("Please,\ntype in your tv norm and country"), [ { label => _("TV norm :"), val => \$norm, list => ["NTSC", "NTSC-JP","PAL", "PAL-M", "PAL-N", "PAL-NC", "SECAM"], type => 'combo'}, { label => _("Area :"), val => \$ftable_id, list => [keys %freqtables], format => sub { $freqtables{$_[0]} }, sort => 1}, ] )) { $wait = $in->wait_message(_('Please wait'), _("Scanning for TV channels in progress ...")); # we provide scantv a bogus table (france) which will # will be ignored as "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"; system ( (($use_X ) ? "xvt -T '"._("Scanning for TV channels")." ...' -e ":"") . "scantv -n $norm -f $ftable_id -o ~/.xawtv".(($use_X )?"":" &>~/tmp/scantv.log")); print "Now, you can run xawtv !\n"; }; $in->exit(0); } scan4channels('interactive'->vnew()) if grep { $_->{media_type} eq 'MULTIMEDIA_VIDEO' } detect_devices::probeall(1); # TODO : # - offer to sort channels after # - try to figure out country from locale ? # - try to figure out tv norm from country ? # - use Video-Capture-V4l-0.221 ? # - reput kwintv and test it ? => still buggy it seems ... # - configure kwintv and zapping ? => they've already wizards :-(