Exemple #1
0
 /**
  * Retrieves user-submitted videos from YouTube and returns the
  * result as a JSON array.
  */
 public function getObservationDateVideos()
 {
     include_once HV_ROOT_DIR . '/../src/Database/MovieDatabase.php';
     include_once HV_ROOT_DIR . '/../src/Movie/HelioviewerMovie.php';
     include_once HV_ROOT_DIR . '/../lib/alphaID/alphaID.php';
     include_once HV_ROOT_DIR . '/../src/Helper/HelioviewerLayers.php';
     $movies = new Database_MovieDatabase();
     // Default options
     $defaults = array('num' => 10, 'skip' => 0, 'date' => getUTCDateString());
     $opts = array_replace($defaults, $this->_options);
     // Get a list of recent videos
     $videos = array();
     foreach ($movies->getSharedVideosByTime($opts['num'], $opts['skip'], $opts['date']) as $video) {
         $youtubeId = $video['youtubeId'];
         $movieId = (int) $video['movieId'];
         // Convert id
         $publicId = alphaID($movieId, false, 5, HV_MOVIE_ID_PASS);
         // Load movie
         $movie = new Movie_HelioviewerMovie($publicId);
         $layers = new Helper_HelioviewerLayers($video['dataSourceString']);
         $layersArray = $layers->toArray();
         $name = '';
         if (count($layersArray) > 0) {
             foreach ($layersArray as $layer) {
                 $name .= $layer['name'] . ', ';
             }
         }
         $name = substr($name, 0, -2);
         array_push($videos, array('id' => $publicId, 'url' => 'http://www.youtube.com/watch?v=' . $youtubeId, 'thumbnails' => array('small' => $video['thumbnail'], 'medium' => $video['thumbnail']), 'published' => $video['timestamp'], 'title' => $name . ' (' . $video['startDate'] . ' - ' . $video['endDate'] . ' UTC)', 'description' => $video['description'], 'keywords' => $video['keywords'], 'imageScale' => $video['imageScale'], 'dataSourceString' => $video['dataSourceString'], 'eventSourceString' => $video['eventSourceString'], 'movieLength' => $video['movieLength'], 'width' => $video['width'], 'height' => $video['height'], 'startDate' => $video['startDate'], 'endDate' => $video['endDate']));
     }
     $this->_printJSON(json_encode($videos));
 }
Exemple #2
0
 private function _getProvenanceComment()
 {
     require_once HV_ROOT_DIR . '/../src/Helper/DateTimeConversions.php';
     $now = str_replace(array('T', '.000Z'), array(' ', ' UTC'), getUTCDateString());
     $comment = "; Automatically generated by Helioviewer.org on {$now}.\n" . "; This script may use the Virtual Solar Observatory (VSO)," . " the SDO cutout\n" . "; service, and/or the Heliophysics Event Knowledgebase " . "(HEK; www.lmsal.com/hek)\n" . "; service ";
     // Movie id?
     if (array_key_exists('movieId', $this->_params) && !is_null($this->_params['movieId'])) {
         $comment .= "to download the original science data used to " . "generate\n" . "; the Helioviewer.org movie http://helioviewer." . "org/?movieId=" . $this->_params['movieId'] . "\n;";
     } else {
         $comment .= "to download original science data.\n;";
     }
     return $comment;
 }