diff --git a/source/lib/RippingCluster/Job.class.php b/source/lib/RippingCluster/Job.class.php index 390d151..37de6f2 100644 --- a/source/lib/RippingCluster/Job.class.php +++ b/source/lib/RippingCluster/Job.class.php @@ -271,7 +271,20 @@ class RippingCluster_Job { return $new_status; } - + + public function isFinished() { + $current_status = $this->currentStatus()->status(); + return ($current_status == RippingCluster_JobStatus::COMPLETE || $current_status == RippingCluster_JobStatus::FAILED); + } + + public function outputFilesize() { + if (file_exists($this->destination_filename)) { + return filesize($this->destination_filename); + } + + return null; + } + public function calculateETA() { $current_status = $this->currentStatus(); if ($current_status->status() != RippingCluster_JobStatus::RUNNING) { diff --git a/source/lib/RippingCluster/Main.class.php b/source/lib/RippingCluster/Main.class.php index 6145515..88a25a0 100644 --- a/source/lib/RippingCluster/Main.class.php +++ b/source/lib/RippingCluster/Main.class.php @@ -18,13 +18,15 @@ class RippingCluster_Main extends SihnonFramework_Main { switch (HBC_File) { case 'index': { + $smarty_tmp = '/tmp/ripping-cluster'; $this->smarty = new Smarty(); - $this->smarty->template_dir = './source/templates'; - $this->smarty->compile_dir = './tmp/templates'; - $this->smarty->cache_dir = './tmp/cache'; - $this->smarty->config_dir = './config'; + $this->smarty->template_dir = static::makeAbsolutePath('./source/templates'); + $this->smarty->compile_dir = static::makeAbsolutePath($smarty_tmp . '/tmp/templates'); + $this->smarty->cache_dir = static::makeAbsolutePath($smarty_tmp . '/tmp/cache'); + $this->smarty->config_dir = static::makeAbsolutePath($smarty_tmp . '/config'); $this->smarty->registerPlugin('modifier', 'formatDuration', array('RippingCluster_Main', 'formatDuration')); + $this->smarty->registerPlugin('modifier', 'formatFilesize', array('RippingCluster_Main', 'formatFilesize')); $this->smarty->assign('version', '0.1'); $this->smarty->assign('messages', array()); diff --git a/webui/source/templates/jobs.tpl b/webui/source/templates/jobs.tpl index 74773f9..3f0e337 100644 --- a/webui/source/templates/jobs.tpl +++ b/webui/source/templates/jobs.tpl @@ -43,7 +43,12 @@ {assign var=current_status value=$job->currentStatus()}