video_get_info_by_blogpostid

This is a mock of the internal VideoPress method, which is meant to duplicate the functionality of the WPCOM API, so that the Jetpack REST API returns the same data with no modifications.

Description

(bool|stdClass) video_get_info_by_blogpostid( (int) $blog_id, (int) $post_id ); 

Returns (bool|stdClass)

Parameters (2)

0. $blog_id (int)
The blog id.
1. $post_id (int)
The post id.

Usage

  1. if ( !function_exists( 'video_get_info_by_blogpostid' ) ) { 
  2. require_once '/modules/videopress/utility-functions.php'; 
  3.  
  4. // The blog id. 
  5. $blog_id = -1; 
  6.  
  7. // The post id. 
  8. $post_id = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = video_get_info_by_blogpostid($blog_id, $post_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/videopress/utility-functions.php  
  1. function video_get_info_by_blogpostid( $blog_id, $post_id ) { 
  2. $post = get_post( $post_id ); 
  3.  
  4. $video_info = new stdClass(); 
  5. $video_info->post_id = $post_id; 
  6. $video_info->blog_id = $blog_id; 
  7. $video_info->guid = null; 
  8. $video_info->finish_date_gmt = '0000-00-00 00:00:00'; 
  9.  
  10. if ( is_wp_error( $post ) ) { 
  11. return $video_info; 
  12.  
  13. if ( 'video/videopress' !== $post->post_mime_type ) { 
  14. return $video_info; 
  15.  
  16. // Since this is a VideoPress post, lt's fill out the rest of the object. 
  17. $video_info->guid = get_post_meta( $post_id, 'videopress_guid', true ); 
  18.  
  19. if ( videopress_is_finished_processing( $post_id ) ) { 
  20. $video_info->finish_date_gmt = date( 'Y-m-d H:i:s' ); 
  21.  
  22. return $video_info;