phphtmllib-devel Mailing List for phpHtmlLib (Page 10)
Status: Beta
Brought to you by:
hemna
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(33) |
Jul
(2) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
(3) |
Jun
(1) |
Jul
(10) |
Aug
(5) |
Sep
|
Oct
|
Nov
(2) |
Dec
(5) |
2004 |
Jan
(1) |
Feb
(8) |
Mar
(139) |
Apr
(65) |
May
(32) |
Jun
(55) |
Jul
(21) |
Aug
(60) |
Sep
(43) |
Oct
(1) |
Nov
(18) |
Dec
(34) |
2005 |
Jan
(25) |
Feb
(2) |
Mar
(49) |
Apr
(13) |
May
(40) |
Jun
(22) |
Jul
(21) |
Aug
(59) |
Sep
(178) |
Oct
(54) |
Nov
(3) |
Dec
(49) |
2006 |
Jan
(21) |
Feb
(1) |
Mar
(5) |
Apr
(29) |
May
(86) |
Jun
(79) |
Jul
(52) |
Aug
(127) |
Sep
(187) |
Oct
(90) |
Nov
(61) |
Dec
(48) |
2007 |
Jan
(79) |
Feb
(136) |
Mar
(58) |
Apr
(139) |
May
(293) |
Jun
(112) |
Jul
(138) |
Aug
(112) |
Sep
(148) |
Oct
(76) |
Nov
(29) |
Dec
(66) |
2008 |
Jan
(45) |
Feb
(60) |
Mar
(119) |
Apr
(169) |
May
(172) |
Jun
(136) |
Jul
(107) |
Aug
(114) |
Sep
(104) |
Oct
(26) |
Nov
(50) |
Dec
(48) |
2009 |
Jan
(9) |
Feb
(35) |
Mar
(22) |
Apr
(43) |
May
(83) |
Jun
(68) |
Jul
(58) |
Aug
(21) |
Sep
(23) |
Oct
(62) |
Nov
(36) |
Dec
(26) |
2010 |
Jan
(16) |
Feb
(83) |
Mar
(73) |
Apr
(51) |
May
(76) |
Jun
(96) |
Jul
(70) |
Aug
(33) |
Sep
(10) |
Oct
(1) |
Nov
(2) |
Dec
|
2011 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
(12) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
(3) |
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(5) |
Oct
(1) |
Nov
|
Dec
(1) |
2014 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
(3) |
Dec
|
2015 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <he...@us...> - 2009-12-01 17:57:52
|
Revision: 3316 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3316&view=rev Author: hemna Date: 2009-12-01 17:57:38 +0000 (Tue, 01 Dec 2009) Log Message: ----------- added Daemon info Modified Paths: -------------- trunk/phphtmllib/CHANGELOG Modified: trunk/phphtmllib/CHANGELOG =================================================================== --- trunk/phphtmllib/CHANGELOG 2009-12-01 06:08:48 UTC (rev 3315) +++ trunk/phphtmllib/CHANGELOG 2009-12-01 17:57:38 UTC (rev 3316) @@ -13,6 +13,7 @@ marked as final in the parent class. + Added DBDataObject Iterator support. - Fixes to SVG classes to make them work in php5. + + Changed Daemon class to use the new Log class. removed PEAR references as well version 3.0.2 - 03/18/08 - fixed a bug with RequestBuilder::get_url() when a RequestBuilder::set_file() was called. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-12-01 06:08:59
|
Revision: 3315 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3315&view=rev Author: hemna Date: 2009-12-01 06:08:48 +0000 (Tue, 01 Dec 2009) Log Message: ----------- small cleanup Modified Paths: -------------- trunk/open2300/bin/remote_update.php Modified: trunk/open2300/bin/remote_update.php =================================================================== --- trunk/open2300/bin/remote_update.php 2009-12-01 06:03:02 UTC (rev 3314) +++ trunk/open2300/bin/remote_update.php 2009-12-01 06:08:48 UTC (rev 3315) @@ -26,9 +26,6 @@ $wx = weatherDataObject::find("1=1 order by datetime desc"); //now construct the url call -$url = "http://".$GLOBALS['config']->get("remote_server_name"). - "/?target=remote-update"; - $log->debug("remote_update: called"); //var_dump($wx); $rb = new RequestBuilder("RemoteUpdate"); @@ -41,13 +38,11 @@ } $url = html_entity_decode($rb->get_url()); -//echo($url."\n\n"); -//var_dump(strlen($url)); -//echo(html_entity_decode($url)."\n"); $opts = array( 'http' => array('timeout' => 15)); $context = stream_context_create($opts); +var_dump($context); var_dump(file_get_contents($url,0,$context)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-12-01 06:03:17
|
Revision: 3314 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3314&view=rev Author: hemna Date: 2009-12-01 06:03:02 +0000 (Tue, 01 Dec 2009) Log Message: ----------- enable sending to dev. also added timeout to the file_get_contents() Modified Paths: -------------- trunk/open2300/bin/remote_update.php Modified: trunk/open2300/bin/remote_update.php =================================================================== --- trunk/open2300/bin/remote_update.php 2009-12-01 05:53:29 UTC (rev 3313) +++ trunk/open2300/bin/remote_update.php 2009-12-01 06:03:02 UTC (rev 3314) @@ -44,6 +44,33 @@ //echo($url."\n\n"); //var_dump(strlen($url)); //echo(html_entity_decode($url)."\n"); -var_dump(file_get_contents($url)); +$opts = array( + 'http' => array('timeout' => 15)); +$context = stream_context_create($opts); + +var_dump(file_get_contents($url,0,$context)); + + +if ($GLOBALS['config']->get('send_to_dev') == true) { + $url2 = "wxdev.hemna.com"; + $rb = new RequestBuilder("RemoteUpdate"); + $rb->set_server($url2); + $rb->set_url_type(Request::URL_TYPE_ABSOLUTE); + + //now construct the uri call + foreach($wx as $key => $value) { + $rb->set($key, $value); + } + + $url = html_entity_decode($rb->get_url()); + $log->debug("Remote DEBUG updated calling : ".$url); + echo($url."\n\n"); + //var_dump(strlen($url)); + //echo(html_entity_decode($url)."\n"); + var_dump(file_get_contents($url,0,$context)); +} + + + ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-12-01 05:53:35
|
Revision: 3313 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3313&view=rev Author: hemna Date: 2009-12-01 05:53:29 +0000 (Tue, 01 Dec 2009) Log Message: ----------- same Modified Paths: -------------- trunk/phphtmllib/src/mvc/Daemon.inc Modified: trunk/phphtmllib/src/mvc/Daemon.inc =================================================================== --- trunk/phphtmllib/src/mvc/Daemon.inc 2009-12-01 05:52:20 UTC (rev 3312) +++ trunk/phphtmllib/src/mvc/Daemon.inc 2009-12-01 05:53:29 UTC (rev 3313) @@ -108,7 +108,7 @@ $this->pid_file = $this->generate_pid_filename(); //initialize the logger - $this->set_logger(get_logger()); + $this->set_logger($this->get_logger()); //something to clean stuff up. register_shutdown_function(array(&$this, 'release_daemon')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-12-01 05:52:29
|
Revision: 3312 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3312&view=rev Author: hemna Date: 2009-12-01 05:52:20 +0000 (Tue, 01 Dec 2009) Log Message: ----------- java creep error. ugh Modified Paths: -------------- trunk/phphtmllib/src/mvc/Daemon.inc Modified: trunk/phphtmllib/src/mvc/Daemon.inc =================================================================== --- trunk/phphtmllib/src/mvc/Daemon.inc 2009-12-01 05:49:29 UTC (rev 3311) +++ trunk/phphtmllib/src/mvc/Daemon.inc 2009-12-01 05:52:20 UTC (rev 3312) @@ -108,7 +108,7 @@ $this->pid_file = $this->generate_pid_filename(); //initialize the logger - set_logger(get_logger()); + $this->set_logger(get_logger()); //something to clean stuff up. register_shutdown_function(array(&$this, 'release_daemon')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-12-01 05:49:39
|
Revision: 3311 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3311&view=rev Author: hemna Date: 2009-12-01 05:49:29 +0000 (Tue, 01 Dec 2009) Log Message: ----------- nuked log_message() Modified Paths: -------------- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc Modified: trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc =================================================================== --- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-12-01 05:48:23 UTC (rev 3310) +++ trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-12-01 05:49:29 UTC (rev 3311) @@ -10,7 +10,7 @@ * @author waboring * */ -class AviProcessorDaemon extends Daemon { +class AviProcessorDaemon extends ScheduleDaemon { /** * User ID @@ -21,121 +21,130 @@ * Group ID */ protected $group_id = 100; - + /** * how long to wait in between * processing. in seconds */ protected $wait_period = 1800; - - + + /** * the log object. */ protected $log; - + protected $imagesdir; - + /** * track the number of images we are * processing. If we have the same number * as last run...no need to process. */ protected $image_count = 0; - - + + /** + * we need to return the logger. + * + */ + protected function get_logger() { + $log = new Log(); + $log->add_writer(FileLogWriter::factory(realpath($GLOBALS["path_base"])."/logs/daemon.log")); + + return $log; + } + + + /** * Do any initialization here. * */ protected function init() { - $this->log = new Log(); - $this->log->add_writer(FileLogWriter::factory(realpath($GLOBALS["path_base"])."/logs/daemon.log")); - - $config = Config::singleton(); + $config = Config::singleton(); $this->imagesdir = $config->get("imagesdir"); } - + /** * any cleanup here */ protected function cleanup() { } - - /** - * This method is used to pause the scheduler so - * we aren't constantly running as fast as we can. - * - */ - protected function wait_state() { - $this->log->debug("::wait_state() sleeping for ".$this->wait_period." seconds"); - sleep($this->wait_period); - } - - - /** - * do the actual work here. - * - */ - protected function do_task() { - //now do a wait state - //so we aren't constantly running. - $this->wait_state(); + protected function can_run() { + //used for directory $ymdDate = date("Ymd"); + + $dirname = $this->imagesdir."/".$ymdDate; - $dirname = $this->imagesdir."/".$ymdDate; //make sure the images dir exists. $this->test_images_dir($dirname); - - $num_images = $this->count_images($dirname); + $num_images = $this->count_images($dirname); + $this->num_images = $num_images; + if ($num_images == 0 || ($num_images == $this->image_count)) { - //we have nothing to do - $this->log->info("::do_task() no images or same count"); + $this->log->info("::can_run() no images or same count"); + return false; } else { + $this->log->info("::do_task() found ".$num_images." to process into a movie."); - $rate = $this->calculate_rate($num_images); - - $this->log->info("::do_task() rate is ".$rate." -> movie length = ".$num_images/$rate."s"); - //generate the avi - $cmd = "/home/waboring/bin/imgs2avi.sh -w 640 -h 480 -r ".$rate; - $this->exec_command($dirname, $cmd); + return true; + } + } + + + /** + * do the actual work here. + * + */ + protected function schedule() { + + //used for directory + $ymdDate = date("Ymd"); + + $dirname = $this->imagesdir."/".$ymdDate; + + $rate = $this->calculate_rate($this->num_images); + + $this->log->info("::do_task() rate is ".$rate." -> movie length = ".$this->num_images/$rate."s"); + //generate the avi + $cmd = "/home/waboring/bin/imgs2avi.sh -w 640 -h 480 -r ".$rate; + $this->exec_command($dirname, $cmd); - //now convert the avi movie to a flash file - $aviname = "timelapse_640x480_".$rate."fps.avi"; - $cmd = "/usr/bin/ffmpeg -y -i ".$aviname." -b 1900k -f flv ".$ymdDate."/timelapse.flv"; - $this->exec_command($dirname, $cmd); + //now convert the avi movie to a flash file + $aviname = "timelapse_640x480_".$rate."fps.avi"; + $cmd = "/usr/bin/ffmpeg -y -i ".$aviname." -b 1900k -f flv ".$ymdDate."/timelapse.flv"; + $this->exec_command($dirname, $cmd); - //move the + //move the - //now send it to the hosting provider - //$cmd = "/usr/bin/scp timelapse.flv wx.hemna.com:wx.hemna.com/htdocs/video/".$ymdDate; - $cmd = "/usr/bin/rsync -av ".$ymdDate." wx.hemna.com:wx.hemna.com/htdocs/video"; - $this->exec_command($dirname, $cmd); + //now send it to the hosting provider + //$cmd = "/usr/bin/scp timelapse.flv wx.hemna.com:wx.hemna.com/htdocs/video/".$ymdDate; + $cmd = "/usr/bin/rsync -av ".$ymdDate." wx.hemna.com:wx.hemna.com/htdocs/video"; + $this->exec_command($dirname, $cmd); - //track the image count - $this->image_count = $num_images; - } + //track the image count + $this->image_count = $num_images; } - + /** * This is used to execute an external command - * + * */ protected function exec_command($dirname, $cmd) { $command = "cd ".$dirname."; ".$cmd." 2>&1 >>".$dirname."/processing.log"; $this->log->info("::exec_command() exec ".$command); $last_line = system($command, $return); - $this->log->debug("::exec_command() done"); + $this->log->debug("::exec_command() done"); } - + /** * calculate the frame rate to use based * on the # of images we have to process. - * + * * @param $numimages * @return rate */ @@ -152,13 +161,13 @@ } else if ($num_images < 1200) { $rate = 25; } - + return $rate; } - - + + /** * Find out how many images are in the dir * @@ -166,11 +175,11 @@ */ protected function count_images($dirname) { $count = 0; - + $this->log->debug("::count_images() : check ".$dirname); if (file_exists($dirname)) { if ($dir = opendir($dirname)) { - while (($file = readdir($dir)) !== false) { + while (($file = readdir($dir)) !== false) { if (strstr($file, '.jpg')) { $count++; } @@ -178,12 +187,12 @@ closedir($dir); } } - + $this->log->debug("::count_images() : found ".$count); return $count; } - - + + /** * make sure the video dir exists. * @@ -193,9 +202,9 @@ $this->create_dir($dirname); $ymdDate = date("Ymd"); $this->create_dir($dirname."/".$ymdDate); - } + } } - + /** * Create the image directory * (this is also done from the camera) @@ -210,24 +219,19 @@ throw $ex; } } - - - - - /** - * Create the process id file on disk - * so that we can store it for later use. - * - * @return string - */ - public function generate_pid_filename() { - return realpath($GLOBALS["path_base"]).'/bin/'.__CLASS__.'.pid'; - } - - protected function log_message($message, - $level=0, - $e=NULL) { - } + + + + + /** + * Create the process id file on disk + * so that we can store it for later use. + * + * @return string + */ + public function generate_pid_filename() { + return realpath($GLOBALS["path_base"]).'/bin/'.__CLASS__.'.pid'; + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-12-01 05:48:31
|
Revision: 3310 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3310&view=rev Author: hemna Date: 2009-12-01 05:48:23 +0000 (Tue, 01 Dec 2009) Log Message: ----------- revert changes Modified Paths: -------------- trunk/phphtmllib/src/request/RequestBuilder.inc Modified: trunk/phphtmllib/src/request/RequestBuilder.inc =================================================================== --- trunk/phphtmllib/src/request/RequestBuilder.inc 2009-12-01 05:44:32 UTC (rev 3309) +++ trunk/phphtmllib/src/request/RequestBuilder.inc 2009-12-01 05:48:23 UTC (rev 3310) @@ -285,7 +285,7 @@ //this is an absolute request. $url = $this->get_protocol().$this->get_server().Request::SLASH.$this->get_file(); if (($query = $this->get_query_string()) && $query != '?') { - $url .= $this->get_query_string(); + $url .= Request::SLASH.$this->get_query_string(); } return $url; } else { @@ -294,7 +294,7 @@ if ($file) { $url = $file; if (($query = $this->get_query_string()) && $query != '?') { - $url .= $this->get_query_string(); + $url .= Request::SLASH.$this->get_query_string(); } return $url; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-12-01 05:44:43
|
Revision: 3309 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3309&view=rev Author: hemna Date: 2009-12-01 05:44:32 +0000 (Tue, 01 Dec 2009) Log Message: ----------- removed PEAR deps. Daemon children now use the Log class provided by phphtmllib Modified Paths: -------------- trunk/phphtmllib/src/mvc/Daemon.inc trunk/phphtmllib/src/mvc/ScheduleDaemon.inc trunk/phphtmllib/src/request/RequestBuilder.inc Modified: trunk/phphtmllib/src/mvc/Daemon.inc =================================================================== --- trunk/phphtmllib/src/mvc/Daemon.inc 2009-11-27 18:45:13 UTC (rev 3308) +++ trunk/phphtmllib/src/mvc/Daemon.inc 2009-12-01 05:44:32 UTC (rev 3309) @@ -84,6 +84,13 @@ const SIGTERM = 15; const SIGCHLD = 17; const SIGSTOP = 19; + + + /** + * Holds the Log object for + * logging messages. + */ + protected $log = null; /** * The constructor. @@ -99,6 +106,9 @@ //generate the PID filename //bassed off of the child class. $this->pid_file = $this->generate_pid_filename(); + + //initialize the logger + set_logger(get_logger()); //something to clean stuff up. register_shutdown_function(array(&$this, 'release_daemon')); @@ -116,18 +126,6 @@ /** - * Logs message - * - * @param string $message - * @param int $level (PEAR LOG level) - * @param Exception $exception - * @return void - */ - abstract protected function log_message($message, $level=PEAR_LOG_DEBUG, - $exception=NULL); - - - /** * This method is used to generate * the PID filename based off of the * name of the child class. @@ -152,6 +150,22 @@ * */ abstract protected function cleanup(); + + + /** + * This method is used to initialize the + * log class used. + */ + abstract protected function get_logger(); + + + /** + * set the logger used by this class + * + */ + protected final function set_logger(Log $log) { + $this->log = $log; + } /** @@ -160,7 +174,7 @@ * @return boolean */ public function start() { - $this->log_message('::start()'); + $this->log->debug('::start()'); //if it fails, we'll have an exception thrown. //caller needs to deal w/ it. @@ -176,8 +190,7 @@ $this->do_task(); $this->run_count++; } else { - $this->log_message("::reached max run count ".$this->run_count. ' '.$this->max_runs, - PEAR_LOG_INFO); + $this->log->info("::reached max run count ".$this->run_count. ' '.$this->max_runs); $this->disable(); } //lets touch the pid file to prove we @@ -188,7 +201,7 @@ //make sure we cleanly exit $this->cleanup(); - $this->log_message('::start() exiting.'); + $this->log->debug('::start() exiting.'); return true; } @@ -200,7 +213,7 @@ * @return void */ protected final function disable() { - $this->log_message('::disable()'); + $this->log->debug('::disable()'); $this->is_running = false; } @@ -216,7 +229,7 @@ * @return boolean */ public final function stop() { - $this->log_message('::stop() called'); + $this->log->debug('::stop() called'); $running_pid = @file_get_contents($this->pid_file); if (!$running_pid) { @@ -311,7 +324,7 @@ * Are we already running? */ public function is_daemon_running() { - $this->log_message('::is_daemon_running()'); + $this->log->debug('::is_daemon_running()'); $oldPid = @file_get_contents($this->pid_file); if ($oldPid !== false && posix_kill(trim($oldPid),0)) { @@ -329,16 +342,16 @@ * @return boolean. */ protected final function fork() { - $this->log_message('::fork()'); + $this->log->debug('::fork()'); $pid = pcntl_fork(); if ($pid == -1) { //oopsie. - $this->log_message('::fork() - Could not fork'); + $this->log->err('::fork() - Could not fork'); return false; } else if ($pid) { - $this->log_message('::fork() - calling exit()'); + $this->log->err('::fork() - calling exit()'); exit(); } else { //children? @@ -373,21 +386,21 @@ switch ($signal) { case self::SIGTERM: // Shutdown - $this->log_message(__CLASS__.'::SIGTERM signal'); + $this->log->info(__CLASS__.'::SIGTERM signal'); //let the loop know we must quit $this->disable(); break; case self::SIGSTOP: // Shutdown - $this->log_message(__CLASS__.'::SIGSTOP signal'); + $this->log->info(__CLASS__.'::SIGSTOP signal'); //let the loop know we must quit $this->disable(); break; case self::SIGCHLD: // Halt - $this->log_message(__CLASS__.' Child Halt signal'); + $this->log->info(__CLASS__.' Child Halt signal'); while (pcntl_waitpid(-1, $status, WNOHANG) > 0); break; } @@ -402,7 +415,7 @@ */ public final function release_daemon() { if ($this->is_child && file_exists($this->pid_file)) { - $this->log_message('::Releasing daemon'); + $this->log->debug('::Releasing daemon'); //nuke the PID file. unlink($this->pid_file); @@ -433,11 +446,11 @@ */ protected function touch_pid_file() { if (!file_exists($this->pid_file)) { - $this->log_message("::touch_pid_file() ".$this->pid_file." doesn't exist"); + $this->log->info("::touch_pid_file() ".$this->pid_file." doesn't exist"); } touch($this->pid_file, time()); - } + } } ?> \ No newline at end of file Modified: trunk/phphtmllib/src/mvc/ScheduleDaemon.inc =================================================================== --- trunk/phphtmllib/src/mvc/ScheduleDaemon.inc 2009-11-27 18:45:13 UTC (rev 3308) +++ trunk/phphtmllib/src/mvc/ScheduleDaemon.inc 2009-12-01 05:44:32 UTC (rev 3309) @@ -85,7 +85,7 @@ //first check local limits if ($this->can_run()) { //we can run - $this->log_message("::schedule()", PEAR_LOG_INFO); + $this->log->info("::schedule()"); //try and find a new item to work on. //and process it. @@ -102,8 +102,8 @@ public function start() { //make sure the suppression file doesn't exist if (file_exists($this->suppression_filename)) { - $this->log_message('::start() not starting because of suppression file '. - $this->suppression_filename, PEAR_LOG_INFO); + $this->log->info('::start() not starting because of suppression file '. + $this->suppression_filename); } else { //it's ok to start. parent::start(); @@ -119,10 +119,10 @@ */ public function test_daemon($script) { $pid_filename = $this->generate_pid_filename(); - $this->log_message("::test_daemon() ".$pid_filename, PEAR_LOG_INFO); + $this->log->info("::test_daemon() ".$pid_filename); if (file_exists($this->suppression_filename)) { - $this->log_message('::test_daemon() not starting because of suppression file '. + $this->log->debug('::test_daemon() not starting because of suppression file '. $this->suppression_filename); return; } @@ -133,8 +133,7 @@ try { $this->restart_daemon($script); } catch (Exception $e) { - $this->log_message("::test_daemon() ".$pid_filename." doesn't exist..restarted ".$script, - PEAR_LOG_WARNING); + $this->log->warning("::test_daemon() ".$pid_filename." doesn't exist..restarted ".$script); } return; } @@ -143,14 +142,14 @@ //ok file exists...make sure it's still alive. $cmd = "ps --no-heading -p ".$pid." -o cmd | grep ".$script; - $this->log_message("::test_daemon() running ".$cmd); + $this->log->debug("::test_daemon() running ".$cmd); $res = exec($cmd); if (strlen($res) <= 0) { try { $this->restart_daemon($script); } catch (Exception $e) { - $this->log_message(get_class($this)."::test_daemon() ".$pid_filename." wasn't running..restarted ".$script . " ".$e->getMessage(), - PEAR_LOG_WARNING); + $this->log->warning(get_class($this)."::test_daemon() ". + $pid_filename." wasn't running..restarted ".$script . " ".$e->getMessage()); } } } @@ -163,7 +162,7 @@ */ public function restart_daemon($script) { $cmd = "/usr/local/bin/php -f ".$script." </dev/null >/dev/null 2>&1"; - $this->log_message("::restart_daemon(".$script.") - ".$cmd); + $this->log->info("::restart_daemon(".$script.") - ".$cmd); $output = ''; $return = 0; exec($cmd, $output, $return); @@ -181,7 +180,7 @@ * Make sure you call enable_start() to clean up the file. */ public function disable_start() { - $this->log_message('::disable_start()', PEAR_LOG_INFO); + $this->log->info('::disable_start()'); if (!touch($this->suppression_filename)) { throw new DaemonException(get_class($this).'::disable_start() failed to create suppression file - '. $this->suppression_filename); @@ -194,7 +193,7 @@ * */ public function enable_start() { - $this->log_message('::enable_start()', PEAR_LOG_INFO); + $this->log->info('::enable_start()'); if (file_exists($this->suppression_filename)) { if (!unlink($this->suppression_filename)) { throw new DaemonException(get_class($this).'::disable_start() failed to create suppression file - '. @@ -210,8 +209,8 @@ * */ protected function wait_state() { - $this->log_message("::wait_state() for ".$this->wait_period." seconds", - PEAR_LOG_INFO); + $this->log->debug("::wait_state() for ".$this->wait_period." seconds"); + sleep($this->wait_period); } Modified: trunk/phphtmllib/src/request/RequestBuilder.inc =================================================================== --- trunk/phphtmllib/src/request/RequestBuilder.inc 2009-11-27 18:45:13 UTC (rev 3308) +++ trunk/phphtmllib/src/request/RequestBuilder.inc 2009-12-01 05:44:32 UTC (rev 3309) @@ -285,7 +285,7 @@ //this is an absolute request. $url = $this->get_protocol().$this->get_server().Request::SLASH.$this->get_file(); if (($query = $this->get_query_string()) && $query != '?') { - $url .= Request::SLASH.$this->get_query_string(); + $url .= $this->get_query_string(); } return $url; } else { @@ -294,7 +294,7 @@ if ($file) { $url = $file; if (($query = $this->get_query_string()) && $query != '?') { - $url .= Request::SLASH.$this->get_query_string(); + $url .= $this->get_query_string(); } return $url; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-27 19:42:50
|
Revision: 3308 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3308&view=rev Author: hemna Date: 2009-11-27 18:45:13 +0000 (Fri, 27 Nov 2009) Log Message: ----------- fixed server var issue Modified Paths: -------------- trunk/phphtmllib.newsblob.com/htdocs/downloads/download.php Modified: trunk/phphtmllib.newsblob.com/htdocs/downloads/download.php =================================================================== --- trunk/phphtmllib.newsblob.com/htdocs/downloads/download.php 2009-11-27 16:41:32 UTC (rev 3307) +++ trunk/phphtmllib.newsblob.com/htdocs/downloads/download.php 2009-11-27 18:45:13 UTC (rev 3308) @@ -36,7 +36,7 @@ try { $db = phphtmllibDB::singleton(); $db->insert('user_downloads', - array( 'ip_address' => $HTTP_SERVER_VARS["REMOTE_ADDR"], + array( 'ip_address' => $_SERVER["REMOTE_ADDR"], 'version_id' => $version_do->get_version_id( ) )); } catch (Exception $e) { //failed to insert for some reason This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-27 16:41:42
|
Revision: 3307 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3307&view=rev Author: hemna Date: 2009-11-27 16:41:32 +0000 (Fri, 27 Nov 2009) Log Message: ----------- added tracking code Modified Paths: -------------- trunk/open2300/lib/core/page/open2300Page.inc Modified: trunk/open2300/lib/core/page/open2300Page.inc =================================================================== --- trunk/open2300/lib/core/page/open2300Page.inc 2009-11-26 20:24:00 UTC (rev 3306) +++ trunk/open2300/lib/core/page/open2300Page.inc 2009-11-27 16:41:32 UTC (rev 3307) @@ -169,6 +169,10 @@ $this->add( html_comment( "MAIN BODY BLOCK BEGIN") ); $this->add( $this->main_block() ); $this->add( html_comment( "MAIN BODY BLOCK END") ); + + $this->add( html_comment( "tracking code BEGIN")); + $this->add( $this->tracking_code() ); + $this->add( html_comment( "tracking code END")); } /** @@ -221,6 +225,29 @@ $footer_div, html_comment( "FOOTER BLOCK END")); } + + + + /** + * Add the piwik tracking js shite + * + */ + protected function tracking_code() { + $str = '<!-- Piwik --> +<script type="text/javascript"> +var pkBaseURL = (("https:" == document.location.protocol) ? "https://wx.hemna.com/piwik/" : "http://wx.hemna.com/piwik/"); +document.write(unescape("%3Cscript src=\'" + pkBaseURL + "piwik.js\' type=\'text/javascript\'%3E%3C/script%3E")); +</script><script type="text/javascript"> +try { +var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1); +piwikTracker.trackPageView(); +piwikTracker.enableLinkTracking(); +} catch( err ) {} +</script><noscript><p><img src="http://wx.hemna.com/piwik/piwik.php?idsite=1" style="border:0" alt=""/></p></noscript> +<!-- End Piwik Tag -->'; + + return $str; + } /***********************/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-26 20:24:06
|
Revision: 3306 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3306&view=rev Author: hemna Date: 2009-11-26 20:24:00 +0000 (Thu, 26 Nov 2009) Log Message: ----------- updated time format Modified Paths: -------------- trunk/open2300/bin/avi_daemon.php Modified: trunk/open2300/bin/avi_daemon.php =================================================================== --- trunk/open2300/bin/avi_daemon.php 2009-11-26 20:19:59 UTC (rev 3305) +++ trunk/open2300/bin/avi_daemon.php 2009-11-26 20:24:00 UTC (rev 3306) @@ -123,7 +123,7 @@ $daemon = new AviProcessorDaemon(); -$date = date("Y m d H:i:s"); +$date = "[".date(DATE_RFC822)."]"; switch ($command) { default: case 'start': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-26 20:20:06
|
Revision: 3305 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3305&view=rev Author: hemna Date: 2009-11-26 20:19:59 +0000 (Thu, 26 Nov 2009) Log Message: ----------- added timestamp Modified Paths: -------------- trunk/open2300/bin/avi_daemon.php Modified: trunk/open2300/bin/avi_daemon.php =================================================================== --- trunk/open2300/bin/avi_daemon.php 2009-11-26 17:43:07 UTC (rev 3304) +++ trunk/open2300/bin/avi_daemon.php 2009-11-26 20:19:59 UTC (rev 3305) @@ -123,18 +123,18 @@ $daemon = new AviProcessorDaemon(); - +$date = date("Y m d H:i:s"); switch ($command) { default: case 'start': - echo "Starting Scheduler\n"; + echo $date." Starting Scheduler\n"; try { $daemon->start(); } catch (Exception $e) { if ($e->getCode() != DaemonException::ERR_ALREADY_RUNNING) { throw $e; } else { - echo $e->getMessage()."\n"; + echo $date." ".$e->getMessage()."\n"; } } @@ -142,12 +142,12 @@ case 'kill': case 'stop': - echo "Stopping Daemon\n"; + echo $date." Stopping Daemon\n"; try { $daemon->stop(); } catch (Exception $e) { - echo $e->getMessage()."\n"; + echo $date." ".$e->getMessage()."\n"; } break; } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-26 17:43:13
|
Revision: 3304 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3304&view=rev Author: hemna Date: 2009-11-26 17:43:07 +0000 (Thu, 26 Nov 2009) Log Message: ----------- ; Modified Paths: -------------- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc Modified: trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc =================================================================== --- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-26 17:42:03 UTC (rev 3303) +++ trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-26 17:43:07 UTC (rev 3304) @@ -192,7 +192,7 @@ if (!file_exists($dirname)) { $this->create_dir($dirname); $ymdDate = date("Ymd"); - $this->create_dir($dirname."/".$ymdDate) + $this->create_dir($dirname."/".$ymdDate); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-26 17:42:12
|
Revision: 3303 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3303&view=rev Author: hemna Date: 2009-11-26 17:42:03 +0000 (Thu, 26 Nov 2009) Log Message: ----------- use rsync instead of scp Modified Paths: -------------- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc Modified: trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc =================================================================== --- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-26 03:15:02 UTC (rev 3302) +++ trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-26 17:42:03 UTC (rev 3303) @@ -106,11 +106,14 @@ //now convert the avi movie to a flash file $aviname = "timelapse_640x480_".$rate."fps.avi"; - $cmd = "/usr/bin/ffmpeg -y -i ".$aviname." -b 1900k -f flv timelapse.flv"; + $cmd = "/usr/bin/ffmpeg -y -i ".$aviname." -b 1900k -f flv ".$ymdDate."/timelapse.flv"; $this->exec_command($dirname, $cmd); + + //move the //now send it to the hosting provider - $cmd = "/usr/bin/scp timelapse.flv wx.hemna.com:wx.hemna.com/htdocs/video/".$ymdDate; + //$cmd = "/usr/bin/scp timelapse.flv wx.hemna.com:wx.hemna.com/htdocs/video/".$ymdDate; + $cmd = "/usr/bin/rsync -av ".$ymdDate." wx.hemna.com:wx.hemna.com/htdocs/video"; $this->exec_command($dirname, $cmd); //track the image count @@ -187,7 +190,9 @@ */ protected function test_images_dir($dirname) { if (!file_exists($dirname)) { - $this->create_img_dir($dirname); + $this->create_dir($dirname); + $ymdDate = date("Ymd"); + $this->create_dir($dirname."/".$ymdDate) } } @@ -196,7 +201,7 @@ * (this is also done from the camera) * */ - protected function create_img_dir($dirname) { + protected function create_dir($dirname) { $this->log->info("Creating directory (".$dirname.")"); $ret = mkdir($dirname); if (!$ret) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-26 03:15:22
|
Revision: 3302 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3302&view=rev Author: hemna Date: 2009-11-26 03:15:02 +0000 (Thu, 26 Nov 2009) Log Message: ----------- track image count Modified Paths: -------------- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc Modified: trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc =================================================================== --- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-25 22:30:53 UTC (rev 3301) +++ trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-26 03:15:02 UTC (rev 3302) @@ -35,6 +35,13 @@ protected $log; protected $imagesdir; + + /** + * track the number of images we are + * processing. If we have the same number + * as last run...no need to process. + */ + protected $image_count = 0; /** @@ -85,9 +92,9 @@ $num_images = $this->count_images($dirname); - if ($num_images == 0) { + if ($num_images == 0 || ($num_images == $this->image_count)) { //we have nothing to do - $this->log->info("::do_task() found no images to process"); + $this->log->info("::do_task() no images or same count"); } else { $this->log->info("::do_task() found ".$num_images." to process into a movie."); $rate = $this->calculate_rate($num_images); @@ -105,6 +112,9 @@ //now send it to the hosting provider $cmd = "/usr/bin/scp timelapse.flv wx.hemna.com:wx.hemna.com/htdocs/video/".$ymdDate; $this->exec_command($dirname, $cmd); + + //track the image count + $this->image_count = $num_images; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-25 22:31:23
|
Revision: 3301 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3301&view=rev Author: hemna Date: 2009-11-25 22:30:53 +0000 (Wed, 25 Nov 2009) Log Message: ----------- small updates Modified Paths: -------------- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc Modified: trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc =================================================================== --- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-25 22:24:20 UTC (rev 3300) +++ trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-25 22:30:53 UTC (rev 3301) @@ -26,7 +26,7 @@ * how long to wait in between * processing. in seconds */ - protected $wait_period = 5; + protected $wait_period = 1800; /** @@ -78,8 +78,6 @@ //used for directory $ymdDate = date("Ymd"); - - $hour = date("G"); $dirname = $this->imagesdir."/".$ymdDate; //make sure the images dir exists. @@ -107,10 +105,7 @@ //now send it to the hosting provider $cmd = "/usr/bin/scp timelapse.flv wx.hemna.com:wx.hemna.com/htdocs/video/".$ymdDate; $this->exec_command($dirname, $cmd); - } - - $this->log->info("Exiting"); - exit; + } } /** @@ -119,8 +114,9 @@ */ protected function exec_command($dirname, $cmd) { $command = "cd ".$dirname."; ".$cmd." 2>&1 >>".$dirname."/processing.log"; - $this->log->info("::do_task() exec ".$command); - $last_line = system($command, $return); + $this->log->info("::exec_command() exec ".$command); + $last_line = system($command, $return); + $this->log->debug("::exec_command() done"); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-25 22:24:27
|
Revision: 3300 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3300&view=rev Author: hemna Date: 2009-11-25 22:24:20 +0000 (Wed, 25 Nov 2009) Log Message: ----------- for the daemon Modified Paths: -------------- trunk/open2300/lib/autoload.inc Modified: trunk/open2300/lib/autoload.inc =================================================================== --- trunk/open2300/lib/autoload.inc 2009-11-25 22:23:15 UTC (rev 3299) +++ trunk/open2300/lib/autoload.inc 2009-11-25 22:24:20 UTC (rev 3300) @@ -1,7 +1,7 @@ <?php /** * This is an auto-generated file. Please do not modify! - * Generated on 2009-10-14T09:29:30-07:00 by AutoloadGenerator + * Generated on 2009-11-25T12:43:57-08:00 by AutoloadGenerator * * @package open2300 */ @@ -33,6 +33,7 @@ 'AjaxStandardFormContent'=>'external/phphtmllib/src/form/AjaxStandardFormContent.inc', 'ArrayDataListSource'=>'external/phphtmllib/src/datalist/datalistsource/ArrayDataListSource.inc', 'AutoloadGenerator'=>'external/phphtmllib/src/generator/AutoloadGenerator.inc', +'AviProcessorDaemon'=>'core/daemon/AviProcessorDaemon.inc', 'BlueTheme'=>'external/phphtmllib/data/css/BlueTheme.inc', 'BusinessObject'=>'external/phphtmllib/src/business/BusinessObject.inc', 'BusinessObjectException'=>'external/phphtmllib/src/business/BusinessObjectException.inc', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-25 22:23:30
|
Revision: 3299 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3299&view=rev Author: hemna Date: 2009-11-25 22:23:15 +0000 (Wed, 25 Nov 2009) Log Message: ----------- added Added Paths: ----------- trunk/open2300/lib/core/daemon/ trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc Added: trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc =================================================================== --- trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc (rev 0) +++ trunk/open2300/lib/core/daemon/AviProcessorDaemon.inc 2009-11-25 22:23:15 UTC (rev 3299) @@ -0,0 +1,222 @@ +<?php + +/** + * This class is responsible for processing + * the daily dir of images into an flv + * and shipping it off to the hosting provider + * where wx.hemna.com lives. + * + * + * @author waboring + * + */ +class AviProcessorDaemon extends Daemon { + + /** + * User ID + */ + protected $user_id = 1000; + + /** + * Group ID + */ + protected $group_id = 100; + + /** + * how long to wait in between + * processing. in seconds + */ + protected $wait_period = 5; + + + /** + * the log object. + */ + protected $log; + + protected $imagesdir; + + + /** + * Do any initialization here. + * + */ + protected function init() { + $this->log = new Log(); + $this->log->add_writer(FileLogWriter::factory(realpath($GLOBALS["path_base"])."/logs/daemon.log")); + + $config = Config::singleton(); + $this->imagesdir = $config->get("imagesdir"); + } + + /** + * any cleanup here + */ + protected function cleanup() { + + } + + /** + * This method is used to pause the scheduler so + * we aren't constantly running as fast as we can. + * + */ + protected function wait_state() { + $this->log->debug("::wait_state() sleeping for ".$this->wait_period." seconds"); + sleep($this->wait_period); + } + + + /** + * do the actual work here. + * + */ + protected function do_task() { + //now do a wait state + //so we aren't constantly running. + $this->wait_state(); + + //used for directory + $ymdDate = date("Ymd"); + + $hour = date("G"); + + $dirname = $this->imagesdir."/".$ymdDate; + //make sure the images dir exists. + $this->test_images_dir($dirname); + + + $num_images = $this->count_images($dirname); + if ($num_images == 0) { + //we have nothing to do + $this->log->info("::do_task() found no images to process"); + } else { + $this->log->info("::do_task() found ".$num_images." to process into a movie."); + $rate = $this->calculate_rate($num_images); + + $this->log->info("::do_task() rate is ".$rate." -> movie length = ".$num_images/$rate."s"); + //generate the avi + $cmd = "/home/waboring/bin/imgs2avi.sh -w 640 -h 480 -r ".$rate; + $this->exec_command($dirname, $cmd); + + //now convert the avi movie to a flash file + $aviname = "timelapse_640x480_".$rate."fps.avi"; + $cmd = "/usr/bin/ffmpeg -y -i ".$aviname." -b 1900k -f flv timelapse.flv"; + $this->exec_command($dirname, $cmd); + + //now send it to the hosting provider + $cmd = "/usr/bin/scp timelapse.flv wx.hemna.com:wx.hemna.com/htdocs/video/".$ymdDate; + $this->exec_command($dirname, $cmd); + } + + $this->log->info("Exiting"); + exit; + } + + /** + * This is used to execute an external command + * + */ + protected function exec_command($dirname, $cmd) { + $command = "cd ".$dirname."; ".$cmd." 2>&1 >>".$dirname."/processing.log"; + $this->log->info("::do_task() exec ".$command); + $last_line = system($command, $return); + } + + /** + * calculate the frame rate to use based + * on the # of images we have to process. + * + * @param $numimages + * @return rate + */ + protected function calculate_rate($num_images) { + $rate = 30; + if ($num_images < 10) { + $rate = 1; + } else if ($num_images < 100) { + $rate = 10; + } else if ($num_images < 400) { + $rate = 15; + } else if ($num_images < 800) { + $rate = 20; + } else if ($num_images < 1200) { + $rate = 25; + } + + return $rate; + } + + + + + /** + * Find out how many images are in the dir + * + * @return int + */ + protected function count_images($dirname) { + $count = 0; + + $this->log->debug("::count_images() : check ".$dirname); + if (file_exists($dirname)) { + if ($dir = opendir($dirname)) { + while (($file = readdir($dir)) !== false) { + if (strstr($file, '.jpg')) { + $count++; + } + } + closedir($dir); + } + } + + $this->log->debug("::count_images() : found ".$count); + return $count; + } + + + /** + * make sure the video dir exists. + * + */ + protected function test_images_dir($dirname) { + if (!file_exists($dirname)) { + $this->create_img_dir($dirname); + } + } + + /** + * Create the image directory + * (this is also done from the camera) + * + */ + protected function create_img_dir($dirname) { + $this->log->info("Creating directory (".$dirname.")"); + $ret = mkdir($dirname); + if (!$ret) { + $ex = new DaemonException("couldn't create directory (".$dirname.")"); + $this->log->err("Failed to creat directory", $ex); + throw $ex; + } + } + + + + + /** + * Create the process id file on disk + * so that we can store it for later use. + * + * @return string + */ + public function generate_pid_filename() { + return realpath($GLOBALS["path_base"]).'/bin/'.__CLASS__.'.pid'; + } + + protected function log_message($message, + $level=0, + $e=NULL) { + } +} + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-25 22:22:39
|
Revision: 3298 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3298&view=rev Author: hemna Date: 2009-11-25 22:22:29 +0000 (Wed, 25 Nov 2009) Log Message: ----------- added Added Paths: ----------- trunk/open2300/bin/avi_daemon.php Added: trunk/open2300/bin/avi_daemon.php =================================================================== --- trunk/open2300/bin/avi_daemon.php (rev 0) +++ trunk/open2300/bin/avi_daemon.php 2009-11-25 22:22:29 UTC (rev 3298) @@ -0,0 +1,153 @@ +#!/usr/local/bin/php +<?php +/** + * This script is used to update the open2300 + * website that runs on a different machine + * from the wx station. + * + * @package open2300 + */ + +$lib_path = realpath('../lib'); +ini_set('include_path', '.:/usr/local/lib:/usr/share/php/:'.$lib_path); + +define('PHPHTMLLIB', realpath('../lib/external/phphtmllib')); +$GLOBALS['path_base'] = realpath('..'); + +// autoload function for all our classes +require($GLOBALS['path_base'].'/lib/autoload.inc'); + +// setup error handling and required parameters +require($GLOBALS['path_base'].'/lib/init.inc'); + +$config->set('uncaught_exception_output', 'txt'); + +//other includes... +require_once('Console/Getargs.php'); + +//We have to process this stuff PRIOR to includes +//to properly set the MAC_ADDRESS and EMAILLABS_APP_TYPE env var. +/** + * The list of support command line options + */ +$arg_config = array('start' => array( + 'short' => 's', + 'min' => 0, + 'max' => 0, + 'desc' => 'Start the daemon. This is the default'), + 'kill' => array( + 'short' => 'k', + 'min' => 0, + 'max' => 0, + 'desc' => 'Gracefully kill/stop the daemon. Cleanup is done prior to exit. '. + 'If the daemon cron checker is still running, then the scheduler '. + 'daemon will get automatically restarted.'), + 'clean' => array( + 'short' => 'c', + 'min' => 0, + 'max' => 0, + 'desc' => 'Run Daemon cleanup. This nukes the db locks for this host. '. + 'This is automatically done internally when the daemon is '. + 'started or shut down'), + 'disable' => array( + 'short' => 'd', + 'min' => 0, + 'max' => 0, + 'desc' => 'Disable the daemon from starting. '. + 'This writes a file to disk, which start() looks for to enable '. + 'daemonizing'), + 'enable' => array( + 'short' => 'e', + 'min' => 0, + 'max' => 0, + 'desc' => 'Enable the daemon to be started. '. + 'This deletes the suppression file created by disable.'), +); + + +//command parser +$cmd =& Console_Getargs::factory($arg_config); +//qqq($args); +if ( PEAR::isError($cmd) ) { + if ( $cmd->getCode() === CONSOLE_GETARGS_ERROR_USER ) { + echo Console_Getargs::getHelp($arg_config, null, $cmd->getMessage())."\n"; + } else if ( $cmd->getCode() === CONSOLE_GETARGS_HELP ) { + echo Console_Getargs::getHelp($arg_config)."\n"; + } + exit; +} + +$start = $cmd->getValue('start'); +$kill = $cmd->getValue('kill'); +$clean = $cmd->getValue('clean'); +$enable = $cmd->getValue('enable'); +$disable = $cmd->getValue('disable'); + +function use_error() { + global $arg_config; + + echo "Only 1 command at a time\n\n"; + echo Console_Getargs::getHelp($arg_config)."\n"; + exit; +} + +//make sure we only have 1 command +if ($start) { + if ($kill || $clean || $enable || $disable) { + use_error(); + } + $command = 'start'; +} else if ($kill) { + if ($start || $clean || $enable || $disable) { + use_error(); + } + $command = 'kill'; +} else if ($clean) { + if ($start || $kill || $enable || $disable) { + use_error(); + } + $command = 'clean'; +} else if ($disable) { + if ($start || $kill || $enable || $clean) { + use_error(); + } + $command = 'disable'; +} else if ($enable) { + if ($start || $kill || $disable || $clean) { + use_error(); + } + $command = 'enable'; +} else { + $command = 'start'; +} + + +$daemon = new AviProcessorDaemon(); + +switch ($command) { + default: + case 'start': + echo "Starting Scheduler\n"; + try { + $daemon->start(); + } catch (Exception $e) { + if ($e->getCode() != DaemonException::ERR_ALREADY_RUNNING) { + throw $e; + } else { + echo $e->getMessage()."\n"; + } + + } + break; + + case 'kill': + case 'stop': + echo "Stopping Daemon\n"; + try { + $daemon->stop(); + } catch (Exception $e) { + echo $e->getMessage()."\n"; + } + break; +} +?> \ No newline at end of file Property changes on: trunk/open2300/bin/avi_daemon.php ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-25 17:46:22
|
Revision: 3297 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3297&view=rev Author: hemna Date: 2009-11-25 17:46:12 +0000 (Wed, 25 Nov 2009) Log Message: ----------- formatting Modified Paths: -------------- trunk/open2300/htdocs/css/main.css Modified: trunk/open2300/htdocs/css/main.css =================================================================== --- trunk/open2300/htdocs/css/main.css 2009-11-25 17:43:41 UTC (rev 3296) +++ trunk/open2300/htdocs/css/main.css 2009-11-25 17:46:12 UTC (rev 3297) @@ -22,18 +22,18 @@ } #idPageHeadText { - width: 100%; - text-align:center; + width: 100%; + text-align:center; font-size:1.4em; font-weight:bold; - padding-top:8px; + padding-top:8px; } #idPageSubHeadText { - width: 100%; - text-align:center; + width: 100%; + text-align:center; font-size:.6em; - padding-top:0px; + padding-top:0px; } @@ -61,35 +61,35 @@ .wx { padding:2px; background-color: #eeeeee; - border: 1px solid #aaaaaa; + border: 1px solid #aaaaaa; } #idCurrentConditions { - font-size: .6em; + font-size: .6em; } #idCurrentConditionscontents{ - border: 1px solid #000088; + border: 1px solid #000088; } #idCurrentConditionscontents .cctitle { - font-size: .8em; - font-weight:bold; - background-color: #000088; - color: #ffffff; - padding:2px; - margin:1px; + font-size: .8em; + font-weight:bold; + background-color: #000088; + color: #ffffff; + padding:2px; + margin:1px; } #idcclastupdate { - background-color: #efefef; - padding:2px; - margin:1px; + background-color: #efefef; + padding:2px; + margin:1px; } .linkrefresh,.linkrefresh:visited { - color:#ffffff; -} + color:#ffffff; +} #idCamDiv { border: 1px solid #000088; @@ -98,16 +98,17 @@ } #idCamDiv .camtitle { - font-size: .6em; - font-weight:bold; - background-color: #000088; - color: #ffffff; - padding:2px; - margin:1px; + font-size: .6em; + font-weight:bold; + background-color: #000088; + color: #ffffff; + padding:2px; + margin:1px; } #idCamDiv #idCamTitle a:active,a:visited,a:link { color:#ffffff; + font-weight:bold; font-family: arial, helvetica, sans-serif; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-25 17:43:49
|
Revision: 3296 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3296&view=rev Author: hemna Date: 2009-11-25 17:43:41 +0000 (Wed, 25 Nov 2009) Log Message: ----------- added flash file time update Modified Paths: -------------- trunk/open2300/lib/modules/home/page/HomePage.inc Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2009-11-24 23:58:51 UTC (rev 3295) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2009-11-25 17:43:41 UTC (rev 3296) @@ -227,18 +227,21 @@ $cam_img_div = new DIVtag(array('id' => 'idCamImgDiv'), $cam_img); - $cam_title_div = new DIVtag(array('id' => 'idCamTitle', 'class' => 'camtitle'), 'Cam Updates from 4am to 10pm PST', - ' '); + $cam_title_div = new DIVtag(array('id' => 'idCamTitle', 'class' => 'camtitle'), 'Updates from 4am to 10pm PST', + ' '); //only show the flash overlay if we //have today's video file on disk - if (file_exists("/home/waboring/wx.hemna.com/htdocs/video/".$curdate."/timelapse.flv")) { + $filename = "/home/waboring/wx.hemna.com/htdocs/video/".$curdate."/timelapse.flv"; + if (file_exists($filename)) { $cam_href = new Atag(array('href' => '/video/player.swf?file=/video/'.$curdate.'/timelapse.flv&autostart=1', 'class' => 'lightview', 'rel' => 'flash', 'title' => 'TimeLapse :: '.$curdate.' :: width:640, height:480'), "View Timelapse Video"); $cam_href->set_collapse(true); $cam_title_div->add($cam_href); - $cam_title_div->add(" every 30 min"); + $filetime = date ("H:i:s", filemtime($filename)); + $cam_title_div->add(" "); + $cam_title_div->add(new SPANtag(array('style' => 'font-size: .7em'), "(Updated ".$filetime." )")); } $cam_div = new DIVtag(array('id' => 'idCamDiv', 'style' => 'padding-bottom:10px;margin-bottom:5px;'), $cam_title_div, $cam_img_div); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-24 23:59:04
|
Revision: 3295 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3295&view=rev Author: hemna Date: 2009-11-24 23:58:51 +0000 (Tue, 24 Nov 2009) Log Message: ----------- small cleanup Modified Paths: -------------- trunk/open2300/htdocs/js/main.js Modified: trunk/open2300/htdocs/js/main.js =================================================================== --- trunk/open2300/htdocs/js/main.js 2009-11-24 17:22:54 UTC (rev 3294) +++ trunk/open2300/htdocs/js/main.js 2009-11-24 23:58:51 UTC (rev 3295) @@ -18,8 +18,7 @@ },2); new PeriodicalExecuter(function(pe) { - d = new Date(); - new Ajax.Updater('idCurrentConditions','/?ajax=1&ajaxid=idCurrentConditions&target=current-conditions&junk='+d.getSeconds() , + new Ajax.Updater('idCurrentConditions','/?ajax=1&ajaxid=idCurrentConditions&target=current-conditions&junk='+get_junk() , {method:'get',asynchronous:true,evalScripts:true, onComplete: function() { new Effect.Highlight('idcclastupdate', {duration: 5.0}); @@ -29,11 +28,11 @@ 63); new PeriodicalExecuter(function(pe) { - d = new Date(); + var junk = get_junk(); Effect.Fade('idTempDewLineGraph', {duration: 0.5, afterFinish: function() { img = new Image(); - img.src = '/?target=temp-dew-point-line-graph&junk='+d.getTime(); + img.src = '/?target=temp-dew-point-line-graph&junk='+junk; img.id='idTempDewLineGraph'; $('idTempDewLineGraphdiv').update(); $('idTempDewLineGraphdiv').appendChild(img); @@ -43,7 +42,7 @@ Effect.Fade('idPressureLineGraph', {duration: 0.6, afterFinish: function() { img = new Image(); - img.src = '/?target=pressure-line-graph&junk='+d.getTime(); + img.src = '/?target=pressure-line-graph&junk='+junk; img.id='idPressureLineGraph'; $('idPressureLineGraphdiv').update(); $('idPressureLineGraphdiv').appendChild(img); @@ -53,7 +52,7 @@ Effect.Fade('idRainLineGraph', {duration: 0.7, afterFinish: function() { img = new Image(); - img.src = '/?target=rain-line-graph&junk='+d.getTime(); + img.src = '/?target=rain-line-graph&junk='+junk; img.id='idRainLineGraph'; $('idRainLineGraphdiv').update(); $('idRainLineGraphdiv').appendChild(img); @@ -63,7 +62,7 @@ Effect.Fade('idWindSpeedLineGraph', {duration: 0.7, afterFinish: function() { img = new Image(); - img.src = '/?target=wind-speed-line-graph&junk='+d.getTime(); + img.src = '/?target=wind-speed-line-graph&junk='+junk; img.id='idWindSpeedLineGraph'; $('idWindSpeedLineGraphdiv').update(); $('idWindSpeedLineGraphdiv').appendChild(img); @@ -72,7 +71,7 @@ Effect.Fade('idRadarImg', {duration: 0.7, afterFinish: function() { img = new Image(); - img.src = "http://radblast-mi.wunderground.com/cgi-bin/radar/WUNIDS_map?station=DAX&brand=wui&num=1&delay=15&type=N0R&frame=0&scale=0.326&noclutter=0&t=1235942643&lat=38.81977081&lon=-121.02596283&label=Pilot+Hill%2C+CA&showstorms=0&map.x=400&map.y=240¢erx=145¢ery=359&transx=-255&transy=119&showlabels=1&severe=0&rainsnow=0&lightning=0&smooth=0&junk="+d.getTime(); + img.src = "http://radblast-mi.wunderground.com/cgi-bin/radar/WUNIDS_map?station=DAX&brand=wui&num=1&delay=15&type=N0R&frame=0&scale=0.326&noclutter=0&t=1235942643&lat=38.81977081&lon=-121.02596283&label=Pilot+Hill%2C+CA&showstorms=0&map.x=400&map.y=240¢erx=145¢ery=359&transx=-255&transy=119&showlabels=1&severe=0&rainsnow=0&lightning=0&smooth=0&junk="+junk; img.id='idRadarImg'; img.width=480; img.height=320; @@ -83,11 +82,17 @@ }, 65); + + //update the image + new PeriodicalExecuter(function(pe) { + var img = $('idCamImg'); + img.src="http://wx.hemna.com/cam/cam.jpg?junk="+get_junk(); + },30); + } function start_weather_dl_updates() { - set_orig_time(new Date()); var counter = new PeriodicalExecuter(function() { @@ -99,28 +104,28 @@ conds['ages'] = time.getSeconds() - orig_time.getSeconds(); $('idUpdateSeconds').update(convertTime(new_ts - orig_ts)); -},2); + },2); - new PeriodicalExecuter(function(pe) { - d = new Date(); - new Ajax.Updater('idCurrentConditions','/?ajax=1&ajaxid=idCurrentConditions&target=current-conditions&junk='+d.getSeconds() , + new PeriodicalExecuter(function(pe) { + new Ajax.Updater('idCurrentConditions','/?ajax=1&ajaxid=idCurrentConditions&target=current-conditions&junk='+get_junk() , {method:'get',asynchronous:true,evalScripts:true, onComplete: function() { new Effect.Highlight('idcclastupdate', {duration: 5.0}); set_orig_time(new Date()); }}) - }, - 63); - + }, + 63); } - new PeriodicalExecuter(function(pe) { - d = new Date(); - img = $('idCamImg'); - img.src="http://wx.hemna.com/cam/cam.jpg?junk="+d.getSeconds(); - }, - 30); + + + +function get_junk() { + var d = new Date(); + return d.getDate()+d.getHours()+d.getSeconds(); +} + function set_orig_time(new_time) { orig_time = new_time; orig_ts =Math.round(orig_time.getTime()/1000); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-24 17:23:03
|
Revision: 3294 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3294&view=rev Author: hemna Date: 2009-11-24 17:22:54 +0000 (Tue, 24 Nov 2009) Log Message: ----------- added caption Modified Paths: -------------- trunk/open2300/lib/modules/home/page/HomePage.inc Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2009-11-24 17:21:19 UTC (rev 3293) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2009-11-24 17:22:54 UTC (rev 3294) @@ -234,7 +234,7 @@ //have today's video file on disk if (file_exists("/home/waboring/wx.hemna.com/htdocs/video/".$curdate."/timelapse.flv")) { $cam_href = new Atag(array('href' => '/video/player.swf?file=/video/'.$curdate.'/timelapse.flv&autostart=1', 'class' => 'lightview', - 'rel' => 'flash', 'title' => 'TimeLapse :: Test :: width:640, height:480'), + 'rel' => 'flash', 'title' => 'TimeLapse :: '.$curdate.' :: width:640, height:480'), "View Timelapse Video"); $cam_href->set_collapse(true); $cam_title_div->add($cam_href); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-24 17:21:26
|
Revision: 3293 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3293&view=rev Author: hemna Date: 2009-11-24 17:21:19 +0000 (Tue, 24 Nov 2009) Log Message: ----------- updated cam image id Modified Paths: -------------- trunk/open2300/htdocs/js/main.js Modified: trunk/open2300/htdocs/js/main.js =================================================================== --- trunk/open2300/htdocs/js/main.js 2009-11-24 15:28:03 UTC (rev 3292) +++ trunk/open2300/htdocs/js/main.js 2009-11-24 17:21:19 UTC (rev 3293) @@ -116,7 +116,7 @@ new PeriodicalExecuter(function(pe) { d = new Date(); - img = $('idCam'); + img = $('idCamImg'); img.src="http://wx.hemna.com/cam/cam.jpg?junk="+d.getSeconds(); }, 30); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-11-24 15:28:12
|
Revision: 3292 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3292&view=rev Author: hemna Date: 2009-11-24 15:28:03 +0000 (Tue, 24 Nov 2009) Log Message: ----------- spacing and date Modified Paths: -------------- trunk/open2300/lib/modules/home/page/HomePage.inc Modified: trunk/open2300/lib/modules/home/page/HomePage.inc =================================================================== --- trunk/open2300/lib/modules/home/page/HomePage.inc 2009-11-24 06:27:17 UTC (rev 3291) +++ trunk/open2300/lib/modules/home/page/HomePage.inc 2009-11-24 15:28:03 UTC (rev 3292) @@ -227,14 +227,15 @@ $cam_img_div = new DIVtag(array('id' => 'idCamImgDiv'), $cam_img); - $cam_title_div = new DIVtag(array('id' => 'idCamTitle', 'class' => 'camtitle'), 'Cam Updates from 4am to 10pm PST', ' '); + $cam_title_div = new DIVtag(array('id' => 'idCamTitle', 'class' => 'camtitle'), 'Cam Updates from 4am to 10pm PST', + ' '); //only show the flash overlay if we //have today's video file on disk if (file_exists("/home/waboring/wx.hemna.com/htdocs/video/".$curdate."/timelapse.flv")) { - $cam_href = new Atag(array('href' => '/video/player.swf?file=/video/20091123/timelapse.flv&autostart=1', 'class' => 'lightview', + $cam_href = new Atag(array('href' => '/video/player.swf?file=/video/'.$curdate.'/timelapse.flv&autostart=1', 'class' => 'lightview', 'rel' => 'flash', 'title' => 'TimeLapse :: Test :: width:640, height:480'), - " View Timelapse Video"); + "View Timelapse Video"); $cam_href->set_collapse(true); $cam_title_div->add($cam_href); $cam_title_div->add(" every 30 min"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |