Fixes to VideoConvertJob and undefined constant in SearchView, a=chris
Fixes to VideoConvertJob and undefined constant in SearchView, a=chris
diff --git a/src/library/media_jobs/MediaJob.php b/src/library/media_jobs/MediaJob.php
index b9570cfc1..cc8e9736f 100644
--- a/src/library/media_jobs/MediaJob.php
+++ b/src/library/media_jobs/MediaJob.php
@@ -99,7 +99,7 @@ class MediaJob implements CrawlConstants, MediaConstants
$this->prepareTasks();
L\crawlLog("--Finishing job $job_name tasks on Name Server");
$this->finishTasks();
- }
+ }
if (!$is_name_server || ($is_name_server &&
$this->name_server_does_slave_tasks)) {
L\crawlLog("--Checking for $job_name tasks to do");
@@ -118,7 +118,14 @@ class MediaJob implements CrawlConstants, MediaConstants
$response =
$this->execNameServer("putTasks",
$results);
- L\crawlLog("--Name server response was:" . $response);
+ if (isset($response[0][CrawlConstants::PAGE])) {
+ $response = unserialize(L\webdecode(
+ $response[0][CrawlConstants::PAGE]));
+ if (is_array($response)) {
+ $response = print_r($response, true);
+ }
+ }
+ L\crawlLog("--Name server response was:\n" . $response);
}
} else {
L\crawlLog("--No tasks found for job $job_name");
diff --git a/src/library/media_jobs/VideoConvertJob.php b/src/library/media_jobs/VideoConvertJob.php
index 106bbb8e7..16a13b206 100644
--- a/src/library/media_jobs/VideoConvertJob.php
+++ b/src/library/media_jobs/VideoConvertJob.php
@@ -32,6 +32,7 @@ namespace seekquarry\yioop\library\media_jobs;
use seekquarry\yioop\configs as C;
use seekquarry\yioop\library as L;
+use seekquarry\yioop\library\UrlParser;
/**
*
@@ -178,14 +179,18 @@ class VideoConvertJob extends MediaJob
public function splitVideos()
{
$convert_folder = C\WORK_DIRECTORY . self::CONVERT_FOLDER;
- if(!defined('FFMPEG') || !file_exists($convert_folder)) { return; }
+ if (!C\nsdefined('FFMPEG') || !file_exists($convert_folder)) {
+ return;
+ }
L\crawlLog("----Looking for video files to split...");
$type_string = "{" . implode(",", $this->video_convert_types) . "}";
$video_paths = glob($convert_folder."/*");
foreach ($video_paths as $video_path) {
if (is_dir($video_path)){
- if (!file_exists($video_path.self::SPLIT_FILE)) {return; }
- if (file_exists($video_path.self::SPLIT_FILE)) {
+ if (!file_exists($video_path . self::SPLIT_FILE)) {
+ return;
+ }
+ if (file_exists($video_path . self::SPLIT_FILE)) {
L\crawlLog("----Splitting the video $video_path");
$lines = file($video_path.self::FILE_INFO);
$folder_name = rtrim($lines[1]);
@@ -220,7 +225,7 @@ class VideoConvertJob extends MediaJob
$video_paths = glob($convert_folder . "/*");
foreach ($video_paths as $video_path) {
L\crawlLog("----Video Path : $video_path");
- $actual_count = file_get_contents($video_path.self::COUNT_FILE);
+ $actual_count = file_get_contents($video_path . self::COUNT_FILE);
L\crawlLog("----Actual_count : $actual_count");
$timestamp_files = glob($video_path."/*.time.txt");
$checked_out = count($timestamp_files);
@@ -420,7 +425,7 @@ class VideoConvertJob extends MediaJob
* previously or not. If it was then its timestamp is checked.
* Otherwise new file is sent for conversion along with its folder name.
*/
- public function getTask($machine_id, $data = null)
+ public function getTasks($machine_id, $data = null)
{
$convert_folder = C\WORK_DIRECTORY . self::CONVERT_FOLDER;
$current_time = time();
diff --git a/src/views/SearchView.php b/src/views/SearchView.php
index 617c53338..6bcb785d1 100755
--- a/src/views/SearchView.php
+++ b/src/views/SearchView.php
@@ -415,7 +415,8 @@ class SearchView extends View implements CrawlConstants
<?php
}
if (C\MOBILE && $aux_link_flag) {e("<br />");}
- if (C\RESULT_SCORE && isset($page[self::SCORE])) {
+ if ((!C\nsdefined(C\RESULT_SCORE) || C\RESULT_SCORE)
+ && isset($page[self::SCORE])) {
?><span title="<?php
e(tl('search_view_rank',
number_format($page[self::DOC_RANK], 2))."\n");