Renamed the codebase to RippingCluster
Since the new design is engine agnostic, removed HandBrake from the class names.
This commit is contained in:
@@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HandBrakeCluster Library path
|
* RippingCluster Library path
|
||||||
*
|
*
|
||||||
* Specifies the absolute or relative path to the HandBrakeCluster library directory, relative to the webui root directory.
|
* Specifies the absolute or relative path to the RippingCluster library directory, relative to the webui root directory.
|
||||||
* Path must end with a trailing slash.
|
* Path must end with a trailing slash.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
define('HandBrakeCluster_Lib', '../lib/');
|
define('RippingCluster_Lib', '../lib/');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HandBrakeCluster Database Configuration
|
* RippingCluster Database Configuration
|
||||||
*
|
*
|
||||||
* Specifies the absolute or relative path to the HandBrakeCluster database configuration file.
|
* Specifies the absolute or relative path to the RippingCluster database configuration file.
|
||||||
* This is a standard ini type file, containing the config required to connect to the database.
|
* This is a standard ini type file, containing the config required to connect to the database.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
define('HandBrakeCluster_DBConfig', '../dbconfig.conf');
|
define('RippingCluster_DBConfig', '../dbconfig.conf');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class HandBrakeCluster_ClientLogEntry extends HandBrakeCluster_LogEntry {
|
|
||||||
|
|
||||||
public static function initialise() {
|
|
||||||
parent::$table_name = 'client_log';
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
HandBrakeCluster_ClientLogEntry::initialise();
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class HandBrakeCluster_Exception extends Exception {};
|
|
||||||
|
|
||||||
class HandBrakeCluster_Exception_DatabaseException extends HandBrakeCluster_Exception {};
|
|
||||||
class HandBrakeCluster_Exception_DatabaseConfigMissing extends HandBrakeCluster_Exception_DatabaseException {};
|
|
||||||
class HandBrakeCluster_Exception_DatabaseConnectFailed extends HandBrakeCluster_Exception_DatabaseException {};
|
|
||||||
class HandBrakeCluster_Exception_NoDatabaseConnection extends HandBrakeCluster_Exception_DatabaseException {};
|
|
||||||
class HandBrakeCluster_Exception_DatabaseQueryFailed extends HandBrakeCluster_Exception_DatabaseException {};
|
|
||||||
class HandBrakeCluster_Exception_ResultCountMismatch extends HandBrakeCluster_Exception_DatabaseException {};
|
|
||||||
|
|
||||||
class HandBrakeCluster_Exception_ConfigException extends HandBrakeCluster_Exception {};
|
|
||||||
class HandBrakeCluster_Exception_UnknownSetting extends HandBrakeCluster_Exception_ConfigException {};
|
|
||||||
|
|
||||||
class HandBrakeCluster_Exception_TemplateException extends HandBrakeCluster_Exception {};
|
|
||||||
class HandBrakeCluster_Exception_AbortEntirePage extends HandBrakeCluster_Exception_TemplateException {};
|
|
||||||
class HandBrakeCluster_Exception_Unauthorized extends HandBrakeCluster_Exception_TemplateException {};
|
|
||||||
class HandBrakeCluster_Exception_FileNotFound extends HandBrakeCluster_Exception_TemplateException {};
|
|
||||||
class HandBrakeCluster_Exception_InvalidParameters extends HandBrakeCluster_Exception_TemplateException {};
|
|
||||||
|
|
||||||
class HandBrakeCluster_Exception_InvalidSourceDirectory extends HandBrakeCluster_Exception {};
|
|
||||||
|
|
||||||
class HandBrakeCluster_Exception_CacheException extends HandBrakeCluster_Exception {};
|
|
||||||
class HandBrakeCluster_Exception_InvalidCacheDir extends HandBrakeCluster_Exception_CacheException {};
|
|
||||||
class HandBrakeCluster_Exception_CacheObjectNotFound extends HandBrakeCluster_Exception_CacheException {};
|
|
||||||
|
|
||||||
class HandBrakeCluster_Exception_LogicException extends HandBrakeCluster_Exception {};
|
|
||||||
class HandBrakeCluster_Exception_JobNotRunning extends HandBrakeCluster_Exception_LogicException {};
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class HandBrakeCluster_WorkerLogEntry extends HandBrakeCluster_LogEntry {
|
|
||||||
|
|
||||||
public static function initialise() {
|
|
||||||
parent::$table_name = 'worker_log';
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
HandBrakeCluster_WorkerLogEntry::initialise();
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_BackgroundTask {
|
class RippingCluster_BackgroundTask {
|
||||||
|
|
||||||
protected function __construct() {
|
protected function __construct() {
|
||||||
|
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Cache {
|
class RippingCluster_Cache {
|
||||||
|
|
||||||
protected $config;
|
protected $config;
|
||||||
protected $cache_dir;
|
protected $cache_dir;
|
||||||
|
|
||||||
public function __construct(HandBrakeCluster_Config $config) {
|
public function __construct(RippingCluster_Config $config) {
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->cache_dir = $config->get('cache.base_dir');
|
$this->cache_dir = $config->get('cache.base_dir');
|
||||||
|
|
||||||
if (is_dir($this->cache_dir)) {
|
if (is_dir($this->cache_dir)) {
|
||||||
if ( ! is_writeable($this->cache_dir)) {
|
if ( ! is_writeable($this->cache_dir)) {
|
||||||
throw new HandBrakeCluster_Exception_InvalidCacheDir();
|
throw new RippingCluster_Exception_InvalidCacheDir();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( ! HandBrakeCluster_Main::mkdir_recursive($this->cache_dir)) {
|
if ( ! RippingCluster_Main::mkdir_recursive($this->cache_dir)) {
|
||||||
throw new HandBrakeCluster_Exception_InvalidCacheDir();
|
throw new RippingCluster_Exception_InvalidCacheDir();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ class HandBrakeCluster_Cache {
|
|||||||
$cache_filename = $this->cacheFilename($source_filename);
|
$cache_filename = $this->cacheFilename($source_filename);
|
||||||
|
|
||||||
if (!$this->exists($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);
|
return file_get_contents($cache_filename);
|
||||||
13
lib/RippingCluster/ClientLogEntry.class.php
Normal file
13
lib/RippingCluster/ClientLogEntry.class.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class RippingCluster_ClientLogEntry extends RippingCluster_LogEntry {
|
||||||
|
|
||||||
|
public static function initialise() {
|
||||||
|
parent::$table_name = 'client_log';
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
RippingCluster_ClientLogEntry::initialise();
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Config {
|
class RippingCluster_Config {
|
||||||
|
|
||||||
private $dbconfig;
|
private $dbconfig;
|
||||||
private $database;
|
private $database;
|
||||||
@@ -20,20 +20,20 @@ class HandBrakeCluster_Config {
|
|||||||
|
|
||||||
public function getDatabase($key) {
|
public function getDatabase($key) {
|
||||||
if (!isset($this->databaseConfig[$key])) {
|
if (!isset($this->databaseConfig[$key])) {
|
||||||
throw new HandBrakeCluster_Exception_DatabaseConfigMissing($key);
|
throw new RippingCluster_Exception_DatabaseConfigMissing($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->databaseConfig[$key];
|
return $this->databaseConfig[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDatabase(HandBrakeCluster_Database $database) {
|
public function setDatabase(RippingCluster_Database $database) {
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$this->preload();
|
$this->preload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preload() {
|
public function preload() {
|
||||||
if (!$this->database) {
|
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');
|
$this->settings = $this->database->selectAssoc('SELECT name,value FROM settings', 'name', 'value');
|
||||||
@@ -45,7 +45,7 @@ class HandBrakeCluster_Config {
|
|||||||
|
|
||||||
public function get($key) {
|
public function get($key) {
|
||||||
if (!isset($this->settings[$key])) {
|
if (!isset($this->settings[$key])) {
|
||||||
throw new HandBrakeCluster_Exception_UnknownSetting($key);
|
throw new RippingCluster_Exception_UnknownSetting($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->settings[$key];
|
return $this->settings[$key];
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Database {
|
class RippingCluster_Database {
|
||||||
|
|
||||||
private $config;
|
private $config;
|
||||||
private $dbh;
|
private $dbh;
|
||||||
@@ -12,7 +12,7 @@ class HandBrakeCluster_Database {
|
|||||||
|
|
||||||
private $prepared_statements = array();
|
private $prepared_statements = array();
|
||||||
|
|
||||||
public function __construct(HandBrakeCluster_Config $config) {
|
public function __construct(RippingCluster_Config $config) {
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
|
||||||
$this->hostname = $this->config->getDatabase('hostname');
|
$this->hostname = $this->config->getDatabase('hostname');
|
||||||
@@ -23,7 +23,7 @@ class HandBrakeCluster_Database {
|
|||||||
try {
|
try {
|
||||||
$this->dbh = new PDO("mysql:host={$this->hostname};dbname={$this->dbname}", $this->username, $this->password);
|
$this->dbh = new PDO("mysql:host={$this->hostname};dbname={$this->dbname}", $this->username, $this->password);
|
||||||
} catch (PDOException $e) {
|
} 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();
|
$result = $stmt->execute();
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
list($code, $dummy, $message) = $stmt->errorInfo();
|
list($code, $dummy, $message) = $stmt->errorInfo();
|
||||||
throw new HandBrakeCluster_Exception_DatabaseQueryFailed($message, $code);
|
throw new RippingCluster_Exception_DatabaseQueryFailed($message, $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $stmt->fetchAll();
|
return $stmt->fetchAll();
|
||||||
@@ -73,7 +73,7 @@ class HandBrakeCluster_Database {
|
|||||||
public function selectOne($sql, $bind_params = null) {
|
public function selectOne($sql, $bind_params = null) {
|
||||||
$rows = $this->selectList($sql, $bind_params);
|
$rows = $this->selectList($sql, $bind_params);
|
||||||
if (count($rows) != 1) {
|
if (count($rows) != 1) {
|
||||||
throw new HandBrakeCluster_Exception_ResultCountMismatch(count($rows));
|
throw new RippingCluster_Exception_ResultCountMismatch(count($rows));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rows[0];
|
return $rows[0];
|
||||||
@@ -95,7 +95,7 @@ class HandBrakeCluster_Database {
|
|||||||
$result = $stmt->execute();
|
$result = $stmt->execute();
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
list($code, $dummy, $message) = $stmt->errorInfo();
|
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();
|
$result = $stmt->execute();
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
list($code, $dummy, $message) = $stmt->errorInfo();
|
list($code, $dummy, $message) = $stmt->errorInfo();
|
||||||
throw new HandBrakeCluster_Exception_DatabaseQueryFailed($message, $code);
|
throw new RippingCluster_Exception_DatabaseQueryFailed($message, $code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
30
lib/RippingCluster/Exceptions.class.php
Normal file
30
lib/RippingCluster/Exceptions.class.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class RippingCluster_Exception extends Exception {};
|
||||||
|
|
||||||
|
class RippingCluster_Exception_DatabaseException extends RippingCluster_Exception {};
|
||||||
|
class RippingCluster_Exception_DatabaseConfigMissing extends RippingCluster_Exception_DatabaseException {};
|
||||||
|
class RippingCluster_Exception_DatabaseConnectFailed extends RippingCluster_Exception_DatabaseException {};
|
||||||
|
class RippingCluster_Exception_NoDatabaseConnection extends RippingCluster_Exception_DatabaseException {};
|
||||||
|
class RippingCluster_Exception_DatabaseQueryFailed extends RippingCluster_Exception_DatabaseException {};
|
||||||
|
class RippingCluster_Exception_ResultCountMismatch extends RippingCluster_Exception_DatabaseException {};
|
||||||
|
|
||||||
|
class RippingCluster_Exception_ConfigException extends RippingCluster_Exception {};
|
||||||
|
class RippingCluster_Exception_UnknownSetting extends RippingCluster_Exception_ConfigException {};
|
||||||
|
|
||||||
|
class RippingCluster_Exception_TemplateException extends RippingCluster_Exception {};
|
||||||
|
class RippingCluster_Exception_AbortEntirePage extends RippingCluster_Exception_TemplateException {};
|
||||||
|
class RippingCluster_Exception_Unauthorized extends RippingCluster_Exception_TemplateException {};
|
||||||
|
class RippingCluster_Exception_FileNotFound extends RippingCluster_Exception_TemplateException {};
|
||||||
|
class RippingCluster_Exception_InvalidParameters extends RippingCluster_Exception_TemplateException {};
|
||||||
|
|
||||||
|
class RippingCluster_Exception_InvalidSourceDirectory extends RippingCluster_Exception {};
|
||||||
|
|
||||||
|
class RippingCluster_Exception_CacheException extends RippingCluster_Exception {};
|
||||||
|
class RippingCluster_Exception_InvalidCacheDir extends RippingCluster_Exception_CacheException {};
|
||||||
|
class RippingCluster_Exception_CacheObjectNotFound extends RippingCluster_Exception_CacheException {};
|
||||||
|
|
||||||
|
class RippingCluster_Exception_LogicException extends RippingCluster_Exception {};
|
||||||
|
class RippingCluster_Exception_JobNotRunning extends RippingCluster_Exception_LogicException {};
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_ForegroundTask {
|
class RippingCluster_ForegroundTask {
|
||||||
|
|
||||||
const PIPE_STDIN = 0;
|
const PIPE_STDIN = 0;
|
||||||
const PIPE_STDOUT = 1;
|
const PIPE_STDOUT = 1;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Job {
|
class RippingCluster_Job {
|
||||||
|
|
||||||
protected $source;
|
protected $source;
|
||||||
|
|
||||||
@@ -51,8 +51,8 @@ class HandBrakeCluster_Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function fromDatabaseRow($row) {
|
public static function fromDatabaseRow($row) {
|
||||||
return new HandBrakeCluster_Job(
|
return new RippingCluster_Job(
|
||||||
HandBrakeCluster_Rips_Source::load($row['source'], false),
|
RippingCluster_Rips_Source::load($row['source'], false),
|
||||||
$row['id'],
|
$row['id'],
|
||||||
$row['name'],
|
$row['name'],
|
||||||
$row['source'],
|
$row['source'],
|
||||||
@@ -76,16 +76,16 @@ class HandBrakeCluster_Job {
|
|||||||
* @todo Implement cache of previously loaded jobs
|
* @todo Implement cache of previously loaded jobs
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return HandBrakeCluster_Job
|
* @return RippingCluster_Job
|
||||||
*/
|
*/
|
||||||
public static function fromId($id) {
|
public static function fromId($id) {
|
||||||
$database = HandBrakeCluster_Main::instance()->database();
|
$database = RippingCluster_Main::instance()->database();
|
||||||
|
|
||||||
if (isset(self::$cache[$id])) {
|
if (isset(self::$cache[$id])) {
|
||||||
return self::$cache[$id];
|
return self::$cache[$id];
|
||||||
}
|
}
|
||||||
|
|
||||||
$job = HandBrakeCluster_Job::fromDatabaseRow(
|
$job = RippingCluster_Job::fromDatabaseRow(
|
||||||
$database->selectOne('SELECT * FROM jobs WHERE id=:id', array(
|
$database->selectOne('SELECT * FROM jobs WHERE id=:id', array(
|
||||||
array('name' => 'id', 'value' => $id, 'type' => PDO::PARAM_INT)
|
array('name' => 'id', 'value' => $id, 'type' => PDO::PARAM_INT)
|
||||||
)
|
)
|
||||||
@@ -100,7 +100,7 @@ class HandBrakeCluster_Job {
|
|||||||
public static function all() {
|
public static function all() {
|
||||||
$jobs = array();
|
$jobs = array();
|
||||||
|
|
||||||
$database = HandBrakeCluster_Main::instance()->database();
|
$database = RippingCluster_Main::instance()->database();
|
||||||
foreach ($database->selectList('SELECT * FROM jobs WHERE id > 0') as $row) {
|
foreach ($database->selectList('SELECT * FROM jobs WHERE id > 0') as $row) {
|
||||||
$job = self::fromDatabaseRow($row);
|
$job = self::fromDatabaseRow($row);
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ class HandBrakeCluster_Job {
|
|||||||
|
|
||||||
public static function allWithStatus($status, $limit = null) {
|
public static function allWithStatus($status, $limit = null) {
|
||||||
$jobs = array();
|
$jobs = array();
|
||||||
$database = HandBrakeCluster_Main::instance()->database();
|
$database = RippingCluster_Main::instance()->database();
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
array('name' => 'status', 'value' => $status, 'type' => PDO::PARAM_INT),
|
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) {
|
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();
|
$jobs = array();
|
||||||
foreach ($titles as $title => $details) {
|
foreach ($titles as $title => $details) {
|
||||||
if (HandBrakeCluster_Main::issetelse($details['queue'])) {
|
if (RippingCluster_Main::issetelse($details['queue'])) {
|
||||||
HandBrakeCluster_Main::issetelse($details['output_filename'], HandBrakeCluster_Exception_InvalidParameters);
|
RippingCluster_Main::issetelse($details['output_filename'], RippingCluster_Exception_InvalidParameters);
|
||||||
|
|
||||||
$job = new HandBrakeCluster_Job(
|
$job = new RippingCluster_Job(
|
||||||
$source,
|
$source,
|
||||||
null,
|
null,
|
||||||
HandBrakeCluster_Main::issetelse($details['name'], 'unnamed job'),
|
RippingCluster_Main::issetelse($details['name'], 'unnamed job'),
|
||||||
$source->filename(),
|
$source->filename(),
|
||||||
$global_options['output-directory'] . DIRECTORY_SEPARATOR . $details['output_filename'],
|
$global_options['output-directory'] . DIRECTORY_SEPARATOR . $details['output_filename'],
|
||||||
$title,
|
$title,
|
||||||
@@ -152,11 +152,11 @@ class HandBrakeCluster_Job {
|
|||||||
$global_options['video-width'],
|
$global_options['video-width'],
|
||||||
$global_options['video-height'],
|
$global_options['video-height'],
|
||||||
$global_options['quantizer'],
|
$global_options['quantizer'],
|
||||||
HandBrakeCluster_Main::issetelse($details['deinterlace'], 2),
|
RippingCluster_Main::issetelse($details['deinterlace'], 2),
|
||||||
implode(',', HandBrakeCluster_Main::issetelse($details['audio'], array())),
|
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']), 'ac3')), // @todo Make this configurable
|
||||||
implode(',', array_pad(array(), count($details['audio']), 'Unknown')), // @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();
|
$job->create();
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ class HandBrakeCluster_Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function create() {
|
protected function create() {
|
||||||
$database = HandBrakeCluster_Main::instance()->database();
|
$database = RippingCluster_Main::instance()->database();
|
||||||
$database->insert(
|
$database->insert(
|
||||||
'INSERT INTO jobs
|
'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)
|
(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();
|
$this->id = $database->lastInsertId();
|
||||||
$status = HandBrakeCluster_JobStatus::updateStatusForJob($this, HandBrakeCluster_JobStatus::CREATED);
|
$status = RippingCluster_JobStatus::updateStatusForJob($this, RippingCluster_JobStatus::CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete() {
|
public function delete() {
|
||||||
$database = HandBrakeCluster_Main::instance()->database();
|
$database = RippingCluster_Main::instance()->database();
|
||||||
$database->update(
|
$database->update(
|
||||||
'DELETE FROM jobs WHERE id=:job_id LIMIT 1',
|
'DELETE FROM jobs WHERE id=:job_id LIMIT 1',
|
||||||
array(
|
array(
|
||||||
@@ -208,7 +208,7 @@ class HandBrakeCluster_Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function queue($gearman) {
|
public function queue($gearman) {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$config = $main->config();
|
$config = $main->config();
|
||||||
$log = $main->log();
|
$log = $main->log();
|
||||||
$log->info('Starting job', $this->id);
|
$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);
|
$task = $gearman->addTask('handbrake_rip', serialize($rip_options), $config->get('rips.context'), $this->id);
|
||||||
if ($task) {
|
if ($task) {
|
||||||
$log->debug("Queued job", $this->id);
|
$log->debug("Queued job", $this->id);
|
||||||
$this->updateStatus(HandBrakeCluster_JobStatus::QUEUED);
|
$this->updateStatus(RippingCluster_JobStatus::QUEUED);
|
||||||
} else {
|
} else {
|
||||||
$log->warning("Failed to queue job", $this->id);
|
$log->warning("Failed to queue job", $this->id);
|
||||||
$this->updateStatus(HandBrakeCluster_JobStatus::FAILED);
|
$this->updateStatus(RippingCluster_JobStatus::FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadStatuses() {
|
protected function loadStatuses() {
|
||||||
if ($this->statuses == null) {
|
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() {
|
public function currentStatus() {
|
||||||
$this->loadStatuses();
|
$this->loadStatuses();
|
||||||
@@ -258,13 +258,13 @@ class HandBrakeCluster_Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function updateStatus($new_status, $rip_progress = null) {
|
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() {
|
public function calculateETA() {
|
||||||
$current_status = $this->currentStatus();
|
$current_status = $this->currentStatus();
|
||||||
if ($current_status->status() != HandBrakeCluster_JobStatus::RUNNING) {
|
if ($current_status->status() != RippingCluster_JobStatus::RUNNING) {
|
||||||
throw new HandBrakeCluster_Exception_JobNotRunning();
|
throw new RippingCluster_Exception_JobNotRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
$running_time = $current_status->mtime() - $current_status->ctime();
|
$running_time = $current_status->mtime() - $current_status->ctime();
|
||||||
@@ -298,7 +298,7 @@ class HandBrakeCluster_Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function runAllJobs() {
|
public static function runAllJobs() {
|
||||||
HandBrakeCluster_BackgroundTask::run('/usr/bin/php run-jobs.php');
|
RippingCluster_BackgroundTask::run('/usr/bin/php run-jobs.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_JobStatus {
|
class RippingCluster_JobStatus {
|
||||||
|
|
||||||
const CREATED = 0;
|
const CREATED = 0;
|
||||||
const QUEUED = 1;
|
const QUEUED = 1;
|
||||||
@@ -33,7 +33,7 @@ class HandBrakeCluster_JobStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function fromDatabaseRow($row) {
|
public static function fromDatabaseRow($row) {
|
||||||
return new HandBrakeCluster_JobStatus(
|
return new RippingCluster_JobStatus(
|
||||||
$row['id'],
|
$row['id'],
|
||||||
$row['job_id'],
|
$row['job_id'],
|
||||||
$row['status'],
|
$row['status'],
|
||||||
@@ -45,7 +45,7 @@ class HandBrakeCluster_JobStatus {
|
|||||||
|
|
||||||
public static function updateStatusForJob($job, $status, $rip_progress = null) {
|
public static function updateStatusForJob($job, $status, $rip_progress = null) {
|
||||||
$ctime = $mtime = time();
|
$ctime = $mtime = time();
|
||||||
$status = new HandBrakeCluster_JobStatus(null, $job->id(), $status, $ctime, $mtime, $rip_progress);
|
$status = new RippingCluster_JobStatus(null, $job->id(), $status, $ctime, $mtime, $rip_progress);
|
||||||
$status->create();
|
$status->create();
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
@@ -57,21 +57,21 @@ class HandBrakeCluster_JobStatus {
|
|||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function allForJob(HandBrakeCluster_Job $job) {
|
public static function allForJob(RippingCluster_Job $job) {
|
||||||
$statuses = array();
|
$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(
|
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),
|
array('name' => 'job_id', 'value' => $job->id(), 'type' => PDO::PARAM_INT),
|
||||||
)) as $row) {
|
)) as $row) {
|
||||||
$statuses[] = HandBrakeCluster_JobStatus::fromDatabaseRow($row);
|
$statuses[] = RippingCluster_JobStatus::fromDatabaseRow($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $statuses;
|
return $statuses;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function create() {
|
protected function create() {
|
||||||
$database = HandBrakeCluster_Main::instance()->database();
|
$database = RippingCluster_Main::instance()->database();
|
||||||
$database->insert(
|
$database->insert(
|
||||||
'INSERT INTO job_status
|
'INSERT INTO job_status
|
||||||
(id, job_id, status, ctime, mtime, rip_progress)
|
(id, job_id, status, ctime, mtime, rip_progress)
|
||||||
@@ -89,7 +89,7 @@ class HandBrakeCluster_JobStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function save() {
|
public function save() {
|
||||||
$database = HandBrakeCluster_Main::instance()->database();
|
$database = RippingCluster_Main::instance()->database();
|
||||||
$database->update(
|
$database->update(
|
||||||
'UPDATE job_status SET
|
'UPDATE job_status SET
|
||||||
job_id=:job_id, status=:status, ctime=:ctime, mtime=:mtime, rip_progress=:rip_progress
|
job_id=:job_id, status=:status, ctime=:ctime, mtime=:mtime, rip_progress=:rip_progress
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Log {
|
class RippingCluster_Log {
|
||||||
|
|
||||||
private static $hostname = '';
|
private static $hostname = '';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ class HandBrakeCluster_Log {
|
|||||||
private $config;
|
private $config;
|
||||||
private $table;
|
private $table;
|
||||||
|
|
||||||
public function __construct(HandBrakeCluster_Database $database, HandBrakeCluster_Config $config, $table) {
|
public function __construct(RippingCluster_Database $database, RippingCluster_Config $config, $table) {
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->table = $table;
|
$this->table = $table;
|
||||||
@@ -56,6 +56,6 @@ class HandBrakeCluster_Log {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HandBrakeCluster_Log::initialise();
|
RippingCluster_Log::initialise();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class HandBrakeCluster_LogEntry {
|
abstract class RippingCluster_LogEntry {
|
||||||
|
|
||||||
protected static $table_name = "";
|
protected static $table_name = "";
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ abstract class HandBrakeCluster_LogEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function fromDatabaseRow($row) {
|
public static function fromDatabaseRow($row) {
|
||||||
return new HandBrakeCluster_ClientLogEntry(
|
return new RippingCluster_ClientLogEntry(
|
||||||
$row['id'],
|
$row['id'],
|
||||||
$row['job_id'],
|
$row['job_id'],
|
||||||
$row['level'],
|
$row['level'],
|
||||||
@@ -41,8 +41,8 @@ abstract class HandBrakeCluster_LogEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function fromId($id) {
|
public static function fromId($id) {
|
||||||
$database = HandBrakeCluster_Main::instance()->database();
|
$database = RippingCluster_Main::instance()->database();
|
||||||
return HandBrakeCluster_ClientLogEntry::fromDatabaseRow(
|
return RippingCluster_ClientLogEntry::fromDatabaseRow(
|
||||||
$database->selectOne('SELECT * FROM '.self::$table_name.' WHERE id=:id', array(
|
$database->selectOne('SELECT * FROM '.self::$table_name.' WHERE id=:id', array(
|
||||||
array('name' => 'id', 'value' => $id, 'type' => PDO::PARAM_INT)
|
array('name' => 'id', 'value' => $id, 'type' => PDO::PARAM_INT)
|
||||||
)
|
)
|
||||||
@@ -53,7 +53,7 @@ abstract class HandBrakeCluster_LogEntry {
|
|||||||
public static function recent($limit = 100) {
|
public static function recent($limit = 100) {
|
||||||
$entries = array();
|
$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(
|
foreach ($database->selectList('SELECT * FROM '.self::$table_name.' ORDER BY ctime DESC LIMIT :limit', array(
|
||||||
array('name' => 'limit', 'value' => $limit, 'type' => PDO::PARAM_INT)
|
array('name' => 'limit', 'value' => $limit, 'type' => PDO::PARAM_INT)
|
||||||
)) as $row) {
|
)) as $row) {
|
||||||
@@ -66,7 +66,7 @@ abstract class HandBrakeCluster_LogEntry {
|
|||||||
public static function recentForJob($job_id, $limit = 100) {
|
public static function recentForJob($job_id, $limit = 100) {
|
||||||
$entries = array();
|
$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(
|
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' => 'job_id', 'value' => $job_id, 'type' => PDO::PARAM_INT),
|
||||||
array('name' => 'limit', 'value' => $limit, 'type' => PDO::PARAM_INT)
|
array('name' => 'limit', 'value' => $limit, 'type' => PDO::PARAM_INT)
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
require 'smarty/Smarty.class.php';
|
require 'smarty/Smarty.class.php';
|
||||||
|
|
||||||
class HandBrakeCluster_Main {
|
class RippingCluster_Main {
|
||||||
|
|
||||||
private static $instance;
|
private static $instance;
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ class HandBrakeCluster_Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->config = new HandBrakeCluster_Config(HandBrakeCluster_DBConfig);
|
$this->config = new RippingCluster_Config(RippingCluster_DBConfig);
|
||||||
$this->database = new HandBrakeCluster_Database($this->config);
|
$this->database = new RippingCluster_Database($this->config);
|
||||||
$this->config->setDatabase($this->database);
|
$this->config->setDatabase($this->database);
|
||||||
|
|
||||||
$this->log = new HandBrakeCluster_Log($this->database, $this->config, $log_table);
|
$this->log = new RippingCluster_Log($this->database, $this->config, $log_table);
|
||||||
$this->request = new HandBrakeCluster_RequestParser($request_string);
|
$this->request = new RippingCluster_RequestParser($request_string);
|
||||||
$this->cache = new HandBrakeCluster_Cache($this->config);
|
$this->cache = new RippingCluster_Cache($this->config);
|
||||||
|
|
||||||
$this->smarty = new Smarty();
|
$this->smarty = new Smarty();
|
||||||
$this->smarty->template_dir = './templates';
|
$this->smarty->template_dir = './templates';
|
||||||
@@ -44,7 +44,7 @@ class HandBrakeCluster_Main {
|
|||||||
$this->smarty->cache_dir = './tmp/cache';
|
$this->smarty->cache_dir = './tmp/cache';
|
||||||
$this->smarty->config_fir = './config';
|
$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');
|
$this->smarty->assign('version', '0.1');
|
||||||
|
|
||||||
@@ -55,11 +55,11 @@ class HandBrakeCluster_Main {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return HandBrakeCluster_Main
|
* @return RippingCluster_Main
|
||||||
*/
|
*/
|
||||||
public static function instance() {
|
public static function instance() {
|
||||||
if (!self::$instance) {
|
if (!self::$instance) {
|
||||||
self::$instance = new HandBrakeCluster_Main();
|
self::$instance = new RippingCluster_Main();
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
@@ -71,7 +71,7 @@ class HandBrakeCluster_Main {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return HandBrakeCluster_Config
|
* @return RippingCluster_Config
|
||||||
*/
|
*/
|
||||||
public function config() {
|
public function config() {
|
||||||
return $this->config;
|
return $this->config;
|
||||||
@@ -79,7 +79,7 @@ class HandBrakeCluster_Main {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return HandBrakeCluster_Database
|
* @return RippingCluster_Database
|
||||||
*/
|
*/
|
||||||
public function database() {
|
public function database() {
|
||||||
return $this->database;
|
return $this->database;
|
||||||
@@ -87,7 +87,7 @@ class HandBrakeCluster_Main {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return HandBrakeCluster_Log
|
* @return RippingCluster_Log
|
||||||
*/
|
*/
|
||||||
public function log() {
|
public function log() {
|
||||||
return $this->log;
|
return $this->log;
|
||||||
@@ -95,7 +95,7 @@ class HandBrakeCluster_Main {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return HandBrakeCluster_RequestParser
|
* @return RippingCluster_RequestParser
|
||||||
*/
|
*/
|
||||||
public function request() {
|
public function request() {
|
||||||
return $this->request;
|
return $this->request;
|
||||||
@@ -103,7 +103,7 @@ class HandBrakeCluster_Main {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return HandBrakeCluster_Cache
|
* @return RippingCluster_Cache
|
||||||
*/
|
*/
|
||||||
public function cache() {
|
public function cache() {
|
||||||
return $this->cache;
|
return $this->cache;
|
||||||
@@ -122,7 +122,7 @@ class HandBrakeCluster_Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function initialise() {
|
public static function initialise() {
|
||||||
spl_autoload_register(array('HandBrakeCluster_Main','autoload'));
|
spl_autoload_register(array('RippingCluster_Main','autoload'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function autoload($classname) {
|
public static function autoload($classname) {
|
||||||
@@ -132,18 +132,18 @@ class HandBrakeCluster_Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the class to load begins with our prefix
|
// Ensure the class to load begins with our prefix
|
||||||
if (!preg_match('/^HandBrakeCluster_/', $classname)) {
|
if (!preg_match('/^RippingCluster_/', $classname)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special case: All exceptions are stored in the same file
|
// Special case: All exceptions are stored in the same file
|
||||||
if (preg_match('/^HandBrakeCluster_Exception/', $classname)) {
|
if (preg_match('/^RippingCluster_Exception/', $classname)) {
|
||||||
require_once(HandBrakeCluster_Lib . 'HandBrakeCluster/Exceptions.class.php');
|
require_once(RippingCluster_Lib . 'RippingCluster/Exceptions.class.php');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace any underscores with directory separators
|
// Replace any underscores with directory separators
|
||||||
$filename = HandBrakeCluster_Lib . preg_replace('/_/', '/', $classname);
|
$filename = RippingCluster_Lib . preg_replace('/_/', '/', $classname);
|
||||||
|
|
||||||
// Tack on the class file suffix
|
// Tack on the class file suffix
|
||||||
$filename .= '.class.php';
|
$filename .= '.class.php';
|
||||||
@@ -174,7 +174,7 @@ class HandBrakeCluster_Main {
|
|||||||
return $var;
|
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();
|
throw new $default();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,6 +210,6 @@ class HandBrakeCluster_Main {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HandBrakeCluster_Main::initialise();
|
RippingCluster_Main::initialise();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Page {
|
class RippingCluster_Page {
|
||||||
|
|
||||||
private $smarty;
|
private $smarty;
|
||||||
private $request;
|
private $request;
|
||||||
|
|
||||||
private $page;
|
private $page;
|
||||||
|
|
||||||
public function __construct(Smarty $smarty, HandBrakeCluster_RequestParser $request) {
|
public function __construct(Smarty $smarty, RippingCluster_RequestParser $request) {
|
||||||
$this->smarty = $smarty;
|
$this->smarty = $smarty;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
$this->page = $request->page();
|
$this->page = $request->page();
|
||||||
@@ -27,11 +27,11 @@ class HandBrakeCluster_Page {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->render($template_filename, $code_filename, $template_variables);
|
$this->render($template_filename, $code_filename, $template_variables);
|
||||||
} catch (HandBrakeCluster_Exception_AbortEntirePage $e) {
|
} catch (RippingCluster_Exception_AbortEntirePage $e) {
|
||||||
return false;
|
return false;
|
||||||
} catch (HandBrakeCluster_Exception_FileNotFound $e) {
|
} catch (RippingCluster_Exception_FileNotFound $e) {
|
||||||
$this->render('errors/404.tpl', 'errors/404.php');
|
$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(
|
$this->render('errors/unhandled-exception.tpl', 'errors/unhandled-exception.php', array(
|
||||||
'exception' => $e,
|
'exception' => $e,
|
||||||
));
|
));
|
||||||
@@ -42,7 +42,7 @@ class HandBrakeCluster_Page {
|
|||||||
|
|
||||||
protected function render($template_filename, $code_filename = null, $template_variables = array()) {
|
protected function render($template_filename, $code_filename = null, $template_variables = array()) {
|
||||||
if ( ! $this->smarty->template_exists($template_filename)) {
|
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,
|
// Copy all the template variables into the namespace for this function,
|
||||||
@@ -62,11 +62,11 @@ class HandBrakeCluster_Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function redirect($relative_url) {
|
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");
|
header("Location: $absolute_url");
|
||||||
|
|
||||||
throw new HandBrakeCluster_Exception_AbortEntirePage();
|
throw new RippingCluster_Exception_AbortEntirePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class HandBrakeCluster_PluginFactory {
|
abstract class RippingCluster_PluginFactory {
|
||||||
|
|
||||||
static protected $validPlugins;
|
static protected $validPlugins;
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ abstract class HandBrakeCluster_PluginFactory {
|
|||||||
protected static function findPlugins($directory) {
|
protected static function findPlugins($directory) {
|
||||||
$plugins = array();
|
$plugins = array();
|
||||||
|
|
||||||
$iterator = new HandBrakeCluster_Utility_ClassFilesIterator(new HandBrakeCluster_Utility_VisibleFilesIterator(new DirectoryIterator(HandBrakeCluster_Lib . $directory)));
|
$iterator = new RippingCluster_Utility_ClassFilesIterator(new RippingCluster_Utility_VisibleFilesIterator(new DirectoryIterator(RippingCluster_Lib . $directory)));
|
||||||
|
|
||||||
foreach ($iterator as /** @var SplFileInfo */ $file) {
|
foreach ($iterator as /** @var SplFileInfo */ $file) {
|
||||||
$plugin = preg_replace('/.class.php$/', '', $file->getFilename());
|
$plugin = preg_replace('/.class.php$/', '', $file->getFilename());
|
||||||
@@ -33,7 +33,7 @@ abstract class HandBrakeCluster_PluginFactory {
|
|||||||
continue;
|
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";
|
echo "$plugin does not implement the necessary interfaces\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_RequestParser {
|
class RippingCluster_RequestParser {
|
||||||
|
|
||||||
private $request_string;
|
private $request_string;
|
||||||
private $page = array();
|
private $page = array();
|
||||||
@@ -81,7 +81,7 @@ class HandBrakeCluster_RequestParser {
|
|||||||
return $this->vars[$key];
|
return $this->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();
|
throw new $default();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Rips_Source {
|
class RippingCluster_Rips_Source {
|
||||||
|
|
||||||
const PM_TITLE = 0;
|
const PM_TITLE = 0;
|
||||||
const PM_CHAPTER = 1;
|
const PM_CHAPTER = 1;
|
||||||
@@ -18,7 +18,7 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
$this->scan();
|
$this->scan();
|
||||||
}
|
}
|
||||||
|
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$cache = $main->cache();
|
$cache = $main->cache();
|
||||||
$config = $main->config();
|
$config = $main->config();
|
||||||
|
|
||||||
@@ -28,12 +28,12 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function load($source_filename, $scan_dir = true, $use_cache = true) {
|
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)) {
|
if ($use_cache && $cache->exists($source_filename)) {
|
||||||
return unserialize($cache->fetch($source_filename));
|
return unserialize($cache->fetch($source_filename));
|
||||||
} else {
|
} 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
|
// Ensure the source is a valid directory, and lies below the configured source_dir
|
||||||
$real_source_filename = realpath($source_filename);
|
$real_source_filename = realpath($source_filename);
|
||||||
if (!is_dir($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');
|
$source_basedir = $config->get('rips.source_dir');
|
||||||
$real_source_basedir = realpath($source_basedir);
|
$real_source_basedir = realpath($source_basedir);
|
||||||
if (substr($real_source_filename, 0, strlen($real_source_basedir)) != $real_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);
|
return self::load($source_filename, $scan_dir, $use_cache);
|
||||||
@@ -60,7 +60,7 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
protected function scan() {
|
protected function scan() {
|
||||||
$source_shell = escapeshellarg($this->source);
|
$source_shell = escapeshellarg($this->source);
|
||||||
$handbrake_cmd = "HandBrakeCLI -i {$source_shell} -t 0";
|
$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
|
// Process the output
|
||||||
$lines = explode("\n", $handbrake_error);
|
$lines = explode("\n", $handbrake_error);
|
||||||
@@ -81,7 +81,7 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mode = self::PM_TITLE;
|
$mode = self::PM_TITLE;
|
||||||
$title = new HandBrakeCluster_Rips_SourceTitle($matches['id']);
|
$title = new RippingCluster_Rips_SourceTitle($matches['id']);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case $title && preg_match('/^ \+ chapters:$/', $line): {
|
case $title && preg_match('/^ \+ chapters:$/', $line): {
|
||||||
@@ -123,7 +123,7 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
|
|
||||||
case $title && $mode == self::PM_AUDIO && preg_match('/^ \+ (?P<id>\d+), (?P<name>.+) \((?P<format>.+)\) \((?P<channels>(.+ ch|Dolby Surround))\) \((?P<language>.+)\), (?P<samplerate>\d+)Hz, (?P<bitrate>\d+)bps$/', $line, $matches): {
|
case $title && $mode == self::PM_AUDIO && preg_match('/^ \+ (?P<id>\d+), (?P<name>.+) \((?P<format>.+)\) \((?P<channels>(.+ ch|Dolby Surround))\) \((?P<language>.+)\), (?P<samplerate>\d+)Hz, (?P<bitrate>\d+)bps$/', $line, $matches): {
|
||||||
$title->addAudioTrack(
|
$title->addAudioTrack(
|
||||||
new HandBrakeCluster_Rips_SourceAudioTrack(
|
new RippingCluster_Rips_SourceAudioTrack(
|
||||||
$matches['id'], $matches['name'], $matches['format'], $matches['channels'],
|
$matches['id'], $matches['name'], $matches['format'], $matches['channels'],
|
||||||
$matches['language'], $matches['samplerate'], $matches['bitrate']
|
$matches['language'], $matches['samplerate'], $matches['bitrate']
|
||||||
)
|
)
|
||||||
@@ -132,7 +132,7 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
|
|
||||||
case $title && $mode == self::PM_SUBTITLE && preg_match('/^ \+ (?P<id>\d+), (?P<name>.+) \((?P<language>.+)\) \((?P<format>.+)\)$/', $line, $matches): {
|
case $title && $mode == self::PM_SUBTITLE && preg_match('/^ \+ (?P<id>\d+), (?P<name>.+) \((?P<language>.+)\) \((?P<format>.+)\)$/', $line, $matches): {
|
||||||
$title->addSubtitleTrack(
|
$title->addSubtitleTrack(
|
||||||
new HandBrakeCluster_Rips_SourceSubtitleTrack(
|
new RippingCluster_Rips_SourceSubtitleTrack(
|
||||||
$matches['id'], $matches['name'], $matches['language'], $matches['format']
|
$matches['id'], $matches['name'], $matches['language'], $matches['format']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -154,7 +154,7 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function isCached($source_filename) {
|
public static function isCached($source_filename) {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$cache = $main->cache();
|
$cache = $main->cache();
|
||||||
$config = $main->config();
|
$config = $main->config();
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ class HandBrakeCluster_Rips_Source {
|
|||||||
return str_replace("/", "-", base64_encode($filename));
|
return str_replace("/", "-", base64_encode($filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addTitle(HandBrakeCluster_Rips_SourceTitle $title) {
|
public function addTitle(RippingCluster_Rips_SourceTitle $title) {
|
||||||
$this->titles[] = $title;
|
$this->titles[] = $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Rips_SourceAudioTrack {
|
class RippingCluster_Rips_SourceAudioTrack {
|
||||||
|
|
||||||
protected $id;
|
protected $id;
|
||||||
protected $name;
|
protected $name;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Rips_SourceLister {
|
class RippingCluster_Rips_SourceLister {
|
||||||
|
|
||||||
protected $base_directory;
|
protected $base_directory;
|
||||||
protected $sources = array();
|
protected $sources = array();
|
||||||
@@ -13,12 +13,12 @@ class HandBrakeCluster_Rips_SourceLister {
|
|||||||
|
|
||||||
public function scan() {
|
public function scan() {
|
||||||
if (!is_dir($this->base_directory)) {
|
if (!is_dir($this->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) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Rips_SourceSubtitleTrack {
|
class RippingCluster_Rips_SourceSubtitleTrack {
|
||||||
|
|
||||||
protected $id;
|
protected $id;
|
||||||
protected $name;
|
protected $name;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Rips_SourceTitle {
|
class RippingCluster_Rips_SourceTitle {
|
||||||
|
|
||||||
protected $id;
|
protected $id;
|
||||||
//protected $vts;
|
//protected $vts;
|
||||||
@@ -106,7 +106,7 @@ class HandBrakeCluster_Rips_SourceTitle {
|
|||||||
return $this->audio;
|
return $this->audio;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addAudioTrack(HandBrakeCluster_Rips_SourceAudioTrack $audio_track) {
|
public function addAudioTrack(RippingCluster_Rips_SourceAudioTrack $audio_track) {
|
||||||
$this->audio[] = $audio_track;
|
$this->audio[] = $audio_track;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ class HandBrakeCluster_Rips_SourceTitle {
|
|||||||
return $this->subtitles;
|
return $this->subtitles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addSubtitleTrack(HandBrakeCluster_Rips_SourceSubtitleTrack $subtitle_track) {
|
public function addSubtitleTrack(RippingCluster_Rips_SourceSubtitleTrack $subtitle_track) {
|
||||||
$this->subtitles[] = $subtitle_track;
|
$this->subtitles[] = $subtitle_track;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Utility_ClassFilesIterator extends FilterIterator {
|
class RippingCluster_Utility_ClassFilesIterator extends FilterIterator {
|
||||||
public function accept() {
|
public function accept() {
|
||||||
return preg_match('/.class.php$/i', $this->current()->getFilename());
|
return preg_match('/.class.php$/i', $this->current()->getFilename());
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Utility_DvdDirectoryIterator extends FilterIterator {
|
class RippingCluster_Utility_DvdDirectoryIterator extends FilterIterator {
|
||||||
public function accept() {
|
public function accept() {
|
||||||
return is_dir($this->current()->getPathname() . DIRECTORY_SEPARATOR . 'VIDEO_TS');
|
return is_dir($this->current()->getPathname() . DIRECTORY_SEPARATOR . 'VIDEO_TS');
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Utility_VisibleFilesIterator extends FilterIterator {
|
class RippingCluster_Utility_VisibleFilesIterator extends FilterIterator {
|
||||||
public function accept() {
|
public function accept() {
|
||||||
return !(substr($this->current()->getFilename(), 0, 1) == '.');
|
return !(substr($this->current()->getFilename(), 0, 1) == '.');
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Worker {
|
class RippingCluster_Worker {
|
||||||
|
|
||||||
protected $gearman;
|
protected $gearman;
|
||||||
|
|
||||||
@@ -14,17 +14,17 @@ class HandBrakeCluster_Worker {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = HandBrakeCluster_Main::instance()->config();
|
$config = RippingCluster_Main::instance()->config();
|
||||||
|
|
||||||
$this->gearman = new GearmanWorker();
|
$this->gearman = new GearmanWorker();
|
||||||
$this->gearman->addServers($config->get('rips.job_servers'));
|
$this->gearman->addServers($config->get('rips.job_servers'));
|
||||||
|
|
||||||
// Load all the plugin classes
|
// Load all the plugin classes
|
||||||
echo "Loading Plugins\n";
|
echo "Loading Plugins\n";
|
||||||
HandBrakeCluster_Worker_PluginFactory::scan();
|
RippingCluster_Worker_PluginFactory::scan();
|
||||||
foreach (HandBrakeCluster_Worker_PluginFactory::getValidPlugins() as $plugin) {
|
foreach (RippingCluster_Worker_PluginFactory::getValidPlugins() as $plugin) {
|
||||||
echo "Grabbing worker functions provided by {$plugin}\n";
|
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) {
|
foreach ($workerFunctions as $function => $callback) {
|
||||||
echo "Adding {$plugin}::{$callback[1]} as {$function}\n";
|
echo "Adding {$plugin}::{$callback[1]} as {$function}\n";
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
interface HandBrakeCluster_Worker_IPlugin {
|
interface RippingCluster_Worker_IPlugin {
|
||||||
|
|
||||||
public static function workerFunctions();
|
public static function workerFunctions();
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Worker_Plugin_HandBrake implements HandBrakeCluster_Worker_IPlugin {
|
class RippingCluster_Worker_Plugin_HandBrake implements RippingCluster_Worker_IPlugin {
|
||||||
|
|
||||||
const DEINTERLACE_ALWAYS = 1;
|
const DEINTERLACE_ALWAYS = 1;
|
||||||
const DEINTERLACE_SELECTIVELY = 2;
|
const DEINTERLACE_SELECTIVELY = 2;
|
||||||
@@ -39,7 +39,7 @@ class HandBrakeCluster_Worker_Plugin_HandBrake implements HandBrakeCluster_Worke
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function execute() {
|
public function execute() {
|
||||||
$config = HandBrakeCluster_Main::instance()->config();
|
$config = RippingCluster_Main::instance()->config();
|
||||||
|
|
||||||
$handbrake_cmd_raw = array(
|
$handbrake_cmd_raw = array(
|
||||||
'-n', $config->get('rips.nice'),
|
'-n', $config->get('rips.nice'),
|
||||||
@@ -65,7 +65,7 @@ class HandBrakeCluster_Worker_Plugin_HandBrake implements HandBrakeCluster_Worke
|
|||||||
}
|
}
|
||||||
$handbrake_cmd = join(' ', $handbrake_cmd);
|
$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];
|
$line = $lines[0];
|
||||||
$this->stdout = $lines[1];
|
$this->stdout = $lines[1];
|
||||||
|
|
||||||
$log = HandBrakeCluster_Main::instance()->log();
|
$log = RippingCluster_Main::instance()->log();
|
||||||
$log->info($line);
|
$log->info($line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ class HandBrakeCluster_Worker_Plugin_HandBrake implements HandBrakeCluster_Worke
|
|||||||
$numerator = 100 * $matches[1];
|
$numerator = 100 * $matches[1];
|
||||||
$this->job->sendStatus($numerator, 100);
|
$this->job->sendStatus($numerator, 100);
|
||||||
} else {
|
} else {
|
||||||
$log = HandBrakeCluster_Main::instance()->log();
|
$log = RippingCluster_Main::instance()->log();
|
||||||
$log->debug($line);
|
$log->debug($line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HandBrakeCluster_Worker_PluginFactory extends HandBrakeCluster_PluginFactory {
|
class RippingCluster_Worker_PluginFactory extends RippingCluster_PluginFactory {
|
||||||
|
|
||||||
const PLUGIN_DIR = 'HandBrakeCluster/Worker/Plugin/';
|
const PLUGIN_DIR = 'RippingCluster/Worker/Plugin/';
|
||||||
const PREFIX = 'HandBrakeCluster_Worker_Plugin_';
|
const PREFIX = 'RippingCluster_Worker_Plugin_';
|
||||||
|
|
||||||
public static function init() {
|
public static function init() {
|
||||||
|
|
||||||
13
lib/RippingCluster/WorkerLogEntry.class.php
Normal file
13
lib/RippingCluster/WorkerLogEntry.class.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class RippingCluster_WorkerLogEntry extends RippingCluster_LogEntry {
|
||||||
|
|
||||||
|
public static function initialise() {
|
||||||
|
parent::$table_name = 'worker_log';
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
RippingCluster_WorkerLogEntry::initialise();
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once '../config.php';
|
require_once '../config.php';
|
||||||
require_once HandBrakeCluster_Lib . 'HandBrakeCluster/Main.class.php';
|
require_once RippingCluster_Lib . 'RippingCluster/Main.class.php';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ define('HBC_File', 'index');
|
|||||||
require '_inc.php';
|
require '_inc.php';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$smarty = $main->smarty();
|
$smarty = $main->smarty();
|
||||||
|
|
||||||
$page = new HandBrakeCluster_Page($smarty, $main->request());
|
$page = new RippingCluster_Page($smarty, $main->request());
|
||||||
if ($page->evaluate()) {
|
if ($page->evaluate()) {
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (HandBrakeCluster_Exception $e) {
|
} catch (RippingCluster_Exception $e) {
|
||||||
die("Uncaught Exception: " . $e->getMessage());
|
die("Uncaught Exception: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$req = $main->request();
|
$req = $main->request();
|
||||||
|
|
||||||
$this->smarty->assign('requested_page', htmlspecialchars($req->request_string()));
|
$this->smarty->assign('requested_page', htmlspecialchars($req->request_string()));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$config = $main->config();
|
$config = $main->config();
|
||||||
|
|
||||||
$this->smarty->assign('display_exceptions', $config->get('debug.display_exceptions'));
|
$this->smarty->assign('display_exceptions', $config->get('debug.display_exceptions'));
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$running_jobs = HandBrakeCluster_Job::allWithStatus(HandBrakeCluster_JobStatus::RUNNING, 5);
|
$running_jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::RUNNING, 5);
|
||||||
$completed_jobs = HandBrakeCluster_Job::allWithStatus(HandBrakeCluster_JobStatus::COMPLETE, 5);
|
$completed_jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::COMPLETE, 5);
|
||||||
$failed_jobs = HandBrakeCluster_Job::allWithStatus(HandBrakeCluster_JobStatus::FAILED, 5);
|
$failed_jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::FAILED, 5);
|
||||||
|
|
||||||
$this->smarty->assign('running_jobs', $running_jobs);
|
$this->smarty->assign('running_jobs', $running_jobs);
|
||||||
$this->smarty->assign('completed_jobs', $completed_jobs);
|
$this->smarty->assign('completed_jobs', $completed_jobs);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$job_id = $this->request->get('id');
|
$job_id = $this->request->get('id');
|
||||||
$job = HandBrakeCluster_Job::fromId($job_id);
|
$job = RippingCluster_Job::fromId($job_id);
|
||||||
$this->smarty->assign('job', $job);
|
$this->smarty->assign('job', $job);
|
||||||
|
|
||||||
$client_log_entries = HandBrakeCluster_ClientLogEntry::recentForJob($job_id, 30);
|
$client_log_entries = RippingCluster_ClientLogEntry::recentForJob($job_id, 30);
|
||||||
$worker_log_entries = HandBrakeCluster_WorkerLogEntry::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('client_log_entries', $client_log_entries);
|
||||||
$this->smarty->assign('worker_log_entries', $worker_log_entries);
|
$this->smarty->assign('worker_log_entries', $worker_log_entries);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$req = $main->request();
|
$req = $main->request();
|
||||||
$config = $main->config();
|
$config = $main->config();
|
||||||
|
|
||||||
if ($req->get('submit')) {
|
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
|
# 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.
|
# 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();
|
$jobs = array();
|
||||||
foreach ($job_ids as $job_id) {
|
foreach ($job_ids as $job_id) {
|
||||||
$job = HandBrakeCluster_Job::fromId($job_id);
|
$job = RippingCluster_Job::fromId($job_id);
|
||||||
if (!$job) {
|
if (!$job) {
|
||||||
throw new HandBrakeCluster_Exception_InvalidParameters('job_id');
|
throw new RippingCluster_Exception_InvalidParameters('job_id');
|
||||||
}
|
}
|
||||||
$jobs[] = $job;
|
$jobs[] = $job;
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ if ($req->get('submit')) {
|
|||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'mark-failed': {
|
case 'mark-failed': {
|
||||||
foreach ($jobs as $job) {
|
foreach ($jobs as $job) {
|
||||||
$job->updateStatus(HandBrakeCluster_JobStatus::FAILED);
|
$job->updateStatus(RippingCluster_JobStatus::FAILED);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@@ -41,10 +41,10 @@ if ($req->get('submit')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Dispatch all the jobs in one run
|
# 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
|
# 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;
|
} break;
|
||||||
|
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
@@ -54,34 +54,34 @@ if ($req->get('submit')) {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
throw new HandBrakeCluster_Exception_InvalidParameters('action');
|
throw new RippingCluster_Exception_InvalidParameters('action');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HandBrakeCluster_Page::redirect('jobs');
|
RippingCluster_Page::redirect('jobs');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (isset($_POST['view'])) {
|
if (isset($_POST['view'])) {
|
||||||
$statusName = urlencode($_POST['view']);
|
$statusName = urlencode($_POST['view']);
|
||||||
HandBrakeCluster_Page::redirect("jobs/view/{$statusName}");
|
RippingCluster_Page::redirect("jobs/view/{$statusName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
$statusName = $req->get('view', 'any');
|
$statusName = $req->get('view', 'any');
|
||||||
switch ($statusName) {
|
switch ($statusName) {
|
||||||
case 'any': $status = null; break;
|
case 'any': $status = null; break;
|
||||||
case 'queued': $status = HandBrakeCluster_JobStatus::QUEUED; break;
|
case 'queued': $status = RippingCluster_JobStatus::QUEUED; break;
|
||||||
case 'running': $status = HandBrakeCluster_JobStatus::RUNNING; break;
|
case 'running': $status = RippingCluster_JobStatus::RUNNING; break;
|
||||||
case 'complete': $status = HandBrakeCluster_JobStatus::COMPLETE; break;
|
case 'complete': $status = RippingCluster_JobStatus::COMPLETE; break;
|
||||||
case 'failed': $status = HandBrakeCluster_JobStatus::FAILED; break;
|
case 'failed': $status = RippingCluster_JobStatus::FAILED; break;
|
||||||
default: throw new HandBrakeCluster_Exception_InvalidParameters('view');
|
default: throw new RippingCluster_Exception_InvalidParameters('view');
|
||||||
}
|
}
|
||||||
|
|
||||||
$jobs = array();
|
$jobs = array();
|
||||||
if ($status) {
|
if ($status) {
|
||||||
$jobs = HandBrakeCluster_Job::allWithStatus($status);
|
$jobs = RippingCluster_Job::allWithStatus($status);
|
||||||
} else {
|
} else {
|
||||||
$jobs = HandBrakeCluster_Job::all();
|
$jobs = RippingCluster_Job::all();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->smarty->assign('jobs', $jobs);
|
$this->smarty->assign('jobs', $jobs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$client_log_entries = HandBrakeCluster_ClientLogEntry::recent(30);
|
$client_log_entries = RippingCluster_ClientLogEntry::recent(30);
|
||||||
$worker_log_entries = HandBrakeCluster_WorkerLogEntry::recent(30);
|
$worker_log_entries = RippingCluster_WorkerLogEntry::recent(30);
|
||||||
|
|
||||||
$this->smarty->assign('client_log_entries', $client_log_entries);
|
$this->smarty->assign('client_log_entries', $client_log_entries);
|
||||||
$this->smarty->assign('worker_log_entries', $worker_log_entries);
|
$this->smarty->assign('worker_log_entries', $worker_log_entries);
|
||||||
|
|||||||
@@ -1,30 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$req = $main->request();
|
$req = $main->request();
|
||||||
$config = $main->config();
|
$config = $main->config();
|
||||||
|
|
||||||
// Grab the name of this source
|
// Grab the name of this source
|
||||||
$encoded_filename = null;
|
$encoded_filename = null;
|
||||||
if ($req->get('submit')) {
|
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
|
// 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
|
// 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')) {
|
} elseif ($req->get('queued')) {
|
||||||
$this->smarty->assign('rips_submitted', true);
|
$this->smarty->assign('rips_submitted', true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->smarty->assign('rips_submitted', false);
|
$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('source', $source);
|
||||||
$this->smarty->assign('titles', $source->titles());
|
$this->smarty->assign('titles', $source->titles());
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$req = $main->request();
|
$req = $main->request();
|
||||||
$config = $main->config();
|
$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('source', $source);
|
||||||
$this->smarty->assign('titles', $source->titles());
|
$this->smarty->assign('titles', $source->titles());
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$config = $main->config();
|
$config = $main->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 = $lister->sources();
|
||||||
|
|
||||||
$sources_cached = array();
|
$sources_cached = array();
|
||||||
foreach ($sources as $source) {
|
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);
|
$this->smarty->assign('sources', $sources);
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
define('HBC_File', 'run-jobs');
|
define('HBC_File', 'run-jobs');
|
||||||
|
|
||||||
require_once '../config.php';
|
require_once '../config.php';
|
||||||
require_once HandBrakeCluster_Lib . 'HandBrakeCluster/Main.class.php';
|
require_once RippingCluster_Lib . 'RippingCluster/Main.class.php';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$config = $main->config();
|
$config = $main->config();
|
||||||
$log = $main->log();
|
$log = $main->log();
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ try {
|
|||||||
$gearman->setFailCallback("gearman_fail_callback");
|
$gearman->setFailCallback("gearman_fail_callback");
|
||||||
|
|
||||||
// Retrieve a list of Created jobs
|
// Retrieve a list of Created jobs
|
||||||
$jobs = HandBrakeCluster_Job::allWithStatus(HandBrakeCluster_JobStatus::CREATED);
|
$jobs = RippingCluster_Job::allWithStatus(RippingCluster_JobStatus::CREATED);
|
||||||
|
|
||||||
foreach ($jobs as $job) {
|
foreach ($jobs as $job) {
|
||||||
// Enqueue the job using gearman
|
// Enqueue the job using gearman
|
||||||
@@ -35,33 +35,33 @@ try {
|
|||||||
|
|
||||||
$log->info("Job queue completed");
|
$log->info("Job queue completed");
|
||||||
|
|
||||||
} catch (HandBrakeCluster_Exception $e) {
|
} catch (RippingCluster_Exception $e) {
|
||||||
die("Uncaught Exception (" . get_class($e) . "): " . $e->getMessage() . "\n");
|
die("Uncaught Exception (" . get_class($e) . "): " . $e->getMessage() . "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function gearman_created_callback($gearman_task) {
|
function gearman_created_callback($gearman_task) {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$log = $main->log();
|
$log = $main->log();
|
||||||
|
|
||||||
$job = HandBrakeCluster_Job::fromId($gearman_task->unique());
|
$job = RippingCluster_Job::fromId($gearman_task->unique());
|
||||||
$job->updateStatus(HandBrakeCluster_JobStatus::RUNNING);
|
$job->updateStatus(RippingCluster_JobStatus::RUNNING);
|
||||||
|
|
||||||
$log->info("Job successfully queued with Gearman", $gearman_task->unique());
|
$log->info("Job successfully queued with Gearman", $gearman_task->unique());
|
||||||
}
|
}
|
||||||
|
|
||||||
function gearman_data_callback($gearman_task) {
|
function gearman_data_callback($gearman_task) {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$log = $main->log();
|
$log = $main->log();
|
||||||
|
|
||||||
$log->debug("Got some data from gearman", $gearman_task->unique());
|
$log->debug("Got some data from gearman", $gearman_task->unique());
|
||||||
}
|
}
|
||||||
|
|
||||||
function gearman_status_callback($gearman_task) {
|
function gearman_status_callback($gearman_task) {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$log = $main->log();
|
$log = $main->log();
|
||||||
|
|
||||||
$job = HandBrakeCluster_Job::fromId($gearman_task->unique());
|
$job = RippingCluster_Job::fromId($gearman_task->unique());
|
||||||
$status = $job->currentStatus();
|
$status = $job->currentStatus();
|
||||||
|
|
||||||
$rip_progress = $gearman_task->taskNumerator() / $gearman_task->taskDenominator();
|
$rip_progress = $gearman_task->taskNumerator() / $gearman_task->taskDenominator();
|
||||||
@@ -71,21 +71,21 @@ function gearman_status_callback($gearman_task) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gearman_complete_callback($gearman_task) {
|
function gearman_complete_callback($gearman_task) {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$log = $main->log();
|
$log = $main->log();
|
||||||
|
|
||||||
$job = HandBrakeCluster_Job::fromId($gearman_task->unique());
|
$job = RippingCluster_Job::fromId($gearman_task->unique());
|
||||||
$job->updateStatus(HandBrakeCluster_JobStatus::COMPLETE);
|
$job->updateStatus(RippingCluster_JobStatus::COMPLETE);
|
||||||
|
|
||||||
$log->info("Job Complete", $job->id());
|
$log->info("Job Complete", $job->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
function gearman_fail_callback($gearman_task) {
|
function gearman_fail_callback($gearman_task) {
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$log = $main->log();
|
$log = $main->log();
|
||||||
|
|
||||||
$job = HandBrakeCluster_Job::fromId($gearman_task->unique());
|
$job = RippingCluster_Job::fromId($gearman_task->unique());
|
||||||
$job->updateStatus(HandBrakeCluster_JobStatus::FAILED);
|
$job->updateStatus(RippingCluster_JobStatus::FAILED);
|
||||||
|
|
||||||
$log->info("Job Failed", $job->id());
|
$log->info("Job Failed", $job->id());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>HandBrake Cluster WebUI</title>
|
<title>Ripping Cluster WebUI</title>
|
||||||
<script lang="javascript">
|
<script lang="javascript">
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" type="text/css" href="{$base_uri}styles/normal.css" />
|
<link rel="stylesheet" type="text/css" href="{$base_uri}styles/normal.css" />
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<div id="container">
|
<div id="container">
|
||||||
|
|
||||||
<div id="banner">
|
<div id="banner">
|
||||||
<h1>HandBrake Cluster WebUI</h1>
|
<h1>Ripping Cluster WebUI</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="navigation">
|
<div id="navigation">
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
Powered by HandBrakeCluster WebUI {$version}. Written by Ben Roberts.
|
Powered by RippingCluster WebUI {$version}. Written by Ben Roberts.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,19 +3,19 @@
|
|||||||
define('HBC_File', 'worker');
|
define('HBC_File', 'worker');
|
||||||
|
|
||||||
require_once '../config.php';
|
require_once '../config.php';
|
||||||
require_once HandBrakeCluster_Lib . 'HandBrakeCluster/Main.class.php';
|
require_once RippingCluster_Lib . 'RippingCluster/Main.class.php';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
$main = HandBrakeCluster_Main::instance();
|
$main = RippingCluster_Main::instance();
|
||||||
$smarty = $main->smarty();
|
$smarty = $main->smarty();
|
||||||
|
|
||||||
$worker = new HandBrakeCluster_Worker();
|
$worker = new RippingCluster_Worker();
|
||||||
$worker->start();
|
$worker->start();
|
||||||
|
|
||||||
} catch (HandBrakeCluster_Exception $e) {
|
} catch (RippingCluster_Exception $e) {
|
||||||
die("Uncaught Exception: " . $e->getMessage());
|
die("Uncaught Exception: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user