Beispiel #1
0
 public function getTime()
 {
     return Utilities::convertToHMS($this->getTimestamp());
 }
Beispiel #2
0
 public function getSearchResults($query)
 {
     $search_results = array();
     if (!empty($query)) {
         $search_query = $this->_connection->prepare("SELECT `Episode`, `Timestamp`, `Value` FROM `timestamps` WHERE REPLACE(`Value`, :Replace, '') LIKE :Value");
         $search_query->bindValue(":Replace", "'");
         $search_query->bindValue(":Value", "%" . str_replace("'", "", trim($query) . "%"));
         $search_query->execute();
         foreach ($search_query->fetchAll() as $result) {
             $timestamp_data = array();
             $timestamp_data["Timestamp"] = $result["Timestamp"];
             $timestamp_data["Value"] = $result["Value"];
             $timestamp_data["HMS"] = Utilities::convertToHMS($result["Timestamp"]);
             $search_results[$result["Episode"]][] = $timestamp_data;
         }
     } else {
         $search_query = $this->_connection->prepare("SELECT * FROM `episodes`");
         $search_query->execute();
         foreach ($search_query->fetchAll() as $result) {
             $search_results[] = $result["Identifier"];
         }
     }
     return $search_results;
 }
Beispiel #3
0
 public function getRecentYouTubeVideos()
 {
     if ($this->getYouTube() != "") {
         $youtube_results = @file_get_contents("https://gdata.youtube.com/feeds/users/" . $this->getYouTube() . "/uploads?alt=json&max-results=6");
         if ($youtube_results === false) {
             return array();
         } else {
             $youtube_json = json_decode($youtube_results, true);
             if (isset($youtube_json["feed"]["entry"])) {
                 $youtube_videos = array();
                 foreach ($youtube_json["feed"]["entry"] as $video_result) {
                     $youtube_video = array();
                     $youtube_video["Title"] = $video_result["title"]["\$t"];
                     $youtube_video["Link"] = $video_result["link"][0]["href"];
                     if (isset($video_result["gd\$comments"])) {
                         $youtube_video["Comments"] = $video_result["gd\$comments"]["gd\$feedLink"]["countHint"];
                     } else {
                         $youtube_video["Comments"] = "0";
                     }
                     $youtube_video["Thumbnail"] = $video_result["media\$group"]["media\$thumbnail"][0]["url"];
                     $youtube_video["Duration"] = Utilities::convertToHMS($video_result["media\$group"]["yt\$duration"]["seconds"]);
                     $youtube_videos[] = $youtube_video;
                 }
                 return $youtube_videos;
             } else {
                 return array();
             }
         }
     } else {
         return array();
     }
 }