having category like '$select';
EOF;

	//build feed for this specific group	
	error_log("selecting Group: $select", 0);

	$conditions = array('conditions' => array('basename like ? AND playgroup like ?', '%.mp4', $select));
	$rquery = array(
			'select'=>'recorded.*
			, ifnull(
				nullif(recorded.originalairdate,0)
				, makedate( (select airdate from recordedprogram where recordedprogram.chanid=recorded.chanid and recordedprogram.starttime=recorded.starttime),1 )
	    	) as airdate'
	);
	
	$record = Recorded::all( array_merge($rquery, $conditions) );	
	error_log("COUNT of RECORDED: ".count($record), 0);
	
	$video = VideoMetadata::find_by_sql( $SQL );
	error_log("COUNT of VIDEOMETADATA: ".count($video), 0);
	
	$items = array();
	$shows = array_values(array_merge($record, $video));
	foreach($shows as $item => $show ){
		$items[] = new item($show);
	}
	//usort($items, 'items_title_date_compare');
	usort($items, 'items_title_episode_compare');
	
	if(count($items)){
		$feed = new feed(
		case 'Today': $interval = '-1 DAY';break;
		case 'Week': $interval = '-7 DAY';break;
		case 'Month': $interval = '-1 MONTH';break;
		case 'Year': $interval = '-1 YEAR';break;
		case 'All': $interval = '-100 YEAR';break;
		default:
			break;
	}

	if(useUTC())
		$intervalQry = "starttime between adddate(utc_timestamp(), interval $interval) and utc_timestamp() ";
	else
		$intervalQry = "starttime between adddate(now(), interval $interval) and now() ";
	
	$conditions = array('conditions' => array("basename like ? AND $intervalQry", '%.mp4'));
	$record = Recorded::all( $conditions );
	error_log("COUNT of RECORDED: ".count($record), 0);
	
	$vselect = array('select' => '*, case releasedate when (releasedate is null) then insertdate else releasedate end as starttime');
	$conditions = array('conditions' => array("filename like ? AND host > ? HAVING $intervalQry", '%.m%4%', ''));
	$video = VideoMetadata::all( array_merge($vselect, $conditions) );
	error_log("COUNT of VIDEOMETADATA: ".count($video), 0);
	
	$items = array();
	$shows = array_values(array_merge($record, $video));
	usort($shows, 'shows_date_compare');
	foreach($shows as $item => $show ){
		$items[] = new item($show);
	}	
	
	if(count($items)){
Ejemplo n.º 3
0
<?php

//get the local info from the settings file
require_once 'settings.php';

if (isset($_GET['basename']))
{
    $basefname = $_GET['basename'];
    $conditions = array('conditions' => array('basename = ? ', $basefname));
    $recordings = Recorded::all($conditions);
    if(count($recordings) != 1) {
        error_log( "There are " . count($recordings) . " items with the basename: $basefname", 0 );
    }else{
        $recording = $recordings[0];
        
        error_log( "here we delete $recording->basename from the database.", 0 ); 
        $recording->delete();
        
        $fname = $recording->storagegroups->dirname . strtok($recording->basename, "."); 
        foreach(glob($fname . "*") as $file){
            error_log( "here we delete $file from the filesystem.", 0 ); 
            unlink($file);
        }
    }
}else{
    error_log("the 'basename' was not passed to this routine!", 0);
}

?>