Linux-DVB-DVBT-Apps-QuartzPVR

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

	{
		$vars_list .= "$var " ;
	}
	
	$settings_href->{'_VARS_LIST_'} = $vars_list ;
	
}


#----------------------------------------------------------------------
sub update_install_script
{
	my ($tpl_install_script, $install_script, $settings_href) = @_ ;

	## Read in file
	my @lines ;
	{
	    local( $/ ) ;
    	open( my $fh, $tpl_install_script ) or die "Error: reading install script file $tpl_install_script : $!" ;
		my $lines = <$fh> ;
		close $fh ;

install/tpl/quartzpvr-install.pl  view on Meta::CPAN

		$sql = $app->data("sql") . $app->data("versions.sql") ;
		$sql =~ s/\%DATABASE\%/$settings_href->{'DATABASE'}/g ;
		
		mysql_runit($app, $password, $sql, "MySQL error while creating tables") ;
	}
	
	update_table_versions($app, $settings_href, \%table_versions)
}

#----------------------------------------------------------------------
sub update_table_versions
{
	my ($app, $settings_href, $latest_versions_href) = @_ ;

	my $table = 'versions' ;
	my $sql = "" ;
	foreach my $item (keys %$latest_versions_href)
	{
		$sql .= "UPDATE $settings_href->{DATABASE}.$table SET `version`='$latest_versions_href->{$item}' where `item` = '$item';\n" ;
	}

	my $password = $settings_href->{'SQL_ROOT_PASSWORD'} ;
	mysql_runit($app, $password, $sql, "MySQL error while updating table '$table' to set latest versions") ;
}





#----------------------------------------------------------------------
sub update_table_channels
{
	my ($app, $settings_href, $existing_version, $latest_version) = @_ ;

	my $table = 'channels' ;
	if ($existing_version lt '1.01')
	{
		my $password = $settings_href->{'SQL_ROOT_PASSWORD'} ;
		my $sql =<<SQL ;
ALTER TABLE  $settings_href->{DATABASE}.$table CHANGE  `chan_type` `chan_type` set('tv','radio','hd-tv') NOT NULL DEFAULT 'tv' COMMENT 'TV or Radio' ;
SQL
		mysql_runit($app, $password, $sql, "MySQL error while updating table '$table' to version $latest_version") ;
		
	}
}

#----------------------------------------------------------------------
sub update_table_iplay
{
	my ($app, $settings_href, $existing_version, $latest_version) = @_ ;

	# no op
}

#----------------------------------------------------------------------
sub update_table_listings
{
	my ($app, $settings_href, $existing_version, $latest_version) = @_ ;

	# no op
}

#----------------------------------------------------------------------
sub update_table_multirec
{
	my ($app, $settings_href, $existing_version, $latest_version) = @_ ;

	my $table = 'multirec' ;
	if ($existing_version eq '0')
	{
		my $password = $settings_href->{'SQL_ROOT_PASSWORD'} ;
		my $sql =<<SQL ;
ALTER TABLE  $settings_href->{DATABASE}.$table CHANGE  `adapter`  `adapter` VARCHAR( 16 ) NOT NULL DEFAULT  '0' ;
SQL
		mysql_runit($app, $password, $sql, "MySQL error while updating table '$table' to version $latest_version") ;
		
	}
}

#----------------------------------------------------------------------
sub update_table_record
{
	my ($app, $settings_href, $existing_version, $latest_version) = @_ ;

	my $table = 'record' ;
	if ($existing_version eq '0')
	{
		my $password = $settings_href->{'SQL_ROOT_PASSWORD'} ;
		my $sql =<<SQL ;
ALTER TABLE  $settings_href->{DATABASE}.$table DROP `episode`, DROP `num_episodes`, DROP `adapter` ;
SQL
		mysql_try_runit($app, $password, $sql) ;
		
	}
}

#----------------------------------------------------------------------
sub update_table_recorded
{
	my ($app, $settings_href, $existing_version, $latest_version) = @_ ;

	my $table = 'recorded' ;
	if ($existing_version eq '0')
	{
		my $password = $settings_href->{'SQL_ROOT_PASSWORD'} ;
		my $sql =<<SQL ;
ALTER TABLE  $settings_href->{DATABASE}.$table CHANGE  `adapter`  `adapter` VARCHAR( 16 ) NOT NULL DEFAULT  '0' ;
SQL
		mysql_runit($app, $password, $sql, "MySQL error while updating table '$table' to version $latest_version") ;
		
	}
}

