コード例 #1
0
 /**
  * @param ReplayInterface $replay
  */
 public function updateMetas(ReplayInterface $replay)
 {
     // Download end game metas
     $endMetas = $this->client->getMetas($replay->getRegion(), $replay->getGameId());
     $endMetas = json_decode($endMetas, true);
     // Update metas
     $metas = $replay->getMetas();
     $metas['lastChunkId'] = $replay->getLastChunkId();
     $metas['endGameChunkId'] = $replay->getLastChunkId();
     $metas['lastKeyFrameId'] = $replay->getLastKeyframeId();
     $metas['endGameKeyFrameId'] = $replay->getLastKeyframeId();
     $metas['firstChunkId'] = $this->findFirstChunkId($metas);
     $metas['gameEnded'] = true;
     $metas['gameLength'] = $endMetas['gameLength'];
     // Update replay object
     $replay->setDuration(round($endMetas['gameLength'] / 1000));
     $replay->setMetas($metas);
     // Save metas
     $this->saveMetas($replay);
 }
コード例 #2
0
 /**
  * Executed on success. Throws exception to stop the process, then failure handler will be thrown.
  *
  * @param ReplayInterface $replay
  * @param string          $replayFolderPath
  */
 public function onSuccess(OutputInterface $output, ReplayInterface $replay, $replayFolderPath)
 {
     $payload = ['foreignId' => (string) $replay->getGameId(), 'platformId' => (string) $replay->getRegion()];
     $this->statsdClient->increment("replay.onSuccess");
     $this->redisClient->publish("/interestmanager/extract", json_encode($payload));
 }