Example #1
0
        ?>
<h2><?php 
        echo $taxonomy->name;
        ?>
</h2>
<?php 
        echo $tax_node->body['und'][0]['safe_value'];
        $assoc_nodes = taxonomy_select_nodes($taxonomy->tid);
        if (count($assoc_nodes) > 0) {
            $pageData = array();
            foreach ($assoc_nodes as $this_assoc_node) {
                $assoc_node = node_load($this_assoc_node);
                $thisPage = array('nid' => $this_assoc_node, 'created' => $assoc_node->created, 'title' => $assoc_node->title, 'html' => $assoc_node->body['und'][0]['safe_value'], 'weight' => $assoc_node->nodeorder[$taxonomy->tid]['weight']);
                $thisPage['html'] = parseWistia($thisPage['html'], findWistia($thisPage['html']), $assoc_node);
                $thisPage['html'] = parseSurvey($thisPage['html'], findSurvey($thisPage['html']), $assoc_node);
                $thisPage['html'] = parseVideo($thisPage['html'], findVideo($thisPage['html']), $assoc_node);
                array_push($pageData, $thisPage);
            }
            usort($pageData, 'sortAssociatedNodes');
            foreach ($pageData as $thisPage) {
                ?>
<h3><?php 
                echo $thisPage['title'];
                ?>
</h3>
<?php 
                echo $thisPage['html'];
            }
        }
    }
}
 * 
 * @param $execPath path to the exe (file system, not server paths)
 * @param $folder path to the folder containing the images
 * @param trainingFilesFolder path to the folder containing the training files
 * @param $jsonOutputPath path for the output file
 * @param $mediaID id of the media item that is being processed
 */
function parseVideo($execPath, $folder, $trainingFilesFolder, $jsonOutputPath, $mediaID)
{
    $conn = getDBConnection();
    $conn->query("UPDATE queue SET status=\"" . STATUS_BEING_PROCESSED . "\" WHERE media_id={$mediaID}");
    // both $vars just used for exec
    $out;
    $return_var;
    $recognitionConfig = get("recognition_config");
    if ($recognitionConfig == null || $recognitionConfig == "quality") {
        exec("{$execPath} {$folder} {$jsonOutputPath} {$trainingFilesFolder} 30 0.00005 0.02 2.0 0.9 0.85 2>&1", $out, $return_var);
    } else {
        exec("{$execPath} {$folder} {$jsonOutputPath} {$trainingFilesFolder} 45 0.00002 0.02 1.0 0.9 0.9 2>&1", $out, $return_var);
    }
    // var_dump($out);
    // if this line is uncommented, somehow the next parts may not get executed. no real reason why they wouldn't be, but that's how it is.
    if (file_exists($jsonOutputPath)) {
        $conn->query("UPDATE queue SET status=\"" . STATUS_FINISHED_PROCESSING . "\" WHERE media_id={$mediaID}");
    } else {
        $conn->query("UPDATE queue SET status=\"" . STATUS_PROCESSING_ERROR . "\" WHERE media_id={$mediaID}");
    }
    $conn->close();
}
parseVideo($execPath, $folder, $trainingFilesFolder, $jsonOutputPath, $mediaID);