diff --git a/config.php.dist b/config.php.dist index 8d7857d..f174732 100644 --- a/config.php.dist +++ b/config.php.dist @@ -1,23 +1,23 @@ \ No newline at end of file diff --git a/lib/HandBrakeCluster/ClientLogEntry.class.php b/lib/HandBrakeCluster/ClientLogEntry.class.php deleted file mode 100644 index 9aa16fa..0000000 --- a/lib/HandBrakeCluster/ClientLogEntry.class.php +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/lib/HandBrakeCluster/Exceptions.class.php b/lib/HandBrakeCluster/Exceptions.class.php deleted file mode 100644 index 3841070..0000000 --- a/lib/HandBrakeCluster/Exceptions.class.php +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/lib/HandBrakeCluster/WorkerLogEntry.class.php b/lib/HandBrakeCluster/WorkerLogEntry.class.php deleted file mode 100644 index bd0fa14..0000000 --- a/lib/HandBrakeCluster/WorkerLogEntry.class.php +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/lib/HandBrakeCluster/BackgroundTask.class.php b/lib/RippingCluster/BackgroundTask.class.php similarity index 85% rename from lib/HandBrakeCluster/BackgroundTask.class.php rename to lib/RippingCluster/BackgroundTask.class.php index 6033975..61a139c 100644 --- a/lib/HandBrakeCluster/BackgroundTask.class.php +++ b/lib/RippingCluster/BackgroundTask.class.php @@ -1,6 +1,6 @@ config = $config; $this->cache_dir = $config->get('cache.base_dir'); if (is_dir($this->cache_dir)) { if ( ! is_writeable($this->cache_dir)) { - throw new HandBrakeCluster_Exception_InvalidCacheDir(); + throw new RippingCluster_Exception_InvalidCacheDir(); } } else { - if ( ! HandBrakeCluster_Main::mkdir_recursive($this->cache_dir)) { - throw new HandBrakeCluster_Exception_InvalidCacheDir(); + if ( ! RippingCluster_Main::mkdir_recursive($this->cache_dir)) { + throw new RippingCluster_Exception_InvalidCacheDir(); } } } @@ -49,7 +49,7 @@ class HandBrakeCluster_Cache { $cache_filename = $this->cacheFilename($source_filename); if (!$this->exists($source_filename)) { - throw new HandBrakeCluster_Exception_CacheObjectNotFound($source_filename); + throw new RippingCluster_Exception_CacheObjectNotFound($source_filename); } return file_get_contents($cache_filename); diff --git a/lib/RippingCluster/ClientLogEntry.class.php b/lib/RippingCluster/ClientLogEntry.class.php new file mode 100644 index 0000000..e471e80 --- /dev/null +++ b/lib/RippingCluster/ClientLogEntry.class.php @@ -0,0 +1,13 @@ + diff --git a/lib/HandBrakeCluster/Config.class.php b/lib/RippingCluster/Config.class.php similarity index 75% rename from lib/HandBrakeCluster/Config.class.php rename to lib/RippingCluster/Config.class.php index 4218a2a..054b86b 100644 --- a/lib/HandBrakeCluster/Config.class.php +++ b/lib/RippingCluster/Config.class.php @@ -1,6 +1,6 @@ databaseConfig[$key])) { - throw new HandBrakeCluster_Exception_DatabaseConfigMissing($key); + throw new RippingCluster_Exception_DatabaseConfigMissing($key); } return $this->databaseConfig[$key]; } - public function setDatabase(HandBrakeCluster_Database $database) { + public function setDatabase(RippingCluster_Database $database) { $this->database = $database; $this->preload(); } public function preload() { if (!$this->database) { - throw new HandBrakeCluster_Exception_NoDatabaseConnection(); + throw new RippingCluster_Exception_NoDatabaseConnection(); } $this->settings = $this->database->selectAssoc('SELECT name,value FROM settings', 'name', 'value'); @@ -45,7 +45,7 @@ class HandBrakeCluster_Config { public function get($key) { if (!isset($this->settings[$key])) { - throw new HandBrakeCluster_Exception_UnknownSetting($key); + throw new RippingCluster_Exception_UnknownSetting($key); } return $this->settings[$key]; diff --git a/lib/HandBrakeCluster/Database.class.php b/lib/RippingCluster/Database.class.php similarity index 85% rename from lib/HandBrakeCluster/Database.class.php rename to lib/RippingCluster/Database.class.php index e2deff3..abac4cd 100644 --- a/lib/HandBrakeCluster/Database.class.php +++ b/lib/RippingCluster/Database.class.php @@ -1,6 +1,6 @@ config = $config; $this->hostname = $this->config->getDatabase('hostname'); @@ -23,7 +23,7 @@ class HandBrakeCluster_Database { try { $this->dbh = new PDO("mysql:host={$this->hostname};dbname={$this->dbname}", $this->username, $this->password); } catch (PDOException $e) { - throw new HandBrakeCluster_Exception_DatabaseConnectionFailed($e->getMessage()); + throw new RippingCluster_Exception_DatabaseConnectionFailed($e->getMessage()); } } @@ -53,7 +53,7 @@ class HandBrakeCluster_Database { $result = $stmt->execute(); if (!$result) { list($code, $dummy, $message) = $stmt->errorInfo(); - throw new HandBrakeCluster_Exception_DatabaseQueryFailed($message, $code); + throw new RippingCluster_Exception_DatabaseQueryFailed($message, $code); } return $stmt->fetchAll(); @@ -73,7 +73,7 @@ class HandBrakeCluster_Database { public function selectOne($sql, $bind_params = null) { $rows = $this->selectList($sql, $bind_params); if (count($rows) != 1) { - throw new HandBrakeCluster_Exception_ResultCountMismatch(count($rows)); + throw new RippingCluster_Exception_ResultCountMismatch(count($rows)); } return $rows[0]; @@ -95,7 +95,7 @@ class HandBrakeCluster_Database { $result = $stmt->execute(); if (!$result) { list($code, $dummy, $message) = $stmt->errorInfo(); - throw new HandBrakeCluster_Exception_DatabaseQueryFailed($message, $code); + throw new RippingCluster_Exception_DatabaseQueryFailed($message, $code); } } @@ -115,7 +115,7 @@ class HandBrakeCluster_Database { $result = $stmt->execute(); if (!$result) { list($code, $dummy, $message) = $stmt->errorInfo(); - throw new HandBrakeCluster_Exception_DatabaseQueryFailed($message, $code); + throw new RippingCluster_Exception_DatabaseQueryFailed($message, $code); } } diff --git a/lib/RippingCluster/Exceptions.class.php b/lib/RippingCluster/Exceptions.class.php new file mode 100644 index 0000000..8198bf6 --- /dev/null +++ b/lib/RippingCluster/Exceptions.class.php @@ -0,0 +1,30 @@ + diff --git a/lib/HandBrakeCluster/ForegroundTask.class.php b/lib/RippingCluster/ForegroundTask.class.php similarity index 98% rename from lib/HandBrakeCluster/ForegroundTask.class.php rename to lib/RippingCluster/ForegroundTask.class.php index f339218..597b636 100644 --- a/lib/HandBrakeCluster/ForegroundTask.class.php +++ b/lib/RippingCluster/ForegroundTask.class.php @@ -1,6 +1,6 @@ database(); + $database = RippingCluster_Main::instance()->database(); if (isset(self::$cache[$id])) { return self::$cache[$id]; } - $job = HandBrakeCluster_Job::fromDatabaseRow( + $job = RippingCluster_Job::fromDatabaseRow( $database->selectOne('SELECT * FROM jobs WHERE id=:id', array( array('name' => 'id', 'value' => $id, 'type' => PDO::PARAM_INT) ) @@ -100,7 +100,7 @@ class HandBrakeCluster_Job { public static function all() { $jobs = array(); - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); foreach ($database->selectList('SELECT * FROM jobs WHERE id > 0') as $row) { $job = self::fromDatabaseRow($row); @@ -113,7 +113,7 @@ class HandBrakeCluster_Job { public static function allWithStatus($status, $limit = null) { $jobs = array(); - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); $params = array( array('name' => 'status', 'value' => $status, 'type' => PDO::PARAM_INT), @@ -133,17 +133,17 @@ class HandBrakeCluster_Job { } public static function fromPostRequest($source_id, $global_options, $titles) { - $source = HandBrakeCluster_Rips_Source::loadEncoded(HandBrakeCluster_Main::issetelse($source_id, HandBrakeCluster_Exception_InvalidParameters)); + $source = RippingCluster_Rips_Source::loadEncoded(RippingCluster_Main::issetelse($source_id, RippingCluster_Exception_InvalidParameters)); $jobs = array(); foreach ($titles as $title => $details) { - if (HandBrakeCluster_Main::issetelse($details['queue'])) { - HandBrakeCluster_Main::issetelse($details['output_filename'], HandBrakeCluster_Exception_InvalidParameters); + if (RippingCluster_Main::issetelse($details['queue'])) { + RippingCluster_Main::issetelse($details['output_filename'], RippingCluster_Exception_InvalidParameters); - $job = new HandBrakeCluster_Job( + $job = new RippingCluster_Job( $source, null, - HandBrakeCluster_Main::issetelse($details['name'], 'unnamed job'), + RippingCluster_Main::issetelse($details['name'], 'unnamed job'), $source->filename(), $global_options['output-directory'] . DIRECTORY_SEPARATOR . $details['output_filename'], $title, @@ -152,11 +152,11 @@ class HandBrakeCluster_Job { $global_options['video-width'], $global_options['video-height'], $global_options['quantizer'], - HandBrakeCluster_Main::issetelse($details['deinterlace'], 2), - implode(',', HandBrakeCluster_Main::issetelse($details['audio'], array())), + RippingCluster_Main::issetelse($details['deinterlace'], 2), + implode(',', RippingCluster_Main::issetelse($details['audio'], array())), implode(',', array_pad(array(), count($details['audio']), 'ac3')), // @todo Make this configurable implode(',', array_pad(array(), count($details['audio']), 'Unknown')), // @todo Make this configurable - implode(',', HandBrakeCluster_Main::issetelse($details['subtitles'], array())) + implode(',', RippingCluster_Main::issetelse($details['subtitles'], array())) ); $job->create(); @@ -168,7 +168,7 @@ class HandBrakeCluster_Job { } protected function create() { - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); $database->insert( 'INSERT INTO jobs (id,name,source,destination,title,format,video_codec,video_width,video_height,quantizer,deinterlace,audio_tracks,audio_codecs,audio_names,subtitle_tracks) @@ -192,11 +192,11 @@ class HandBrakeCluster_Job { ); $this->id = $database->lastInsertId(); - $status = HandBrakeCluster_JobStatus::updateStatusForJob($this, HandBrakeCluster_JobStatus::CREATED); + $status = RippingCluster_JobStatus::updateStatusForJob($this, RippingCluster_JobStatus::CREATED); } public function delete() { - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); $database->update( 'DELETE FROM jobs WHERE id=:job_id LIMIT 1', array( @@ -208,7 +208,7 @@ class HandBrakeCluster_Job { } public function queue($gearman) { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $config = $main->config(); $log = $main->log(); $log->info('Starting job', $this->id); @@ -235,22 +235,22 @@ class HandBrakeCluster_Job { $task = $gearman->addTask('handbrake_rip', serialize($rip_options), $config->get('rips.context'), $this->id); if ($task) { $log->debug("Queued job", $this->id); - $this->updateStatus(HandBrakeCluster_JobStatus::QUEUED); + $this->updateStatus(RippingCluster_JobStatus::QUEUED); } else { $log->warning("Failed to queue job", $this->id); - $this->updateStatus(HandBrakeCluster_JobStatus::FAILED); + $this->updateStatus(RippingCluster_JobStatus::FAILED); } } protected function loadStatuses() { if ($this->statuses == null) { - $this->statuses = HandBrakeCluster_JobStatus::allForJob($this); + $this->statuses = RippingCluster_JobStatus::allForJob($this); } } /** * - * @return HandBrakeCluster_JobStatus + * @return RippingCluster_JobStatus */ public function currentStatus() { $this->loadStatuses(); @@ -258,13 +258,13 @@ class HandBrakeCluster_Job { } public function updateStatus($new_status, $rip_progress = null) { - return HandBrakeCluster_JobStatus::updateStatusForJob($this, $new_status, $rip_progress); + return RippingCluster_JobStatus::updateStatusForJob($this, $new_status, $rip_progress); } public function calculateETA() { $current_status = $this->currentStatus(); - if ($current_status->status() != HandBrakeCluster_JobStatus::RUNNING) { - throw new HandBrakeCluster_Exception_JobNotRunning(); + if ($current_status->status() != RippingCluster_JobStatus::RUNNING) { + throw new RippingCluster_Exception_JobNotRunning(); } $running_time = $current_status->mtime() - $current_status->ctime(); @@ -298,7 +298,7 @@ class HandBrakeCluster_Job { } public static function runAllJobs() { - HandBrakeCluster_BackgroundTask::run('/usr/bin/php run-jobs.php'); + RippingCluster_BackgroundTask::run('/usr/bin/php run-jobs.php'); } }; diff --git a/lib/HandBrakeCluster/JobStatus.class.php b/lib/RippingCluster/JobStatus.class.php similarity index 88% rename from lib/HandBrakeCluster/JobStatus.class.php rename to lib/RippingCluster/JobStatus.class.php index 69dd956..95448f3 100644 --- a/lib/HandBrakeCluster/JobStatus.class.php +++ b/lib/RippingCluster/JobStatus.class.php @@ -1,6 +1,6 @@ id(), $status, $ctime, $mtime, $rip_progress); + $status = new RippingCluster_JobStatus(null, $job->id(), $status, $ctime, $mtime, $rip_progress); $status->create(); return $status; @@ -57,21 +57,21 @@ class HandBrakeCluster_JobStatus { $this->save(); } - public static function allForJob(HandBrakeCluster_Job $job) { + public static function allForJob(RippingCluster_Job $job) { $statuses = array(); - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); foreach ($database->selectList('SELECT * FROM job_status WHERE job_id=:job_id ORDER BY mtime ASC', array( array('name' => 'job_id', 'value' => $job->id(), 'type' => PDO::PARAM_INT), )) as $row) { - $statuses[] = HandBrakeCluster_JobStatus::fromDatabaseRow($row); + $statuses[] = RippingCluster_JobStatus::fromDatabaseRow($row); } return $statuses; } protected function create() { - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); $database->insert( 'INSERT INTO job_status (id, job_id, status, ctime, mtime, rip_progress) @@ -89,7 +89,7 @@ class HandBrakeCluster_JobStatus { } public function save() { - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); $database->update( 'UPDATE job_status SET job_id=:job_id, status=:status, ctime=:ctime, mtime=:mtime, rip_progress=:rip_progress diff --git a/lib/HandBrakeCluster/Log.class.php b/lib/RippingCluster/Log.class.php similarity index 91% rename from lib/HandBrakeCluster/Log.class.php rename to lib/RippingCluster/Log.class.php index 6e3658c..db62519 100644 --- a/lib/HandBrakeCluster/Log.class.php +++ b/lib/RippingCluster/Log.class.php @@ -1,6 +1,6 @@ database = $database; $this->config = $config; $this->table = $table; @@ -56,6 +56,6 @@ class HandBrakeCluster_Log { } -HandBrakeCluster_Log::initialise(); +RippingCluster_Log::initialise(); ?> diff --git a/lib/HandBrakeCluster/LogEntry.class.php b/lib/RippingCluster/LogEntry.class.php similarity index 88% rename from lib/HandBrakeCluster/LogEntry.class.php rename to lib/RippingCluster/LogEntry.class.php index 408399e..75ebd22 100644 --- a/lib/HandBrakeCluster/LogEntry.class.php +++ b/lib/RippingCluster/LogEntry.class.php @@ -1,6 +1,6 @@ database(); - return HandBrakeCluster_ClientLogEntry::fromDatabaseRow( + $database = RippingCluster_Main::instance()->database(); + return RippingCluster_ClientLogEntry::fromDatabaseRow( $database->selectOne('SELECT * FROM '.self::$table_name.' WHERE id=:id', array( array('name' => 'id', 'value' => $id, 'type' => PDO::PARAM_INT) ) @@ -53,7 +53,7 @@ abstract class HandBrakeCluster_LogEntry { public static function recent($limit = 100) { $entries = array(); - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); foreach ($database->selectList('SELECT * FROM '.self::$table_name.' ORDER BY ctime DESC LIMIT :limit', array( array('name' => 'limit', 'value' => $limit, 'type' => PDO::PARAM_INT) )) as $row) { @@ -66,7 +66,7 @@ abstract class HandBrakeCluster_LogEntry { public static function recentForJob($job_id, $limit = 100) { $entries = array(); - $database = HandBrakeCluster_Main::instance()->database(); + $database = RippingCluster_Main::instance()->database(); foreach ($database->selectList('SELECT * FROM '.self::$table_name.' WHERE job_id=:job_id ORDER BY ctime DESC LIMIT :limit', array( array('name' => 'job_id', 'value' => $job_id, 'type' => PDO::PARAM_INT), array('name' => 'limit', 'value' => $limit, 'type' => PDO::PARAM_INT) diff --git a/lib/HandBrakeCluster/Main.class.php b/lib/RippingCluster/Main.class.php similarity index 77% rename from lib/HandBrakeCluster/Main.class.php rename to lib/RippingCluster/Main.class.php index 2dfe0a0..18e237e 100644 --- a/lib/HandBrakeCluster/Main.class.php +++ b/lib/RippingCluster/Main.class.php @@ -2,7 +2,7 @@ require 'smarty/Smarty.class.php'; -class HandBrakeCluster_Main { +class RippingCluster_Main { private static $instance; @@ -30,13 +30,13 @@ class HandBrakeCluster_Main { } } - $this->config = new HandBrakeCluster_Config(HandBrakeCluster_DBConfig); - $this->database = new HandBrakeCluster_Database($this->config); + $this->config = new RippingCluster_Config(RippingCluster_DBConfig); + $this->database = new RippingCluster_Database($this->config); $this->config->setDatabase($this->database); - $this->log = new HandBrakeCluster_Log($this->database, $this->config, $log_table); - $this->request = new HandBrakeCluster_RequestParser($request_string); - $this->cache = new HandBrakeCluster_Cache($this->config); + $this->log = new RippingCluster_Log($this->database, $this->config, $log_table); + $this->request = new RippingCluster_RequestParser($request_string); + $this->cache = new RippingCluster_Cache($this->config); $this->smarty = new Smarty(); $this->smarty->template_dir = './templates'; @@ -44,7 +44,7 @@ class HandBrakeCluster_Main { $this->smarty->cache_dir = './tmp/cache'; $this->smarty->config_fir = './config'; - $this->smarty->register_modifier('formatDuration', array('HandBrakeCluster_Main', 'formatDuration')); + $this->smarty->register_modifier('formatDuration', array('RippingCluster_Main', 'formatDuration')); $this->smarty->assign('version', '0.1'); @@ -55,11 +55,11 @@ class HandBrakeCluster_Main { /** * - * @return HandBrakeCluster_Main + * @return RippingCluster_Main */ public static function instance() { if (!self::$instance) { - self::$instance = new HandBrakeCluster_Main(); + self::$instance = new RippingCluster_Main(); } return self::$instance; @@ -71,7 +71,7 @@ class HandBrakeCluster_Main { /** * - * @return HandBrakeCluster_Config + * @return RippingCluster_Config */ public function config() { return $this->config; @@ -79,7 +79,7 @@ class HandBrakeCluster_Main { /** * - * @return HandBrakeCluster_Database + * @return RippingCluster_Database */ public function database() { return $this->database; @@ -87,7 +87,7 @@ class HandBrakeCluster_Main { /** * - * @return HandBrakeCluster_Log + * @return RippingCluster_Log */ public function log() { return $this->log; @@ -95,7 +95,7 @@ class HandBrakeCluster_Main { /** * - * @return HandBrakeCluster_RequestParser + * @return RippingCluster_RequestParser */ public function request() { return $this->request; @@ -103,7 +103,7 @@ class HandBrakeCluster_Main { /** * - * @return HandBrakeCluster_Cache + * @return RippingCluster_Cache */ public function cache() { return $this->cache; @@ -122,7 +122,7 @@ class HandBrakeCluster_Main { } public static function initialise() { - spl_autoload_register(array('HandBrakeCluster_Main','autoload')); + spl_autoload_register(array('RippingCluster_Main','autoload')); } public static function autoload($classname) { @@ -132,18 +132,18 @@ class HandBrakeCluster_Main { } // Ensure the class to load begins with our prefix - if (!preg_match('/^HandBrakeCluster_/', $classname)) { + if (!preg_match('/^RippingCluster_/', $classname)) { return; } // Special case: All exceptions are stored in the same file - if (preg_match('/^HandBrakeCluster_Exception/', $classname)) { - require_once(HandBrakeCluster_Lib . 'HandBrakeCluster/Exceptions.class.php'); + if (preg_match('/^RippingCluster_Exception/', $classname)) { + require_once(RippingCluster_Lib . 'RippingCluster/Exceptions.class.php'); return; } // Replace any underscores with directory separators - $filename = HandBrakeCluster_Lib . preg_replace('/_/', '/', $classname); + $filename = RippingCluster_Lib . preg_replace('/_/', '/', $classname); // Tack on the class file suffix $filename .= '.class.php'; @@ -174,7 +174,7 @@ class HandBrakeCluster_Main { return $var; } - if (is_string($default) && preg_match('/^HandBrakeCluster_Exception/', $default) && class_exists($default) && is_subclass_of($default, HandBrakeCluster_Exception)) { + if (is_string($default) && preg_match('/^RippingCluster_Exception/', $default) && class_exists($default) && is_subclass_of($default, RippingCluster_Exception)) { throw new $default(); } @@ -210,6 +210,6 @@ class HandBrakeCluster_Main { } -HandBrakeCluster_Main::initialise(); +RippingCluster_Main::initialise(); ?> diff --git a/lib/HandBrakeCluster/Page.class.php b/lib/RippingCluster/Page.class.php similarity index 78% rename from lib/HandBrakeCluster/Page.class.php rename to lib/RippingCluster/Page.class.php index e629450..1e26dad 100644 --- a/lib/HandBrakeCluster/Page.class.php +++ b/lib/RippingCluster/Page.class.php @@ -1,13 +1,13 @@ smarty = $smarty; $this->request = $request; $this->page = $request->page(); @@ -27,11 +27,11 @@ class HandBrakeCluster_Page { try { $this->render($template_filename, $code_filename, $template_variables); - } catch (HandBrakeCluster_Exception_AbortEntirePage $e) { + } catch (RippingCluster_Exception_AbortEntirePage $e) { return false; - } catch (HandBrakeCluster_Exception_FileNotFound $e) { + } catch (RippingCluster_Exception_FileNotFound $e) { $this->render('errors/404.tpl', 'errors/404.php'); - } catch (HandBrakeCluster_Exception $e) { + } catch (RippingCluster_Exception $e) { $this->render('errors/unhandled-exception.tpl', 'errors/unhandled-exception.php', array( 'exception' => $e, )); @@ -42,7 +42,7 @@ class HandBrakeCluster_Page { protected function render($template_filename, $code_filename = null, $template_variables = array()) { if ( ! $this->smarty->template_exists($template_filename)) { - throw new HandBrakeCluster_Exception_FileNotFound($template_filename); + throw new RippingCluster_Exception_FileNotFound($template_filename); } // Copy all the template variables into the namespace for this function, @@ -62,11 +62,11 @@ class HandBrakeCluster_Page { } public static function redirect($relative_url) { - $absolute_url = HandBrakeCluster_Main::instance()->absoluteUrl($relative_url); + $absolute_url = RippingCluster_Main::instance()->absoluteUrl($relative_url); header("Location: $absolute_url"); - throw new HandBrakeCluster_Exception_AbortEntirePage(); + throw new RippingCluster_Exception_AbortEntirePage(); } }; diff --git a/lib/HandBrakeCluster/PluginFactory.class.php b/lib/RippingCluster/PluginFactory.class.php similarity index 78% rename from lib/HandBrakeCluster/PluginFactory.class.php rename to lib/RippingCluster/PluginFactory.class.php index b9759a6..595392c 100644 --- a/lib/HandBrakeCluster/PluginFactory.class.php +++ b/lib/RippingCluster/PluginFactory.class.php @@ -1,6 +1,6 @@ getFilename()); @@ -33,7 +33,7 @@ abstract class HandBrakeCluster_PluginFactory { continue; } - if ( ! in_array('HandBrakeCluster_Worker_IPlugin', class_implements($fullClassname))) { + if ( ! in_array('RippingCluster_Worker_IPlugin', class_implements($fullClassname))) { echo "$plugin does not implement the necessary interfaces\n"; continue; } diff --git a/lib/HandBrakeCluster/RequestParser.class.php b/lib/RippingCluster/RequestParser.class.php similarity index 93% rename from lib/HandBrakeCluster/RequestParser.class.php rename to lib/RippingCluster/RequestParser.class.php index 802b585..4d1915e 100644 --- a/lib/HandBrakeCluster/RequestParser.class.php +++ b/lib/RippingCluster/RequestParser.class.php @@ -1,6 +1,6 @@ vars[$key]; } - if (is_string($default) && preg_match('/^HandBrakeCluster_Exception/', $default) && class_exists($default) && is_subclass_of($default, HandBrakeCluster_Exception)) { + if (is_string($default) && preg_match('/^RippingCluster_Exception/', $default) && class_exists($default) && is_subclass_of($default, RippingCluster_Exception)) { throw new $default(); } diff --git a/lib/HandBrakeCluster/Rips/Source.class.php b/lib/RippingCluster/Rips/Source.class.php similarity index 88% rename from lib/HandBrakeCluster/Rips/Source.class.php rename to lib/RippingCluster/Rips/Source.class.php index 18cbf29..77a6bf8 100644 --- a/lib/HandBrakeCluster/Rips/Source.class.php +++ b/lib/RippingCluster/Rips/Source.class.php @@ -1,6 +1,6 @@ scan(); } - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $cache = $main->cache(); $config = $main->config(); @@ -28,12 +28,12 @@ class HandBrakeCluster_Rips_Source { } public static function load($source_filename, $scan_dir = true, $use_cache = true) { - $cache = HandBrakeCluster_Main::instance()->cache(); + $cache = RippingCluster_Main::instance()->cache(); if ($use_cache && $cache->exists($source_filename)) { return unserialize($cache->fetch($source_filename)); } else { - return new HandBrakeCluster_Rips_Source($source_filename, $scan_dir, $use_cache); + return new RippingCluster_Rips_Source($source_filename, $scan_dir, $use_cache); } } @@ -44,14 +44,14 @@ class HandBrakeCluster_Rips_Source { // Ensure the source is a valid directory, and lies below the configured source_dir $real_source_filename = realpath($source_filename); if (!is_dir($source_filename)) { - throw new HandBrakeCluster_Exception_InvalidSourceDirectory($source_filename); + throw new RippingCluster_Exception_InvalidSourceDirectory($source_filename); } - $config = HandBrakeCluster_Main::instance()->config(); + $config = RippingCluster_Main::instance()->config(); $source_basedir = $config->get('rips.source_dir'); $real_source_basedir = realpath($source_basedir); if (substr($real_source_filename, 0, strlen($real_source_basedir)) != $real_source_basedir) { - throw new HandBrakeCluster_Exception_InvalidSourceDirectory($source_filename); + throw new RippingCluster_Exception_InvalidSourceDirectory($source_filename); } return self::load($source_filename, $scan_dir, $use_cache); @@ -60,7 +60,7 @@ class HandBrakeCluster_Rips_Source { protected function scan() { $source_shell = escapeshellarg($this->source); $handbrake_cmd = "HandBrakeCLI -i {$source_shell} -t 0"; - list($retval, $handbrake_output, $handbrake_error) = HandBrakeCluster_ForegroundTask::execute($handbrake_cmd); + list($retval, $handbrake_output, $handbrake_error) = RippingCluster_ForegroundTask::execute($handbrake_cmd); // Process the output $lines = explode("\n", $handbrake_error); @@ -81,7 +81,7 @@ class HandBrakeCluster_Rips_Source { } $mode = self::PM_TITLE; - $title = new HandBrakeCluster_Rips_SourceTitle($matches['id']); + $title = new RippingCluster_Rips_SourceTitle($matches['id']); } break; case $title && preg_match('/^ \+ chapters:$/', $line): { @@ -123,7 +123,7 @@ class HandBrakeCluster_Rips_Source { case $title && $mode == self::PM_AUDIO && preg_match('/^ \+ (?P\d+), (?P.+) \((?P.+)\) \((?P(.+ ch|Dolby Surround))\) \((?P.+)\), (?P\d+)Hz, (?P\d+)bps$/', $line, $matches): { $title->addAudioTrack( - new HandBrakeCluster_Rips_SourceAudioTrack( + new RippingCluster_Rips_SourceAudioTrack( $matches['id'], $matches['name'], $matches['format'], $matches['channels'], $matches['language'], $matches['samplerate'], $matches['bitrate'] ) @@ -132,7 +132,7 @@ class HandBrakeCluster_Rips_Source { case $title && $mode == self::PM_SUBTITLE && preg_match('/^ \+ (?P\d+), (?P.+) \((?P.+)\) \((?P.+)\)$/', $line, $matches): { $title->addSubtitleTrack( - new HandBrakeCluster_Rips_SourceSubtitleTrack( + new RippingCluster_Rips_SourceSubtitleTrack( $matches['id'], $matches['name'], $matches['language'], $matches['format'] ) ); @@ -154,7 +154,7 @@ class HandBrakeCluster_Rips_Source { } public static function isCached($source_filename) { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $cache = $main->cache(); $config = $main->config(); @@ -165,7 +165,7 @@ class HandBrakeCluster_Rips_Source { return str_replace("/", "-", base64_encode($filename)); } - public function addTitle(HandBrakeCluster_Rips_SourceTitle $title) { + public function addTitle(RippingCluster_Rips_SourceTitle $title) { $this->titles[] = $title; } diff --git a/lib/HandBrakeCluster/Rips/SourceAudioTrack.class.php b/lib/RippingCluster/Rips/SourceAudioTrack.class.php similarity index 94% rename from lib/HandBrakeCluster/Rips/SourceAudioTrack.class.php rename to lib/RippingCluster/Rips/SourceAudioTrack.class.php index 14150bd..e753f01 100644 --- a/lib/HandBrakeCluster/Rips/SourceAudioTrack.class.php +++ b/lib/RippingCluster/Rips/SourceAudioTrack.class.php @@ -1,6 +1,6 @@ base_directory)) { - throw new HandBrakeCluster_Exception_InvalidSourceDirectory($this->base_directory); + throw new RippingCluster_Exception_InvalidSourceDirectory($this->base_directory); } - $iterator = new HandBrakeCluster_Utility_DvdDirectoryIterator(new HandBrakeCluster_Utility_VisibleFilesIterator(new DirectoryIterator($this->base_directory))); + $iterator = new RippingCluster_Utility_DvdDirectoryIterator(new RippingCluster_Utility_VisibleFilesIterator(new DirectoryIterator($this->base_directory))); foreach ($iterator as /** @var SplFileInfo */ $source_vts) { - $this->sources[] = HandBrakeCluster_Rips_Source::load($source_vts->getPathname(), false); + $this->sources[] = RippingCluster_Rips_Source::load($source_vts->getPathname(), false); } } diff --git a/lib/HandBrakeCluster/Rips/SourceSubtitleTrack.class.php b/lib/RippingCluster/Rips/SourceSubtitleTrack.class.php similarity index 90% rename from lib/HandBrakeCluster/Rips/SourceSubtitleTrack.class.php rename to lib/RippingCluster/Rips/SourceSubtitleTrack.class.php index fce31ac..9b198b6 100644 --- a/lib/HandBrakeCluster/Rips/SourceSubtitleTrack.class.php +++ b/lib/RippingCluster/Rips/SourceSubtitleTrack.class.php @@ -1,6 +1,6 @@ audio; } - public function addAudioTrack(HandBrakeCluster_Rips_SourceAudioTrack $audio_track) { + public function addAudioTrack(RippingCluster_Rips_SourceAudioTrack $audio_track) { $this->audio[] = $audio_track; } @@ -118,7 +118,7 @@ class HandBrakeCluster_Rips_SourceTitle { return $this->subtitles; } - public function addSubtitleTrack(HandBrakeCluster_Rips_SourceSubtitleTrack $subtitle_track) { + public function addSubtitleTrack(RippingCluster_Rips_SourceSubtitleTrack $subtitle_track) { $this->subtitles[] = $subtitle_track; } diff --git a/lib/HandBrakeCluster/Utility/ClassFilesIterator.class.php b/lib/RippingCluster/Utility/ClassFilesIterator.class.php similarity index 62% rename from lib/HandBrakeCluster/Utility/ClassFilesIterator.class.php rename to lib/RippingCluster/Utility/ClassFilesIterator.class.php index a22b783..6cfcf6d 100644 --- a/lib/HandBrakeCluster/Utility/ClassFilesIterator.class.php +++ b/lib/RippingCluster/Utility/ClassFilesIterator.class.php @@ -1,6 +1,6 @@ current()->getFilename()); } diff --git a/lib/HandBrakeCluster/Utility/DvdDirectoryIterator.class.php b/lib/RippingCluster/Utility/DvdDirectoryIterator.class.php similarity index 64% rename from lib/HandBrakeCluster/Utility/DvdDirectoryIterator.class.php rename to lib/RippingCluster/Utility/DvdDirectoryIterator.class.php index baaf57a..82a2c5e 100644 --- a/lib/HandBrakeCluster/Utility/DvdDirectoryIterator.class.php +++ b/lib/RippingCluster/Utility/DvdDirectoryIterator.class.php @@ -1,6 +1,6 @@ current()->getPathname() . DIRECTORY_SEPARATOR . 'VIDEO_TS'); } diff --git a/lib/HandBrakeCluster/Utility/VisibleFilesIterator.class.php b/lib/RippingCluster/Utility/VisibleFilesIterator.class.php similarity index 61% rename from lib/HandBrakeCluster/Utility/VisibleFilesIterator.class.php rename to lib/RippingCluster/Utility/VisibleFilesIterator.class.php index c1b6103..ea28090 100644 --- a/lib/HandBrakeCluster/Utility/VisibleFilesIterator.class.php +++ b/lib/RippingCluster/Utility/VisibleFilesIterator.class.php @@ -1,6 +1,6 @@ current()->getFilename(), 0, 1) == '.'); } diff --git a/lib/HandBrakeCluster/Worker.class.php b/lib/RippingCluster/Worker.class.php similarity index 74% rename from lib/HandBrakeCluster/Worker.class.php rename to lib/RippingCluster/Worker.class.php index 72e0974..757cdb9 100644 --- a/lib/HandBrakeCluster/Worker.class.php +++ b/lib/RippingCluster/Worker.class.php @@ -1,6 +1,6 @@ config(); + $config = RippingCluster_Main::instance()->config(); $this->gearman = new GearmanWorker(); $this->gearman->addServers($config->get('rips.job_servers')); // Load all the plugin classes echo "Loading Plugins\n"; - HandBrakeCluster_Worker_PluginFactory::scan(); - foreach (HandBrakeCluster_Worker_PluginFactory::getValidPlugins() as $plugin) { + RippingCluster_Worker_PluginFactory::scan(); + foreach (RippingCluster_Worker_PluginFactory::getValidPlugins() as $plugin) { echo "Grabbing worker functions provided by {$plugin}\n"; - $workerFunctions = HandBrakeCluster_Worker_PluginFactory::getPluginWorkerFunctions($plugin); + $workerFunctions = RippingCluster_Worker_PluginFactory::getPluginWorkerFunctions($plugin); foreach ($workerFunctions as $function => $callback) { echo "Adding {$plugin}::{$callback[1]} as {$function}\n"; diff --git a/lib/HandBrakeCluster/Worker/IPlugin.class.php b/lib/RippingCluster/Worker/IPlugin.class.php similarity index 86% rename from lib/HandBrakeCluster/Worker/IPlugin.class.php rename to lib/RippingCluster/Worker/IPlugin.class.php index 8b37b80..8ce504b 100644 --- a/lib/HandBrakeCluster/Worker/IPlugin.class.php +++ b/lib/RippingCluster/Worker/IPlugin.class.php @@ -1,6 +1,6 @@ config(); + $config = RippingCluster_Main::instance()->config(); $handbrake_cmd_raw = array( '-n', $config->get('rips.nice'), @@ -65,7 +65,7 @@ class HandBrakeCluster_Worker_Plugin_HandBrake implements HandBrakeCluster_Worke } $handbrake_cmd = join(' ', $handbrake_cmd); - return HandBrakeCluster_ForegroundTask::execute($handbrake_cmd, null, null, null, array($this, 'callbackStdout'), array($this, 'callbackStderr'), $this); + return RippingCluster_ForegroundTask::execute($handbrake_cmd, null, null, null, array($this, 'callbackStdout'), array($this, 'callbackStderr'), $this); } @@ -102,7 +102,7 @@ class HandBrakeCluster_Worker_Plugin_HandBrake implements HandBrakeCluster_Worke $line = $lines[0]; $this->stdout = $lines[1]; - $log = HandBrakeCluster_Main::instance()->log(); + $log = RippingCluster_Main::instance()->log(); $log->info($line); } } @@ -119,7 +119,7 @@ class HandBrakeCluster_Worker_Plugin_HandBrake implements HandBrakeCluster_Worke $numerator = 100 * $matches[1]; $this->job->sendStatus($numerator, 100); } else { - $log = HandBrakeCluster_Main::instance()->log(); + $log = RippingCluster_Main::instance()->log(); $log->debug($line); } } diff --git a/lib/HandBrakeCluster/Worker/PluginFactory.class.php b/lib/RippingCluster/Worker/PluginFactory.class.php similarity index 72% rename from lib/HandBrakeCluster/Worker/PluginFactory.class.php rename to lib/RippingCluster/Worker/PluginFactory.class.php index 639e892..7646406 100644 --- a/lib/HandBrakeCluster/Worker/PluginFactory.class.php +++ b/lib/RippingCluster/Worker/PluginFactory.class.php @@ -1,9 +1,9 @@ diff --git a/webui/_inc.php b/webui/_inc.php index a13ff22..b4840b6 100644 --- a/webui/_inc.php +++ b/webui/_inc.php @@ -1,6 +1,6 @@ diff --git a/webui/index.php b/webui/index.php index 8a458ec..0b228bb 100644 --- a/webui/index.php +++ b/webui/index.php @@ -5,15 +5,15 @@ define('HBC_File', 'index'); require '_inc.php'; try { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $smarty = $main->smarty(); - $page = new HandBrakeCluster_Page($smarty, $main->request()); + $page = new RippingCluster_Page($smarty, $main->request()); if ($page->evaluate()) { $smarty->display('index.tpl'); } -} catch (HandBrakeCluster_Exception $e) { +} catch (RippingCluster_Exception $e) { die("Uncaught Exception: " . $e->getMessage()); } diff --git a/webui/pages/errors/404.php b/webui/pages/errors/404.php index d5bc834..f044400 100644 --- a/webui/pages/errors/404.php +++ b/webui/pages/errors/404.php @@ -1,6 +1,6 @@ request(); $this->smarty->assign('requested_page', htmlspecialchars($req->request_string())); diff --git a/webui/pages/errors/unhandled-exception.php b/webui/pages/errors/unhandled-exception.php index 1427536..d9561a4 100644 --- a/webui/pages/errors/unhandled-exception.php +++ b/webui/pages/errors/unhandled-exception.php @@ -1,6 +1,6 @@ config(); $this->smarty->assign('display_exceptions', $config->get('debug.display_exceptions')); diff --git a/webui/pages/home.php b/webui/pages/home.php index fe77754..1977aa7 100644 --- a/webui/pages/home.php +++ b/webui/pages/home.php @@ -1,8 +1,8 @@ smarty->assign('running_jobs', $running_jobs); $this->smarty->assign('completed_jobs', $completed_jobs); diff --git a/webui/pages/job-details.php b/webui/pages/job-details.php index 6942e72..3e342aa 100644 --- a/webui/pages/job-details.php +++ b/webui/pages/job-details.php @@ -1,11 +1,11 @@ request->get('id'); -$job = HandBrakeCluster_Job::fromId($job_id); +$job = RippingCluster_Job::fromId($job_id); $this->smarty->assign('job', $job); -$client_log_entries = HandBrakeCluster_ClientLogEntry::recentForJob($job_id, 30); -$worker_log_entries = HandBrakeCluster_WorkerLogEntry::recentForJob($job_id, 30); +$client_log_entries = RippingCluster_ClientLogEntry::recentForJob($job_id, 30); +$worker_log_entries = RippingCluster_WorkerLogEntry::recentForJob($job_id, 30); $this->smarty->assign('client_log_entries', $client_log_entries); $this->smarty->assign('worker_log_entries', $worker_log_entries); diff --git a/webui/pages/jobs.php b/webui/pages/jobs.php index 5de528b..336c9b2 100644 --- a/webui/pages/jobs.php +++ b/webui/pages/jobs.php @@ -1,11 +1,11 @@ request(); $config = $main->config(); if ($req->get('submit')) { - $action = HandBrakeCluster_Main::issetelse($_POST['action'], HandBrakeCluster_Exception_InvalidParameters); + $action = RippingCluster_Main::issetelse($_POST['action'], RippingCluster_Exception_InvalidParameters); # If a bulk action was selected, the action will be a single term, otherwise it will also contain # the id of the single item to act upon. Work out which was used now. @@ -20,9 +20,9 @@ if ($req->get('submit')) { $jobs = array(); foreach ($job_ids as $job_id) { - $job = HandBrakeCluster_Job::fromId($job_id); + $job = RippingCluster_Job::fromId($job_id); if (!$job) { - throw new HandBrakeCluster_Exception_InvalidParameters('job_id'); + throw new RippingCluster_Exception_InvalidParameters('job_id'); } $jobs[] = $job; } @@ -30,7 +30,7 @@ if ($req->get('submit')) { switch ($action) { case 'mark-failed': { foreach ($jobs as $job) { - $job->updateStatus(HandBrakeCluster_JobStatus::FAILED); + $job->updateStatus(RippingCluster_JobStatus::FAILED); } } break; @@ -41,10 +41,10 @@ if ($req->get('submit')) { } # Dispatch all the jobs in one run - HandBrakeCluster_Job::runAllJobs(); + RippingCluster_Job::runAllJobs(); # Redirect to the job queued page to show the jobs were successfully dispatched - HandBrakeCluster_Page::redirect('rips/setup-rip/queued'); + RippingCluster_Page::redirect('rips/setup-rip/queued'); } break; case 'delete': { @@ -54,34 +54,34 @@ if ($req->get('submit')) { } break; default: { - throw new HandBrakeCluster_Exception_InvalidParameters('action'); + throw new RippingCluster_Exception_InvalidParameters('action'); } } - HandBrakeCluster_Page::redirect('jobs'); + RippingCluster_Page::redirect('jobs'); } else { if (isset($_POST['view'])) { $statusName = urlencode($_POST['view']); - HandBrakeCluster_Page::redirect("jobs/view/{$statusName}"); + RippingCluster_Page::redirect("jobs/view/{$statusName}"); } $statusName = $req->get('view', 'any'); switch ($statusName) { case 'any': $status = null; break; - case 'queued': $status = HandBrakeCluster_JobStatus::QUEUED; break; - case 'running': $status = HandBrakeCluster_JobStatus::RUNNING; break; - case 'complete': $status = HandBrakeCluster_JobStatus::COMPLETE; break; - case 'failed': $status = HandBrakeCluster_JobStatus::FAILED; break; - default: throw new HandBrakeCluster_Exception_InvalidParameters('view'); + case 'queued': $status = RippingCluster_JobStatus::QUEUED; break; + case 'running': $status = RippingCluster_JobStatus::RUNNING; break; + case 'complete': $status = RippingCluster_JobStatus::COMPLETE; break; + case 'failed': $status = RippingCluster_JobStatus::FAILED; break; + default: throw new RippingCluster_Exception_InvalidParameters('view'); } $jobs = array(); if ($status) { - $jobs = HandBrakeCluster_Job::allWithStatus($status); + $jobs = RippingCluster_Job::allWithStatus($status); } else { - $jobs = HandBrakeCluster_Job::all(); + $jobs = RippingCluster_Job::all(); } $this->smarty->assign('jobs', $jobs); diff --git a/webui/pages/logs.php b/webui/pages/logs.php index 1e77d61..0bf7a8f 100644 --- a/webui/pages/logs.php +++ b/webui/pages/logs.php @@ -1,7 +1,7 @@ smarty->assign('client_log_entries', $client_log_entries); $this->smarty->assign('worker_log_entries', $worker_log_entries); diff --git a/webui/pages/rips/setup-rip.php b/webui/pages/rips/setup-rip.php index 80b4da2..2db2283 100644 --- a/webui/pages/rips/setup-rip.php +++ b/webui/pages/rips/setup-rip.php @@ -1,30 +1,30 @@ request(); $config = $main->config(); // Grab the name of this source $encoded_filename = null; if ($req->get('submit')) { - $encoded_filename = HandBrakeCluster_Main::issetelse($_POST['id'], HandBrakeCluster_Exception_InvalidParameters); + $encoded_filename = RippingCluster_Main::issetelse($_POST['id'], RippingCluster_Exception_InvalidParameters); // Create the jobs from the request - $jobs = HandBrakeCluster_Job::fromPostRequest($_POST['id'], $_POST['rip-options'], $_POST['rips']); + $jobs = RippingCluster_Job::fromPostRequest($_POST['id'], $_POST['rip-options'], $_POST['rips']); // Spawn the background client process to run all the jobs - HandBrakeCluster_Job::runAllJobs(); + RippingCluster_Job::runAllJobs(); - HandBrakeCluster_Page::redirect('rips/setup-rip/queued'); + RippingCluster_Page::redirect('rips/setup-rip/queued'); } elseif ($req->get('queued')) { $this->smarty->assign('rips_submitted', true); } else { $this->smarty->assign('rips_submitted', false); - $encoded_filename = $req->get('id', HandBrakeCluster_Exception_InvalidParameters); + $encoded_filename = $req->get('id', RippingCluster_Exception_InvalidParameters); - $source = HandBrakeCluster_Rips_Source::loadEncoded($encoded_filename); + $source = RippingCluster_Rips_Source::loadEncoded($encoded_filename); $this->smarty->assign('source', $source); $this->smarty->assign('titles', $source->titles()); diff --git a/webui/pages/rips/source-details.php b/webui/pages/rips/source-details.php index 5388406..d8d5123 100644 --- a/webui/pages/rips/source-details.php +++ b/webui/pages/rips/source-details.php @@ -1,10 +1,10 @@ request(); $config = $main->config(); -$source = HandBrakeCluster_Rips_Source::loadEncoded($req->get('id', HandBrakeCluster_Exception_InvalidParameters)); +$source = RippingCluster_Rips_Source::loadEncoded($req->get('id', RippingCluster_Exception_InvalidParameters)); $this->smarty->assign('source', $source); $this->smarty->assign('titles', $source->titles()); diff --git a/webui/pages/rips/sources.php b/webui/pages/rips/sources.php index 32a06d1..9afbb6f 100644 --- a/webui/pages/rips/sources.php +++ b/webui/pages/rips/sources.php @@ -1,14 +1,14 @@ config(); -$lister = new HandBrakeCluster_Rips_SourceLister($config->get('rips.source_dir')); +$lister = new RippingCluster_Rips_SourceLister($config->get('rips.source_dir')); $sources = $lister->sources(); $sources_cached = array(); foreach ($sources as $source) { - $sources_cached[$source->filename()] = HandBrakeCluster_Rips_Source::isCached($source->filename()); + $sources_cached[$source->filename()] = RippingCluster_Rips_Source::isCached($source->filename()); } $this->smarty->assign('sources', $sources); diff --git a/webui/run-jobs.php b/webui/run-jobs.php index fb8d976..f3dc55d 100644 --- a/webui/run-jobs.php +++ b/webui/run-jobs.php @@ -3,10 +3,10 @@ define('HBC_File', 'run-jobs'); require_once '../config.php'; -require_once HandBrakeCluster_Lib . 'HandBrakeCluster/Main.class.php'; +require_once RippingCluster_Lib . 'RippingCluster/Main.class.php'; try { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $config = $main->config(); $log = $main->log(); @@ -19,7 +19,7 @@ try { $gearman->setFailCallback("gearman_fail_callback"); // Retrieve a list of Created jobs - $jobs = HandBrakeCluster_Job::allWithStatus(HandBrakeCluster_JobStatus::CREATED); + $jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::CREATED); foreach ($jobs as $job) { // Enqueue the job using gearman @@ -35,33 +35,33 @@ try { $log->info("Job queue completed"); -} catch (HandBrakeCluster_Exception $e) { +} catch (RippingCluster_Exception $e) { die("Uncaught Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"); } function gearman_created_callback($gearman_task) { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $log = $main->log(); - $job = HandBrakeCluster_Job::fromId($gearman_task->unique()); - $job->updateStatus(HandBrakeCluster_JobStatus::RUNNING); + $job = RippingCluster_Job::fromId($gearman_task->unique()); + $job->updateStatus(RippingCluster_JobStatus::RUNNING); $log->info("Job successfully queued with Gearman", $gearman_task->unique()); } function gearman_data_callback($gearman_task) { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $log = $main->log(); $log->debug("Got some data from gearman", $gearman_task->unique()); } function gearman_status_callback($gearman_task) { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $log = $main->log(); - $job = HandBrakeCluster_Job::fromId($gearman_task->unique()); + $job = RippingCluster_Job::fromId($gearman_task->unique()); $status = $job->currentStatus(); $rip_progress = $gearman_task->taskNumerator() / $gearman_task->taskDenominator(); @@ -71,21 +71,21 @@ function gearman_status_callback($gearman_task) { } function gearman_complete_callback($gearman_task) { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $log = $main->log(); - $job = HandBrakeCluster_Job::fromId($gearman_task->unique()); - $job->updateStatus(HandBrakeCluster_JobStatus::COMPLETE); + $job = RippingCluster_Job::fromId($gearman_task->unique()); + $job->updateStatus(RippingCluster_JobStatus::COMPLETE); $log->info("Job Complete", $job->id()); } function gearman_fail_callback($gearman_task) { - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $log = $main->log(); - $job = HandBrakeCluster_Job::fromId($gearman_task->unique()); - $job->updateStatus(HandBrakeCluster_JobStatus::FAILED); + $job = RippingCluster_Job::fromId($gearman_task->unique()); + $job->updateStatus(RippingCluster_JobStatus::FAILED); $log->info("Job Failed", $job->id()); } diff --git a/webui/templates/index.tpl b/webui/templates/index.tpl index 5d7671f..f7e2bb7 100644 --- a/webui/templates/index.tpl +++ b/webui/templates/index.tpl @@ -1,7 +1,7 @@ - HandBrake Cluster WebUI + Ripping Cluster WebUI @@ -15,7 +15,7 @@
diff --git a/worker/handbrake-cluster-worker.php b/worker/handbrake-cluster-worker.php index 6984685..29f90a3 100644 --- a/worker/handbrake-cluster-worker.php +++ b/worker/handbrake-cluster-worker.php @@ -3,19 +3,19 @@ define('HBC_File', 'worker'); require_once '../config.php'; -require_once HandBrakeCluster_Lib . 'HandBrakeCluster/Main.class.php'; +require_once RippingCluster_Lib . 'RippingCluster/Main.class.php'; try { set_time_limit(0); - $main = HandBrakeCluster_Main::instance(); + $main = RippingCluster_Main::instance(); $smarty = $main->smarty(); - $worker = new HandBrakeCluster_Worker(); + $worker = new RippingCluster_Worker(); $worker->start(); -} catch (HandBrakeCluster_Exception $e) { +} catch (RippingCluster_Exception $e) { die("Uncaught Exception: " . $e->getMessage()); }