Permalink
Browse files

heleboek fixes

  • Loading branch information...
1 parent c02dbfc commit 8e8373d1c312a5f7e6ec37adc486a55c9c3282fa skinkie committed Nov 3, 2008
Showing with 54 additions and 20 deletions.
  1. +14 −8 broadcast.php
  2. +2 −0 config.php
  3. +12 −8 functions.php
  4. +2 −0 html/index.css
  5. +20 −0 html/smil.js
  6. +1 −1 index.php
  7. +3 −3 toevoegen.php
View
@@ -49,13 +49,14 @@
}
sqlite_close($db);
+
$result = array_merge($vandaagresult, $contentresult, $colofonresult, $adsintro, $adsresult, $adsoutro);
// exec('/usr/bin/sudo -u broadcast sshfs -o nonempty -o allow_other tv@'.REMOTEHOST.':'.REMOTEDIR.' '.BROADCASTDIR);
-// $tmpdirectory = CACHEDIR.'/'.date('Y-m-d',$now);
- $tmpdirectory = CACHEDIR;
+ $tmpdirectory = CACHEDIR.'/'.date('Y-m-d',$now);
+// $tmpdirectory = CACHEDIR;
if (!file_exists($tmpdirectory)) {
if (!file_exists(CACHEDIR)) mkdir(CACHEDIR);
mkdir($tmpdirectory);
@@ -82,6 +83,7 @@
$fp = fopen($tmpdirectory.'/'.date('Y-m-d',$now).'.smil', 'w');
$rn = chr(13).chr(10);
+
fputs($fp, '<?xml version="1.0"?>'.$rn.
'<!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 2.0//EN" "http://www.w3.org/2001/SMIL20/SMIL20.dtd">'.$rn.
'<smil xmlns="http://www.w3.org/2001/SMIL20/Language" xmlns:rn="http://features.real.com/2001/SMIL20/Extensions">'.$rn.
@@ -99,14 +101,16 @@
if ($image['template'] == 'NOOD.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 {
if (defined('BUMPDURATION') && $current_cat != $image['category']) {
$current_cat = $image['category'];
$bump = $image['category'].'.png';
+ exec('cp "'.USER_IMAGEDIR.'/'.$bump.'" "'.$tmpdirectory.'/'.$bump.'"');
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" region="content" fill="remove" erase="whenDone" />'.chr(13).chr(10));
}
+
}
if ($image['template'] != 'video.xsl') {
@@ -142,12 +146,11 @@
$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));
+ fputs($fp, ' <img src="'.REMOTEDIR.'/cache/'.substr($bump, 0, -3).'jpg" 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));
+ fputs($fp, ' <img src="'.substr($image['src'], 0, -3).'jpg" 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));
}
@@ -162,16 +165,19 @@
if (!file_exists($tmpdirectory)) {
exec('mkdir '.$tmpdirectory);
}
+
+ exec('/usr/bin/mogrify -resize '.WEBRESOLUTIONW.'x'.WEBRESOLUTIONH.' -format jpg '.$tmpdirectory.'/*.png');
exec('mv -u '.$tmpdirectory.'/*.smil '.BROADCASTDIR.'/.');
exec('mv -u '.$tmpdirectory.'/*.html '.BROADCASTDIR.'/.');
-// exec('mv -u '.$tmpdirectory.'/*.png '.BROADCASTCACHEDIR.'/.');
+ exec('mv -u '.$tmpdirectory.'/*.jpg '.BROADCASTCACHEDIR.'/.');
+ exec('mv -u '.$tmpdirectory.'/*.png '.BROADCASTCACHEDIR.'/.');
exec('ln -sf /home/tv/broadcast/'.date('Y-m-d', $now).'.smil /home/tv/broadcast.smil');
// exec('/usr/bin/sudo -u broadcast ssh tv@'.REMOTEHOST.' ln -sf '.REMOTEDIR.'/'.date('Y-m-d', $now).'.smil broadcast.smil');
// exec('/usr/bin/sudo -u broadcast fusermount -u '.BROADCASTDIR);
// exec('/usr/bin/sudo -u broadcast ssh tv@'.REMOTEHOST.' ln -sf '.REMOTEDIR.'/'.date('Y-m-d', $now).'.smil broadcast.smil');
-// exec('rm -rf '.$tmpdirectory);
+ exec('rm -rf '.$tmpdirectory);
header('Location: index.php');
?>
View
@@ -15,5 +15,7 @@
define ('REMOTEDIR', 'broadcast');
define ('RESOLUTIONW', '1024');
define ('RESOLUTIONH', '768');
+ define ('WEBRESOLUTIONW', '400');
+ define ('WEBRESOLUTIONH', '300');
define ('EMERGENCY', false);
?>
View
@@ -184,13 +184,12 @@ function checkandgenerate($id=0, $safebox=0, $width=269, $height=200, $format='p
function checkandbroadcast($safebox=0, $width=RESOLUTIONW, $height=RESOLUTIONH, $format='png', $title, $para, $photo, $template, $category, $dir='', $filename='') {
-
$filename = ($filename!=''?$filename:md5($title.$para.$photo.$template.$category));
$dir = ($dir!=''?$dir:PREVIEWDIR);
$pngfile = $dir.'/'.$filename.'.png';
$pngremote = BROADCASTCACHEDIR.'/'.$filename.'.png';
- if (!file_exists($pngfile) || !file_exists($pngremote)) {
+ if (!(file_exists($pngfile) || file_exists($pngremote))) {
$category = ($category!=''?$category:'0');
$db = sqlite_open(DATABASE, 0666, $sqlerror);
@@ -201,9 +200,9 @@ function checkandbroadcast($safebox=0, $width=RESOLUTIONW, $height=RESOLUTIONH,
if (count($qresult)>=1) {
if ($qresult[0]['content_category_image.title']=='') {
- $newfilename = checkandpreview($safebox, $width, $height, $format='png', $title, $para, $photo, TEMPLATEDIR.'/'.$template, $dir, $filename, $qresult[0]['content_category.title']);
+ $newfilename = checkandpreview($safebox, $width, $height, $format, $title, $para, $photo, TEMPLATEDIR.'/'.$template, $dir, $filename, $qresult[0]['content_category.title']);
} else {
- $newfilename = checkandpreview($safebox, $width, $height, $format='png', $title, $para, $photo, TEMPLATEDIR.'/'.$template, $dir, $filename,
+ $newfilename = checkandpreview($safebox, $width, $height, $format, $title, $para, $photo, TEMPLATEDIR.'/'.$template, $dir, $filename,
$qresult[0]['content_category.title'],
$qresult[0]['content_category_image.photo'],
$qresult[0]['content_category_image.width'],
@@ -212,14 +211,15 @@ function checkandbroadcast($safebox=0, $width=RESOLUTIONW, $height=RESOLUTIONH,
$qresult[0]['content_category_image.y']);
}
}
- }
+ }
+
return $filename;
}
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);
- $file = $dir.'/'.$filename.$format;
+ $file = $dir.'/'.$filename.'.png';
if (!file_exists($file)) {
$category_xml = '<category><title>'.strtoupper($cat_title).'</title><img><src>'.($cat_photo!=''?USER_IMAGEDIR.'/'.$cat_photo:'').'</src>'.
@@ -256,9 +256,13 @@ function checkandpreview($safebox=0, $width=RESOLUTIONW, $height=RESOLUTIONH, $f
$xml = null;
- 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');
+ $debug = shell_exec('/usr/bin/inkscape -z --file='.$svgfile.' --export-width='.$width.' --export-height='.$height.' --export-png='.$file.' 2>&1 1>/dev/null');
+
+ if ($format != 'png') {
+ shell_exec('/usr/bin/convert -format '.$format.' '.$file);
}
+
+
unlink($svgfile);
}
return $filename;
View
@@ -0,0 +1,2 @@
+img { display: none; }
+body { background-size: 100%; }
View
@@ -0,0 +1,20 @@
+var x = 0;
+
+function start() {
+ images = document.getElementsByTagName('img');
+
+ if (images.length == 0) {
+ var t = setTimeout("window.location.reload()", 25000);
+ return;
+ }
+
+ if (x >= images.length) {
+ // window.location.reload();
+ x = 0;
+ }
+
+ var timeout = images[x].getAttribute('dur').replace(/s/, "000");
+ document.getElementsByTagName('body')[0].style.background = 'url('+images[x].getAttribute('src')+') no-repeat';
+ x++;
+ var t=setTimeout("start()", timeout);
+}
View
@@ -100,7 +100,7 @@
$seen = 0;
- if (($query1 = sqlite_query($db, 'SELECT count(contentid) FROM content_seens, editors WHERE contentid='.$entry['content.id'].' AND content_seens.editorid = editors.id AND login=\''.sqlite_escape_string($_SERVER['PHP_AUTH_USER']).'\'')) !== false ) {
+ if (($query1 = sqlite_query($db, 'SELECT count(contentid) FROM content_seens, editors WHERE contentid='.$entry['content.id'].' AND content_seens.editorid = editors.id AND login=\''.sqlite_escape_string($_SERVER['REMOTE_USER']).'\'')) !== false ) {
$seen = sqlite_fetch_all($query1, SQLITE_ASSOC);
$seen = $seen[0]['count(contentid)'];
}
View
@@ -13,7 +13,7 @@
$query = sqlite_query($db, 'SELECT start, end, enabled FROM content_run WHERE contentid = '.$_GET['databaseid'].';');
$result1 = sqlite_fetch_all($query, SQLITE_ASSOC);
- $query = sqlite_query($db, 'INSERT INTO content_seens (contentid, editorid) VALUES ('.$_GET['databaseid'].', (SELECT id FROM editors WHERE login=\''.sqlite_escape_string($_SERVER['PHP_AUTH_USER']).'\'));');
+ $query = sqlite_query($db, 'INSERT INTO content_seens (contentid, editorid) VALUES ('.$_GET['databaseid'].', (SELECT id FROM editors WHERE login=\''.sqlite_escape_string($_SERVER['REMOTE_USER']).'\'));');
sqlite_close($db);
if (count($result) > 0) {
newdocument();
@@ -95,8 +95,8 @@
$query = sqlite_query($db, 'SELECT editors.login FROM content_editor, editors WHERE content_editor.editorid=editors.id AND content_editor.contentid='.$_SESSION['document']['databaseid'].' ORDER BY content_editor.id DESC LIMIT 1;');
- if (($result = sqlite_fetch_all($query, SQLITE_ASSOC)) === false || ($result !== false && $result[0]['editors.login'] != $_SERVER['PHP_AUTH_USER'])) {
- sqlite_query($db, 'INSERT INTO content_editor (contentid, editorid) VALUES ('.$_SESSION['document']['databaseid'].', (SELECT id FROM editors WHERE login=\''.sqlite_escape_string($_SERVER['PHP_AUTH_USER']).'\'));');
+ if (($result = sqlite_fetch_all($query, SQLITE_ASSOC)) === false || ($result !== false && $result[0]['editors.login'] != $_SERVER['REMOTE_USER'])) {
+ sqlite_query($db, 'INSERT INTO content_editor (contentid, editorid) VALUES ('.$_SESSION['document']['databaseid'].', (SELECT id FROM editors WHERE login=\''.sqlite_escape_string($_SERVER['REMOTE_USER']).'\'));');
}
}

0 comments on commit 8e8373d

Please sign in to comment.