Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 1, 2008
1 parent 40842b7 commit c02dbfc
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
40 changes: 39 additions & 1 deletion broadcast.php
Expand Up @@ -105,7 +105,7 @@
$bump = $image['category'].'.png';
if (file_exists(USER_IMAGEDIR.'/'.$bump)) {
exec('rsync '.USER_IMAGEDIR.'/'.$bump.' '.BROADCASTCACHEDIR.'/'.$bump);
fputs($fp, ' <img src="'.REMOTEDIR.'/cache/'.$bump.'" alt="'.htmlspecialchars('Bump - '.$image['category'], ENT_QUOTES, 'UTF-8').'" dur="'.BUMPDURATION.'" region="content" fill="remove" erase="whenDone" />'.chr(13).chr(10));
fputs($fp, ' <img src="'.REMOTEDIR.'/cache/'.$bump.'" alt="'.htmlspecialchars('Bump - '.$image['category'], ENT_QUOTES, 'UTF-8').'" dur="'.BUMPDURATION.'s" region="content" fill="remove" erase="whenDone" />'.chr(13).chr(10));
}
}

Expand All @@ -122,10 +122,48 @@
fflush($fp);
fclose($fp);

$fp = fopen($tmpdirectory.'/index.html', 'w');
fputs($fp, '<?xml version="1.0" encoding="UTF-8"?>'.$rn.
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'.$rn.
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >'.$rn.
' <head>'.$rn.
' <title>PlusRTV</title>'.$rn.
' <script type="text/javascript" src="smil.js"></script>'.$rn.
' <link rel="stylesheet" href="index.css" type="text/css" />'.$rn.
' </head>'.$rn.
' <body onLoad="start();">'.$rn);
foreach ($out as $image) {
if (EMERGENCY) {
if ($image['template'] == 'NOOD.xsl') {
fputs($fp, ' <img src="'.$image['src'].'" alt="'.htmlspecialchars($image['title'], ENT_QUOTES, 'UTF-8').'" dur="'.$image['dur'].'s" />'.chr(13).chr(10));
}
} else {
if (defined('BUMPDURATION') && $current_cat != $image['category']) {
$current_cat = $image['category'];
$bump = $image['category'].'.png';
if (file_exists(USER_IMAGEDIR.'/'.$bump)) {
exec('rsync '.USER_IMAGEDIR.'/'.$bump.' '.BROADCASTCACHEDIR.'/'.$bump);
fputs($fp, ' <img src="'.REMOTEDIR.'/cache/'.$bump.'" alt="'.htmlspecialchars('Bump - '.$image['category'], ENT_QUOTES, 'UTF-8').'" dur="'.BUMPDURATION.'s" />'.chr(13).chr(10));
}
}
if ($image['template'] != 'video.xsl') {
fputs($fp, ' <img src="'.$image['src'].'" alt="'.htmlspecialchars($image['title'], ENT_QUOTES, 'UTF-8').'" dur="'.$image['dur'].'s" region="content" fill="remove" erase="whenDone" />'.chr(13).chr(10));
} else {
// fputs($fp, ' <video src="'.htmlspecialchars($image['title'], ENT_QUOTES, 'UTF-8').'" alt="Intermezzo" dur="'.$image['dur'].'s" region="content" fill="remove" erase="whenDone" />'.chr(13).chr(10));
}
}
}

fputs($fp, ' </body>'.$rn.
'</html>'.$rn);
fflush($fp);
fclose($fp);

if (!file_exists($tmpdirectory)) {
exec('mkdir '.$tmpdirectory);
}
exec('mv -u '.$tmpdirectory.'/*.smil '.BROADCASTDIR.'/.');
exec('mv -u '.$tmpdirectory.'/*.html '.BROADCASTDIR.'/.');
// exec('mv -u '.$tmpdirectory.'/*.png '.BROADCASTCACHEDIR.'/.');
exec('ln -sf /home/tv/broadcast/'.date('Y-m-d', $now).'.smil /home/tv/broadcast.smil');

Expand Down
5 changes: 3 additions & 2 deletions config.php
Expand Up @@ -9,9 +9,10 @@
define ('CACHEDIR', ABSOLUTEDIR.'/broadcast/cache');
define ('DATABASE', ABSOLUTEDIR.'/database/'.strtolower(OWNER).'-olifant.db');
define ('THEMESEQ', TRUE);
define ('BUMPDURATION', '10s');
define ('BUMPDURATION', 10);
define ('DURATION', 23);
define ('REMOTEHOST', '127.0.0.1');
define ('REMOTEDIR', '/home/tv/broadcast');
define ('REMOTEDIR', 'broadcast');
define ('RESOLUTIONW', '1024');
define ('RESOLUTIONH', '768');
define ('EMERGENCY', false);
Expand Down
12 changes: 7 additions & 5 deletions functions.php
Expand Up @@ -168,7 +168,7 @@ function newrun() {

function newpreview() {
unset($_SESSION['document'][0]);
$_SESSION['document'][0]['text_duration']=20;
$_SESSION['document'][0]['text_duration']=DURATION;
$_SESSION['document']['activeid']=0;
}

Expand Down Expand Up @@ -219,9 +219,9 @@ function checkandbroadcast($safebox=0, $width=RESOLUTIONW, $height=RESOLUTIONH,
function checkandpreview($safebox=0, $width=RESOLUTIONW, $height=RESOLUTIONH, $format='png', $title, $para, $photo, $template, $dir='', $filename='', $cat_title='', $cat_photo='', $cat_width=0, $cat_height=0, $cat_x=0, $cat_y=0) {
$filename = ($filename!=''?$filename:md5($title.$para.$photo.$template.$category));
$dir = ($dir!=''?$dir:PREVIEWDIR);
$pngfile = $dir.'/'.$filename.'.png';
$file = $dir.'/'.$filename.$format;

if (!file_exists($pngfile)) {
if (!file_exists($file)) {
$category_xml = '<category><title>'.strtoupper($cat_title).'</title><img><src>'.($cat_photo!=''?USER_IMAGEDIR.'/'.$cat_photo:'').'</src>'.
'<width>'.$cat_width.'</width>'.
'<height>'.$cat_height.'</height>'.
Expand Down Expand Up @@ -256,8 +256,10 @@ function checkandpreview($safebox=0, $width=RESOLUTIONW, $height=RESOLUTIONH, $f

$xml = null;

$debug = shell_exec('/usr/bin/inkscape -z --file='.$svgfile.' --export-width='.$width.' --export-height='.$height.' --export-png='.$pngfile.' 2>&1 1>/dev/null');
// unlink($svgfile);
if ($format == 'png') {
$debug = shell_exec('/usr/bin/inkscape -z --file='.$svgfile.' --export-width='.$width.' --export-height='.$height.' --export-png='.$file.' 2>&1 1>/dev/null');
}
unlink($svgfile);
}
return $filename;
}
Expand Down

0 comments on commit c02dbfc

Please sign in to comment.