Added setup-rip page to configure new rip task

Added method to Source to identify the longest title in a source
This commit is contained in:
2010-03-23 02:06:37 +00:00
parent ecea94cd5e
commit 7632741d86
4 changed files with 143 additions and 0 deletions

View File

@@ -153,6 +153,27 @@ class HandBrakeCluster_Rips_Source {
public function addTitle(HandBrakeCluster_Rips_SourceTitle $title) {
$this->titles[] = $title;
}
public function longestTitle() {
$longest_title = null;
$maximum_duration = 0;
if ( ! $this->titles) {
return null;
}
foreach ($this->titles as $title) {
$duration = $title->durationInSeconds();
if ($duration > $maximum_duration) {
$longest_title = $title;
$maximum_duration = $duration;
}
}
return $longest_title;
}
public function output() {
return $this->output;

View File

@@ -41,6 +41,11 @@ class HandBrakeCluster_Rips_SourceTitle {
return $this->duration;
}
public function durationInSeconds() {
$time = explode(":", $this->duration);
return ($time[0] * 3600) + ($time[1] * 60) + $time[2];
}
public function setDuration($duration) {
$this->duration = $duration;
}