Linux-DVB-DVBT-Advert

 view release on metacpan or  search on metacpan

lib/Linux/DVB/DVBT/Advert/Config.pm  view on Meta::CPAN

		'audio.max_advert',
		'audio.min_advert',
		'audio.min_program',
		'audio.start_pad',
		'audio.end_pad',
		'audio.min_frames',
		'audio.frame_window',
		'audio.max_gap',
		'audio.reduce_end',
		'audio.reduce_min_gap',
		'audio.increase_start',
		'audio.increase_min_gap',
		'',
    ],          
) ;


#============================================================================================
BEGIN {
	
	## Default for Linux::DVB::DVBT
	$DEFAULT_CONFIG_PATH = [ qw(/etc/dvb ~/.tv) ] ;
	
	my $home ;
	if ( exists $ENV{HOME} and defined $ENV{HOME} ) 
	{
        $home = $ENV{HOME};
    }
	
	## Check OS
	if ( $^O eq 'MSWin32' ) 
	{
		# All versions of Windows

		# Do we have a user profile?
		if ( !$home && exists $ENV{USERPROFILE} && $ENV{USERPROFILE} ) 
		{
			$home = $ENV{USERPROFILE};
		}
	
		# Some Windows use something like $ENV{HOME}
		if ( !$home && exists $ENV{HOMEDRIVE} && exists $ENV{HOMEPATH} && $ENV{HOMEDRIVE} && $ENV{HOMEPATH} ) 
		{
			$home = File::Spec->catpath($ENV{HOMEDRIVE}, $ENV{HOMEPATH}, '');
		}
		
		$DEFAULT_CONFIG_PATH = [] ;
		if ($home && -d $home)
		{
			$home =~ s%\\%/%g ;
			push @$DEFAULT_CONFIG_PATH, "$home/tv" ;
		}
		
		# add current dir
		push @$DEFAULT_CONFIG_PATH, "." ;
	} 
	elsif ( $^O eq 'darwin') 
	{
		if (!$home)
		{		
		    $home = (getpwuid($<))[7];
		}
		
		$DEFAULT_CONFIG_PATH = [] ;
		if ($home && -d $home)
		{
			push @$DEFAULT_CONFIG_PATH, "$home/tv" ;
		}
		
		# add current dir
		push @$DEFAULT_CONFIG_PATH, "." ;
	} 
	elsif ( $^O eq 'MacOS' ) 
	{
		if (!$home)
		{
			# On some platforms getpwuid dies if called at all
			local $SIG{'__DIE__'} = '';
			$home = (getpwuid($<))[7];
		}

		$DEFAULT_CONFIG_PATH = [] ;
		if ($home && -d $home)
		{
			push @$DEFAULT_CONFIG_PATH, "$home/tv" ;
		}
		
		# add current dir
		push @$DEFAULT_CONFIG_PATH, "." ;
	} 
	elsif ( ($^O eq 'linux') || ($^O eq 'cygwin') )
	{
		# Default to Linux::DVB::DVBT
	}
	else 
	{
		# Default to Unix semantics
		$DEFAULT_CONFIG_PATH = [ qw(/etc/dvb ~/.tv .) ] ;
	}
	
	
	
#print "Search Path:\n" ;
#foreach (@$DEFAULT_CONFIG_PATH)
#{
#	print "  $_\n" ;
#}

	
}

	

#============================================================================================

=head2 Functions

=over 4

=cut


#----------------------------------------------------------------------

=item B<read_dvb_adv( [$search_path] )>

Read the advert settings file and return a HASH ref containing the settings.

Optionally set the search path (see L</Config File Search Path>)

See L</Config File>
	
=cut

sub read_dvb_adv
{
	my ($search_path) = @_ ;

	$search_path ||= $DEFAULT_CONFIG_PATH ;



( run in 1.803 second using v1.01-cache-2.11-cpan-6aa56a78535 )