#----------------------------------------------------------------------
sub update_table_schedule
{
	my ($app, $settings_href, $existing_version, $latest_version) = @_ ;

	my $table = 'schedule' ;
	if ($existing_version eq '0')
	{
		my $password = $settings_href->{'SQL_ROOT_PASSWORD'} ;
		my $sql =<<SQL ;
ALTER TABLE  $settings_href->{DATABASE}.$table CHANGE  `adapter`  `adapter` VARCHAR( 16 ) NOT NULL DEFAULT  '0' ;
SQL

lib/Linux/DVB/DVBT/Apps/QuartzPVR.pm  view on Meta::CPAN

	
		
		## Do the update
		$this->update() ;
	}
	
}

#--------------------------------------------------------------------------------------------
# Gathers all the latest information from the EPG database and the recordings database and re-schedules
sub update
{
	my $this = shift ;

	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgProf::startfn() ;
	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgTrace::trace_clear() ;

print "Linux::DVB::DVBT::Apps::QuartzPVR::update() : ".$this->date."\n" if $this->debug ;
	
	my $tvrec = $this->_tvrec ;
	my $tvreport = $this->_tvreport ;

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Crontab.pm  view on Meta::CPAN

	print "\n\nIPLAY Blocks:\n" ;
	foreach my $block (@record_blocks)
	{
		print "\n------------\n", $block->dump ;
	}
}


#---------------------------------------------------------------------
# Update crontab to match database 
sub update
{
	my ($recording_aref) = @_ ;

	## get existing blocks
	my @record_blocks = get_blocks($opts_href->{'crontag'}) ;

	## Remove existing blocks
	$ct->remove(@record_blocks) ;

	## Create new blocks
	create_blocks($recording_aref) ;

}

#---------------------------------------------------------------------
# Update crontab to match database 
sub update_iplay
{
	my ($recording_aref) = @_ ;

	## get existing blocks
	my @record_blocks = get_blocks($opts_href->{'crontag_iplay'}) ;

	## Remove existing blocks
	$ct->remove(@record_blocks) ;

	## Create new blocks

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Iplayer.pm  view on Meta::CPAN

	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgProf::endfn() ;

	return $entry_href ;
}



#---------------------------------------------------------------------
# Update cron jobs
#
sub update_cron
{
	my $this = shift ;
	my ($schedule_aref) = @_ ;

	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgTrace::startfn('update cron') ;
	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgProf::startfn() ;

	## Set cron
	Linux::DVB::DVBT::Apps::QuartzPVR::Crontab::update_iplay($schedule_aref) ;

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Iplayer.pm  view on Meta::CPAN

		{
			push @$schedule_aref, $href ;
		}
	}
}


