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());
     }
 }
Beispiel #3
0
		$provider = $videoRow->img_minor_mime;
		$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);
 /**
  * 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);
 }
 /**
  * Reset the video thumbnail to its original image as defined by the video provider.
  * @param File $file The video file to reset
  * @param string|null $thumbnailUrl
  * @param int $delayIndex Corresponds to a delay for a job to be queued up if we aren't
  * able to reset the thumbnail. This index corresponds to a class constant kept in the
  * ApiWrapper classes.
  * @return FileRepoStatus The status of the publish operation
  */
 public function resetVideoThumb(File $file, $thumbnailUrl = null, $delayIndex = 0)
 {
     $mime = $file->getMimeType();
     list(, $provider) = explode('/', $mime);
     $videoId = $file->getVideoId();
     $title = $file->getTitle();
     $oUploader = new VideoFileUploader();
     $oUploader->setProvider($provider);
     $oUploader->setVideoId($videoId);
     $oUploader->setTargetTitle($title->getDBkey());
     if (empty($thumbnailUrl)) {
         $thumbnailUrl = $oUploader->getApiWrapper()->getThumbnailUrl();
     }
     $result = $oUploader->resetThumbnail($file, $thumbnailUrl, $delayIndex);
     if ($result->isGood()) {
         // update data and clear cache
         $status = $this->updateThumbnailData($file);
         if (!$status->isGood()) {
             $result->fatal($status->getMessage());
         }
     }
     return $result;
 }