summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakxtv
blob: 0ea4f673ebba949690d2c475846518ad62ba3007 (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$

# 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 ($i, $ftable_id, $norm, $check);

#    my %freqtables = map {$i=$_;$i =~ s/ (.*)/-\1/;_($_) => $i} (...)
#   this table must be checked on each xawtv release :
    my %freqtables = 
	   (_("USA (bcast)") => "us-bcast", _("USA (cable)") => "us-cable", _("USA (cable-hrc)") => "us-cable-hrc", _("Canada (cable)") => "canada-cable",
	_("Japan (bcast)") => "japan-bcast", _("Japan (cable)") => "japan-cable", _("China (bcast)") => "china-bcast",
	_("West Europe") => "europe-west", _("East Europe") => "europe-east", _("Italy") => "italy", _("Ireland") => "ireland", _("France") => "france",
	_("Newzealand") => "newzealand", _("Australia") => "australia",
	_("South Africa") => "southafrica",
	_("Argentina") => "argentina",
	_("All") => -1);

    $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"], not_edit => 1, type => 'combo'},
			    { label => _("Area :"), val => \$ftable_id, list => [keys %freqtables], not_edit => 1, sort => 1},
			    ],
			   complete => sub { 
				  my $wait = $in->wait_message(_('Please wait'),
										 _("Scanning for TV channels in progress ..."));

#                     france is a bogus table provided to scantv which will
#                     ignore it as "All" is selected because of -a
				  $ftable_id = $freqtables{$ftable_id};
				  $ftable_id = "france -a " if ($ftable_id eq -1);
				  my $use_X =$ENV{DISPLAY} && -x "/usr/X11R6/bin/xvt";
				  system( (($use_X ) ?
						 "xvt -title '"._("Scanning for TV channels")." ...' -e ":"")
						. "scantv -n $norm -f $ftable_id -o ~/.xawtv".(($use_X )?"":" &>~/tmp/scantv.log"));
				  $in->exit(0);
			   },
			   ) or $in->exit(0);
    $in->exit(0);
}


sub is_tv {
    foreach (grep { $_->{media_type} eq 'MULTIMEDIA_VIDEO' } detect_devices::probeall(1)) {
	   return 1;
    }
    0;
}

scan4channels('interactive'->vnew()) if (is_tv);

# TODO :
# - 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 :-(