#---------------------------------------------------------------------
# Replace all rids set to NEW_RID with the specified new value
#
sub update_rid
{
	my $this = shift ;
	my ($new_rid, $schedule_aref) = @_ ;
	
	foreach my $href (@$schedule_aref)
	{
		my @progs = ($href) ;
		foreach my $rec_href (@progs)
		{
			if ($rec_href->{'rid'} == $Linux::DVB::DVBT::Apps::QuartzPVR::Base::Constants::NEW_RID)

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Schedule.pm  view on Meta::CPAN

	
	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgProf::endfn() ;
	
	return @removed ;
}


#---------------------------------------------------------------------
# Update cron jobs
#
sub update_cron
{
	my $this = shift ;
	my ($schedule_aref) = @_ ;

	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgTrace::startfn('update cron') ;
	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgProf::startfn() ;

	## Set cron
	Linux::DVB::DVBT::Apps::QuartzPVR::Crontab::update($schedule_aref) ;

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Schedule.pm  view on Meta::CPAN

}


#---------------------------------------------------------------------
# Input: 
#	$schedule_aref - ARRAY ref of schedule format
#
# Propogates the DVB adapter number & the multiplex ID down into all progs contained
# in a multiplex recording
#
sub update_multiplex
{
	my $this = shift ;
	my ($schedule_aref, %options) = @_ ;

	my @FIELDS = qw/multid adapter timeslip/ ;
	
	foreach my $rec_href (@$schedule_aref)
	{
		# ensure defaults are set
		foreach my $field (@FIELDS)

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Schedule.pm  view on Meta::CPAN

			Linux::DVB::DVBT::Apps::QuartzPVR::Prog::set_times($rec_href) ;
		}
	}
	
	return @mux_schedule ;
}

#---------------------------------------------------------------------
# Replace all rids set to NEW_RID with the specified new value
#
sub update_rid
{
	my $this = shift ;
	my ($new_rid, $schedule_aref) = @_ ;
	
	foreach my $href (@$schedule_aref)
	{
		my @progs = ($href) ;
		if ($href->{'type'} eq 'multiplex')
		{
			@progs = @{$href->{'multiplex'}} ;

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Sql.pm  view on Meta::CPAN

print " + rid=$rid\n" if $this->debug ;
	
	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgTrace::add_rec($rec_href, "inserted - new rid $rid") ;
$this->sql->debug(0) ;
	
	return $rid ;
}

#---------------------------------------------------------------------------------------------------
# Update recording
sub update_recording
{
	my $this = shift ;
	my ($rec_href) = @_ ;
	
print "\n\n[update_recording]\n" if $this->debug ;
$this->sql->debug($this->debug) ;

	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgTrace::startfn('update_recording') ;

	# prepare search vars

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Sql.pm  view on Meta::CPAN

	
	# return results
	return @days ;
}



#---------------------------------------------------------------------
# Gets the latest scheduled recordings list from the database and also
# sets up various date/time values for later use
sub update_schedule_table
{
	my $this = shift ;
	my ($recording_aref) = @_ ;

$this->sql->debug($this->debug) ;

	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgTrace::startfn('update_schedule_table') ;

	my $tbl_schedule = $this->tbl_schedule ;
	my $tbl_multirec = $this->tbl_multirec ;

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Sql.pm  view on Meta::CPAN

	## Update recording recording - prune out old jobs
	$this->sql->sth_query('delete_old_recording') ;

$this->sql->debug(0) ;

}

#---------------------------------------------------------------------
# Gets the latest scheduled iplay recordings list from the database and also
# sets up various date/time values for later use
sub update_iplay_table
{
	my $this = shift ;
	my ($recording_aref) = @_ ;

$this->sql->debug($this->debug) ;

	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgTrace::startfn('update_iplay_table') ;

	my $tbl_iplay = $this->tbl_iplay ;

lib/Linux/DVB/DVBT/Apps/QuartzPVR/Sql.pm  view on Meta::CPAN

	my @list = $this->sql->sth_query_all('select_recorded') ;

$this->prt_data("[select_recorded] results=", \@list) if $this->debug ;
$this->sql->debug(0) ;

	return \@list ;	
}

#---------------------------------------------------------------------------------------------------
# Update an existing recorded entry - tracks recordings
sub update_recorded
{
	my $this = shift ;
	my ($rec_href) = @_ ;
	
print "\n\n[update_recorded] pid=$rec_href->{pid}, rectype=$rec_href->{rectype}\n" if $this->debug ;
$this->sql->debug($this->debug) if $this->debug >= 2 ;

	Linux::DVB::DVBT::Apps::QuartzPVR::Base::DbgTrace::startfn('update_recorded') ;

	# prepare search vars

plib/Makeutils.pm  view on Meta::CPAN

##-------------------------------------------------------------------------------------------
sub process_makeopts
{
	if ($Makeutils::UPDATE_MANIFEST)
	{
		update_manifest() ;
	}	
}

##-------------------------------------------------------------------------------------------
sub update_manifest
{
	## Read file
	my %manifest ;
	my $line ;
	open my $fh, "<MANIFEST" or die "Error: Unable to read MANIFEST file" ;
	while(defined($line = <$fh>))
	{
		chomp $line ;
		$line =~ s/[^[:ascii:]]/ /g;
		$line =~ s/^\s+// ;

scripts/dvbt-iplay  view on Meta::CPAN

		push @get, $href ;
	}

Linux::DVB::DVBT::prt_data("Get list=", \@get) if $DEBUG>=2 ;

	return @get ;
}

#-----------------------------------------------------------------------------
# Update the 'get' list with the latest download history
sub update_iplay
{
	my ($get_aref, $history_href) = @_ ;

print STDERR "update_iplay()\n" if $DEBUG ;		

	foreach my $entry_href (@$get_aref)
	{
		my $id = $entry_href->{'pid'} ;
		
		# check download history



( run in 0.441 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )