private function execute3rdPartyVideo() { if (empty($this->mParams['videoId'])) { $this->dieUsageMsg('The videoId parameter must be set'); } $duplicate = $this->getVideoDuplicate($this->mParams['provider'], $this->mParams['videoId']); if ($duplicate) { return array('title' => $duplicate->getTitle()->getText()); } else { $uploader = new VideoFileUploader(); $title = $uploader->getUniqueTitle(wfStripIllegalFilenameChars($this->mParams['title'])); $uploader->setProvider($this->mParams['provider']); $uploader->setVideoId($this->mParams['videoId']); $uploader->setTargetTitle($title->getBaseText()); $uploader->upload($title); return array('title' => $title->getText()); } }
private function execute3rdPartyVideo() { if (empty($this->mParams['videoId'])) { $this->dieUsageMsg('The videoId parameter must be set'); } $duplicate = $this->getVideoDuplicate($this->mParams['provider'], $this->mParams['videoId']); if ($duplicate) { return array('title' => $duplicate->getTitle()->getText()); } else { $uploader = new VideoFileUploader(); $title = $uploader->getUniqueTitle(wfStripIllegalFilenameChars($this->mParams['title'])); // https://wikia-inc.atlassian.net/browse/VE-1819 if (!$title) { WikiaLogger::instance()->debug('ApiAddMediaPermanent', array('title' => $this->mParams['title'])); } $uploader->setProvider($this->mParams['provider']); $uploader->setVideoId($this->mParams['videoId']); $uploader->setTargetTitle($title->getBaseText()); $uploader->upload($title); return array('title' => $title->getText()); } }
$apiWrapperName = ucfirst( $videoRow->img_minor_mime ) . 'ApiWrapper'; $videoId = $metadata['videoId']; $result = null; $status = "fail"; echo "reuploading: [from:".$provider." videoId:$videoId] - ".$videoRow->img_name."\n"; echo "title: " . $title . "\n"; try { $oUploader = new VideoFileUploader(); $oUploader->setProvider( $provider ); $oUploader->setVideoId( $videoId ); $oUploader->setDescription( null ); $oUploader->setTargetTitle( $title ); $oUploader->hideAction(); $oUploader->upload( $title ); } catch( Exception $e ) { echo ("ERROR FETCHING DATA: [{$videoRow->img_minor_mime}]". $videoRow->img_name . "\n"); echo $e->getMessage() ."\n"; } echo("========================================== \n"); } echo "Done\n"; } $dbw->freeResult($rows); echo(": {$rowCount} videos processed.\n");
/** * Upload video using LocalFile framework * @param mixed $provider string or int from $wgVideoMigrationProviderMap * @param string $videoId * @param string $videoName * @return mixed FileRepoStatus or FALSE on error */ private function uploadVideoAsFile($provider, $videoId, $videoName, &$oTitle) { $oUploader = new VideoFileUploader(); $oUploader->setProvider($provider); $oUploader->setVideoId($videoId); $oUploader->setTargetTitle($videoName); return $oUploader->upload($oTitle); }