originally posted to freevo-devel Hello,
I've been trying to get my DVB card to work with Freevo, and have had quite a bit of success. I thought i might let people know what I did... Proably not as its intended to do, but anyhow..... . Installed the DVB drivers: http://www.linuxtv.org . Installed the DVB apps (szap/tzap) Read instructions on how to set up "channels.conf". Replaced all spaces in channel names with "_" . Recompiled mplayer with dvb support . Installed xmltv . installed freevo using the auto-installer. So now I have working mplayer so we can do: mplayer dvb://BBC_ONE Now I hacked some stuff together to try to get the DVB stuff into freevo. I may have done this completely wrong! . Set up the local_conf.py script # if using the persitant record_server RECORD_SCHEDULE = '%s/record_schedule.xml' % FREEVO_CACHEDIR RECORD_SERVER_IP = 'localhost' RECORD_SERVER_PORT = 18001 TV_CHANNELS = [ ( 'london.bbc1.bbc.co.uk', 'BBC1', 'BBC_ONE' ), ( 'london.bbc2.bbc.co.uk', 'BBC2', 'BBC_TWO' ), ( 'carlton.com', 'ITV1', 'ITV_1' ), ( 'channel4.com', 'Ch 4', 'Channel_4' ), ( 'channel5.co.uk', 'Five', 'five' ), ( 'choice.bbc.co.uk', 'BBC3', 'BBC_THREE' ), ( 'knowledge.bbc.co.uk', 'BBC4', 'BBC_FOUR' ), ( 'itv2.itv.co.uk', 'ITV2', 'ITV_2' ), ( 'cbbc.bbc.co.uk', 'CBBC', 'CBBC_Channel' ), ( 'cbeebies.bbc.co.uk', 'Cbeebies', 'CBeebies' ), ( 'ftn.tv', 'ftn', 'f_tn' ), ( 'the-hits.emap.com', 'Hits', 'The_HITS' ), ( 'tmf.nl', 'TMF', 'TMF' ), ( 'ukhistory.tv', 'UKHistory', 'UKHistory' ), ( 'itn.co.uk', 'ITV News', 'ITV_News' ), ( 'news-24.bbc.co.uk', 'News 24', 'BBC_NEWS_24' ), ( 'sky-news.sky.com', 'Sky News', 'Sky_News' ) ] XMLTV_GRABBER = 'tv_grab_uk_rt' # If you want to run tv_sort on your listings add the path to tv_sort here. # tv_sort will make sure all your programs have proper stop times, otherwise # programs might get cut off at midnight. XMLTV_SORT = '' # Number of days the grabber should get XMLTV_DAYS = 1 Now I wanted to get recording to work - Seemed that I could just run tzap, and then read the dvr0 stream to get an mpeg transport stream that mplayer could read. So, i wrote small perl script, dvb_record.pl (at end of mail), and added into local_conf.py VCR_CMD = ( '/home/richja/dev/perl/dvb_record.pl --channel %(channel)s --output %(filename)s.mpeg --duration %(seconds)s' ) Recording should now work... Now to get display of TV from epg. I added to local_conf.py ## This should be either 'tv' or 'dvb' TV_TYPE='dvb' Then patched two scripts: mplayer.py ( line 195 in release version (1.23)- just before elif mode == 'vcr': ) add the following elif mode == 'dvb': tuner_channel = self.TunerGetChannel() w,h = config.TV_VIEW_SIZE outfmt = 'outfmt=%s' % config.TV_VIEW_OUTFMT tvcmd = ( 'dvb://%s' % ( tuner_channel ) ) # Build the MPlayer command args = (config.MPLAYER_NICE, config.MPLAYER_CMD, config.MPLAYER_VO_DEV, config.MPLAYER_VO_DEV_OPTS, tvcmd) if config.MPLAYER_ARGS.has_key('dvb'): args += (config.MPLAYER_ARGS['dvb'],) mpl = '--prio=%s %s -vo %s%s -fs %s %s -slave' % args And in tvguide.py ( 1.19 ) , changed line 213 to self.player( config.TV_TYPE , self.selected.channel_id) Takes a few seconds to tune the channel, but works like a charm: Cheers James dvb_record.pl #!/usr/bin/perl # $Header$ use strict; use FindBin; use lib "$FindBin::Bin"; use Getopt::Long; use IO::Select; use FileHandle; use constant SZAP => "/home/richja/download/linuxtv-dvb-apps-1.1.0/util/szap/tzap"; use constant CHANNELS => "/home/richja/channels.conf"; use constant DEVICE => "/dev/dvb/adapter0/dvr0"; my %options; my $szap_pid = 0; sub Log { print join(":", @_ ); print "\n"; } sub Info { Log ( "Info", @_ ); } sub Error { Log ( "Error", @_); } sub Fatal { Log ( "Fatal", @_); exit(1);} sub Debug { Log ( "Debug", @_ ); } sub quit_nicely { my ( $sig ) = @_; Info ( "Got signal $sig..." ); if ( $szap_pid ) { Info ( "killing szap pid $szap_pid" ); kill 9, $szap_pid; } Info ( "Exiting" ); exit(1); } $SIG{CHLD} = sub { my $pid = wait; Debug ( 1, "Child $pid exited\n" ); }; $SIG{ALRM} = \&quit_nicely; $SIG{INT} = \&quit_nicely; $SIG{TERM} = \&quit_nicely; $SIG{HUP} = \&quit_nicely; sub parse_options { my @options = ( "channel=s", "output=s", "duration=i" ); # my %options; my $ok = 1; if (!GetOptions(\%options, @options) ) { Error ("$@"); return; } return 1; } sub run_szap { my ( $channel ) = @_; my @cmdline = ( "-r", "-c", CHANNELS, $channel ); if ( ! ( -e SZAP && -x _ ) ) { Error ( SZAP . " is not executable " ); return; } my $pid = fork(); if ( $pid == 0 ) { # This is the child open ( STDOUT, ">/dev/null" ); { exec SZAP, @cmdline; } Error ( "Couldn't run " . SZAP . " " . join(" ", @cmdline ) . " $@" ); return; } return $pid; } sub do_output { my ( $filename, $duration ) = @_; my $ofh = new FileHandle ( ">$filename" ); if ( ! $ofh ) { Fatal ( "Can't open $filename: $!" ); } my $ifh = new FileHandle ( DEVICE ); if ( ! $ifh ) { Fatal ( "Can't open DVB device " . DEVICE . " $! " ); } my $select = new IO::Select ( $ifh ); my $buffer = ""; my $bytes = 0; my $needexit = 0; alarm($duration); while ( 1 ) { my @ready = $select->can_read(5); if ( @ready == 0 ) { last; } foreach my $rfh ( @ready ) { $bytes = sysread ( $rfh, $buffer, 32768 ); if ( ! $bytes ) { # Something bad; last; } syswrite ( $ofh, $buffer ); $buffer = ""; } } } if ( ! parse_options() ) { Fatal ( "Can't parse command line: " ); } $szap_pid = run_szap ( $options{channel} ); if ( ! $szap_pid ) { Fatal ( "Can't tune channel" ); } sleep 5; do_output ( $options{output}, $options{duration} ); kill 9, $szap_pid; ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Freevo-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-users
