⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mplayertv

📁 用perl和gtk+写的调用mplayer播放电视的软件
💻
📖 第 1 页 / 共 5 页
字号:
#!/usr/bin/perl -w# Used to watch TV with mplayer# Copyright (C) Peter Ivanov <ivanovp@gmail.com>, 2004, 2005, 2006# Licensed under GPL version 2# For more information run: mplayerTV -h# # Last modify: 2006-12-25 19:18:24 ivanovp {Time-stamp}require 5.8.0;use warnings;use Gtk2;               # load the Gtk2-Perl moduleuse Getopt::Std;        # for command line optionsuse Gtk2::SimpleMenu;#use FindBin;#use lib "$FindBin::RealBin/MPlayer-0.03/lib"; # for testing purposes onlyuse MPlayer;            # :)use threads;set_locale Gtk2;        # internationalizeinit Gtk2;              # initialize Gtk2-Perlmy $cmd = $0;my %opts;my $prog_name = 'mplayerTV';my $prog_version = 'v0.2.1rc1';my $prog = $prog_name . " " . $prog_version;my $release_date = '2006-12-25';my $copy = 'Copyright (C) Peter Ivanov <ivanovp@gmail.com>, 2004, 2005, 2006';my $homepage = 'Homepage: http://mplayertv.ivanov.eu/';my $header = "$prog\n$copy\n$homepage";my $verbose_level = 0;  # you could change with -d to 1 and with -D to 2my $copyright_text = <<"EOT";$headerThis program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USAEOTmy $mplayer_path = "mplayer";my $scantv_path = "scantv";my $terminal_path = "xterm";my $browser_path = "x-www-browser";getopts("hcvwdD", \%opts);$verbose_level = 1 if ($opts{d});$verbose_level = 2 if ($opts{D});if ($opts{h}) {    usage();}if ($opts{v}) {    print "$prog\n";    print "Release date: $release_date\n";    exit (1);}if ($opts{c}) {    copyright();}if ($verbose_level >= 1) {    print "$prog\n";    print "Release date: $release_date\n";    print "\n";    print "Verbose level: $verbose_level\n";    print "OS: ", $^O, "\n";    open F, "</proc/version" || warn "Can't open /proc/version\n";    print "Kernel: ", <F>;    close F;    print "lspci:\n", `lspci`, "\n";}if ($verbose_level >= 2) {    print "lspci -v\n", `lspci -v`, "\n"}my $app = new MyApp ();$app->show ();if ($opts{w} || $cmd =~ /mplayerTVw$/) {    $app->start_mplayer ($app);}# eats CPU and does not working :(#Glib::Idle->add (sub {#        if ($app->{new_channel} >= 0) {#            $app->{name_list}->select_item ($app->{new_channel});#            $app->{new_channel} = -1;#            print "name_list update!\n";#        }#        return 1;#   });# Gtk2 event loopmain Gtk2;# Should never get hereexit (0);##############################################################################sub usage{    die<<"EOT";$headerThis program comes with ABSOLUTELY NO WARRANTY; for details type '$cmd -c'.This is free software, and you are welcome to redistribute itunder certain conditions; type '$cmd -c' for details.Usage: $cmd [-w] [-h] [-v] [-c] [-d] [-D]Options:  -w: run in 'watch it' mode  -h: prints help  -v: prints version  -c: prints copyright informations  -d: verbose  -D: very verboseEOT}sub copyright{    die $copyright_text;    exit;}### ConfigureDialog ojjektum ###package ConfigureDialog;sub new {    my ($class, $config, $cfg_file, $app) = @_;    my $self = {};    bless $self, $class;    $self->{selected_channel} = undef;        my @pp_filters = (            "Linear blend deinterlacer (lb)",            "Linear interpolating deinterlace (li)",            "Cubic interpolating deinterlacer (ci)",            "Median deinterlacer (md)",            "FFmpeg deinterlacer (fd)",            "Temporal noise reducer (tn)",            "Horizontal deblocking (hb)",             "Vertical deblocking (vb)",             "Experimental horizontal deblock (h1)",            "Experimental vertical deblock (v1)",            "Deringing (dr)",            "Automatic brightness/contrast (al)"            );    $self->{pp_codes} = $app->{pp_codes};    $self->{vf_table} = $app->{vf_table};    $self->{config} = $config;    $self->{cfg_file} = $cfg_file;    $self->{app} = $app;    $self->{tooltips} = new Gtk2::Tooltips ();    $self->{dialog} = new Gtk2::Dialog ();    ### NOTEBOOKS AND PAGES ###        $self->{notebook} = new Gtk2::Notebook;    $self->{dialog}->vbox->pack_start ($self->{notebook}, 0, 0, 10);    $self->{page1} = new Gtk2::VBox (0, 0);    $self->{page1}->set_border_width (5);    $self->{notebook}->append_page ($self->{page1}, "Channels");    $self->{page2} = new Gtk2::VBox (0, 0);    $self->{page2}->set_border_width (5);    $self->{notebook}->append_page ($self->{page2}, "General");    $self->{page3} = new Gtk2::VBox (0, 0);    $self->{page3}->set_border_width (5);    $self->{notebook}->append_page ($self->{page3}, "Video");    $self->{page5} = new Gtk2::VBox (0, 0);    $self->{page5}->set_border_width (5);    $self->{notebook}->append_page ($self->{page5}, "Audio");    $self->{page4} = new Gtk2::VBox (0, 0);    $self->{page4}->set_border_width (5);    $self->{notebook}->append_page ($self->{page4}, "Filters");    #$self->{page6} = new Gtk2::VBox (0, 10);    #$self->{notebook}->append_page ($self->{page6}, "Audio filters");        ### PAGE 1: CHANNELS    $self->{table1} = new Gtk2::Table (3, 6, 0);    $self->{page1}->pack_start ($self->{table1}, 1, 1, 0);    $self->{name_list} = new Gtk2::List ();    $self->{name_list}->select_item (0);    $self->{name_list_sw} = new Gtk2::ScrolledWindow (undef, undef);    $self->{name_list_sw}->set_policy (GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);    $self->{name_list_sw}->add_with_viewport($self->{name_list});    $self->{table1}->attach ($self->{name_list_sw}, 0, 1, 0, 4, ['fill', 'expand'], ['fill', 'expand'], 4, 4);    $self->update_channel_list ();        $self->{scantv_btn} = Gtk2::Button->new_from_stock ("scan");    $self->{scantv_btn}->set_size_request (60, -1);    $self->{tooltips}->set_tip ($self->{scantv_btn}, "Runs scantv and updates channel list");    $self->{table1}->attach ($self->{scantv_btn},       1, 2, 0, 1, [], [], 2, 2);        $self->{table1b} = new Gtk2::Table (11, 3, 0);    $self->{table1}->attach ($self->{table1b},          1, 2, 2, 3, ['fill'], [], 2, 2);    $self->{name_label} = new Gtk2::Label ("Name:");    $self->{name_label}->set_alignment (0, 0);    $self->{name_ent} = new Gtk2::Entry ();    $self->{name_ent}->set_size_request (140, -1);    $self->{channel_label} = new Gtk2::Label ("Channel:");    $self->{channel_label}->set_alignment (0, 0);    $self->{channel_ent} = new Gtk2::Entry ();    $self->{channel_ent}->set_size_request (140, -1);    $self->{table1b}->attach ($self->{name_label},      0, 3, 0, 1, ['fill'], [], 2, 2);    $self->{table1b}->attach ($self->{name_ent},        0, 3, 1, 2, ['fill'], [], 2, 2);    $self->{table1b}->attach ($self->{channel_label},   0, 3, 2, 3, ['fill'], [], 2, 2);    $self->{table1b}->attach ($self->{channel_ent},     0, 3, 3, 4, ['fill'], [], 2, 2);        $self->{brightness_label} = new Gtk2::Label ("Brightness:");    $self->{brightness_label}->set_alignment (0, 0);    $self->{table1b}->attach ($self->{brightness_label},0, 1, 4, 5, ['fill', 'expand'], [], 2, 2);    $self->{brightness_spin} = Gtk2::SpinButton->new_with_range (-100, 100, 1);    $self->{brightness_spin}->set_value (0);    $self->{table1b}->attach ($self->{brightness_spin}, 1, 2, 4, 5, ['fill', 'expand'], [], 2, 2);        $self->{contrast_label} = new Gtk2::Label ("Contrast:");    $self->{contrast_label}->set_alignment (0, 0);    $self->{table1b}->attach ($self->{contrast_label},  0, 1, 5, 6, ['fill', 'expand'], [], 2, 2);        $self->{contrast_spin} = Gtk2::SpinButton->new_with_range (-100, 100, 1);    $self->{contrast_spin}->set_value (0);    $self->{table1b}->attach ($self->{contrast_spin},   1, 2, 5, 6, ['fill', 'expand'], [], 2, 2);        $self->{hue_label} = new Gtk2::Label ("Hue:");    $self->{hue_label}->set_alignment (0, 0);    $self->{table1b}->attach ($self->{hue_label},       0, 1, 6, 7, ['fill', 'expand'], [], 2, 2);        $self->{hue_spin} = Gtk2::SpinButton->new_with_range (-100, 100, 1);    $self->{hue_spin}->set_value (0);    $self->{table1b}->attach ($self->{hue_spin},        1, 2, 6, 7, ['fill', 'expand'], [], 2, 2);        $self->{saturation_label} = new Gtk2::Label ("Saturation:");    $self->{saturation_label}->set_alignment (0, 0);    $self->{table1b}->attach ($self->{saturation_label},0, 1, 7, 8, ['fill', 'expand'], [], 2, 2);        $self->{saturation_spin} = Gtk2::SpinButton->new_with_range (-100, 100, 1);    $self->{saturation_spin}->set_value (0);    $self->{table1b}->attach ($self->{saturation_spin}, 1, 2, 7, 8, ['fill', 'expand'], [], 2, 2);        $self->{volume_label} = new Gtk2::Label ("Volume:");    $self->{volume_label}->set_alignment (0, 0);    $self->{table1b}->attach ($self->{volume_label},    0, 1, 8, 9, ['fill', 'expand'], [], 2, 2);        $self->{volume_spin} = Gtk2::SpinButton->new_with_range (-100, 100, 1);    $self->{volume_spin}->set_value (0);    $self->{table1b}->attach ($self->{volume_spin},     1, 2, 8, 9, ['fill', 'expand'], [], 2, 2);        $self->{table1d} = new Gtk2::Table (2, 2, 1);    $self->{table1}->attach ($self->{table1d},          1, 2, 3, 4, ['fill'], [], 2, 2);    $self->{modify_btn} = Gtk2::Button->new_from_stock ("modify");    $self->{new_btn} = Gtk2::Button->new_from_stock ("new");    $self->{delete_btn} = Gtk2::Button->new_from_stock ("delete");    $self->{deleteall_btn} = Gtk2::Button->new_from_stock ("deleteall");    $self->{table1d}->attach ($self->{modify_btn},      0, 1, 0, 1, ['fill', 'expand'], [], 2, 2);    $self->{table1d}->attach ($self->{new_btn},         1, 2, 0, 1, ['fill', 'expand'], [], 2, 2);    $self->{table1d}->attach ($self->{delete_btn},      0, 1, 1, 2, ['fill', 'expand'], [], 2, 2);    $self->{table1d}->attach ($self->{deleteall_btn},   1, 2, 1, 2, ['fill', 'expand'], [], 2, 2);    $self->{up_btn} = Gtk2::Button->new_from_stock ("up");    $self->{down_btn} = Gtk2::Button->new_from_stock ("down");    $self->{table1c} = new Gtk2::Table (1, 2, 1);    $self->{table1}->attach ($self->{table1c},          0, 1, 4, 5, [], [], 2, 2);    $self->{table1c}->attach ($self->{up_btn},          0, 1, 0, 1, ['fill'], [], 2, 2);    $self->{table1c}->attach ($self->{down_btn},        1, 2, 0, 1, ['fill'], [], 2, 2);    $self->{up_btn}->signal_connect ("clicked", \&UpBtn, $self);    $self->{down_btn}->signal_connect ("clicked", \&DownBtn, $self);    $self->{new_btn}->signal_connect ("clicked", \&NewBtn, $self);    $self->{modify_btn}->signal_connect ("clicked", \&ModifyBtn, $self);    $self->{delete_btn}->signal_connect ("clicked", \&DeleteBtn, $self);    $self->{deleteall_btn}->signal_connect ("clicked", \&DeleteAllBtn, $self);    $self->{scantv_btn}->signal_connect ("clicked", \&ScantvBtn, $self);        ### PAGE 2: GENERAL    $self->{table2} = new Gtk2::Table (4, 2, 0);    $self->{page2}->pack_start ($self->{table2}, 1, 1, 0);        #$self->{mplayer_path_label} = new Gtk2::Label ("mplayer:");    #$self->{mplayer_path_label}->set_alignment (0, 0);    #$self->{table2}->attach ($self->{mplayer_path_label},       0, 1, 1, 2, ['fill',], [], 2, 2);    #$self->{mplayer_path_ent} = new Gtk2::Entry ();    #$self->{mplayer_path_ent}->set_size_request (100, -1);    #$self->{mplayer_path_ent}->set_text ($self->{config}->{mplayer});

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -