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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user