<commit_before><?php
/**
 * @package plugins.cuePoints
 * @subpackage Scheduler
 */
class KLiveClippingCopyCuePointEngine extends KLiveToVodCopyCuePointEngine
{
    //override set status to HANDLED as LiveToVod engine
    protected static function postProcessCuePoints($copiedCuePointIds) {}

    protected function shouldCopyCuePoint($cuePoint)
    {
        $cuePointStartTime = $this->getOffsetForTimestamp($cuePoint->createdAt * 1000, false);
        $cuePointEndTime = $this->getOffsetForTimestamp($cuePoint->calculatedEndTime * 1000, false);
        KalturaLog::debug("Checking times to know if copy is needed for id[". $cuePoint->id ."]: start- [$cuePointStartTime], end- [$cuePointEndTime], calculatedEndTime - " . $cuePoint->calculatedEndTime);
        if ($cuePointStartTime < 0 && is_null($cuePoint->calculatedEndTime))
        {
            return $this->shouldCopyCuePointBeforeTimeWindow($cuePoint); //if cue point started before the clip but end afterward (no next cue point)
        }
        return ($cuePointStartTime >= 0 || $cuePointEndTime > 0);
    }

    public function getCuePointFilter($entryId, $status = CuePointStatus::READY)
    {
        $statuses = array(CuePointStatus::READY, CuePointStatus::HANDLED);
        $filter = parent::getCuePointFilter($entryId, implode(",",$statuses));
        return $filter;
    }
    
    /**
     * @param KalturaCuePoint $cuePoint
     * @return boolean
     */
    private function shouldCopyCuePointBeforeTimeWindow($cuePoint)
    {
        $noCopiedTag = array("poll-data","select-poll-state","poll-results");
        return (count(array_intersect(explode(",", $cuePoint->tags), $noCopiedTag)) == 0);
    }
}
<commit_msg>Add check for code cue point<commit_after><?php
/**
 * @package plugins.cuePoints
 * @subpackage Scheduler
 */
class KLiveClippingCopyCuePointEngine extends KLiveToVodCopyCuePointEngine
{
    //override set status to HANDLED as LiveToVod engine
    protected static function postProcessCuePoints($copiedCuePointIds) {}

    protected function shouldCopyCuePoint($cuePoint)
    {
        $cuePointStartTime = $this->getOffsetForTimestamp($cuePoint->createdAt * 1000, false);
        $cuePointEndTime = $this->getOffsetForTimestamp($cuePoint->calculatedEndTime * 1000, false);
        KalturaLog::debug("Checking times to know if copy is needed for id[". $cuePoint->id ."]: start- [$cuePointStartTime], end- [$cuePointEndTime], calculatedEndTime - " . $cuePoint->calculatedEndTime);
        if ($cuePointStartTime < 0 && is_null($cuePoint->calculatedEndTime))
        {
            return $this->shouldCopyCuePointBeforeTimeWindow($cuePoint); //if cue point started before the clip but end afterward (no next cue point)
        }
        return ($cuePointStartTime >= 0 || $cuePointEndTime > 0);
    }

    public function getCuePointFilter($entryId, $status = CuePointStatus::READY)
    {
        $statuses = array(CuePointStatus::READY, CuePointStatus::HANDLED);
        $filter = parent::getCuePointFilter($entryId, implode(",",$statuses));
        return $filter;
    }
    
    /**
     * @param KalturaCuePoint $cuePoint
     * @return boolean
     */
    private function shouldCopyCuePointBeforeTimeWindow($cuePoint)
    {
        if ($cuePoint instanceof KalturaCodeCuePoint)
        {
            $noCopiedTag = array("poll-data","select-poll-state","poll-results");
            return (count(array_intersect(explode(",", $cuePoint->tags), $noCopiedTag)) == 0);
        }
        return true;
    }
}

{'fraction_non_alphanumeric': 0.11948632049134561, 'fraction_numerical': 0.006700167504187605, 'mean_word_length': 3.3064903846153846, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '986958', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1030, 'n_words': 215}