1. webvariants
  2. Untitled project
  3. zend-framework-youtube

Commits

Christoph  committed 654b7f3

added getters for the video properties

  • Participants
  • Parent commits 42268e1
  • Branches default

Comments (0)

Files changed (1)

File lib/Video.php

View file
  • Ignore whitespace
 		return WV3_Gdata::getService('YouTube')->getVideoEntry($this->id);
 	}
 
-	public function getData() {
+	public function getData($key = null) {
 		if ($this->data === false) {
 			$cache = sly_Core::cache();
 			$data  = WV3_Gdata_YouTube_Cache::get('videodata', $this->id);
 				$entry = $this->getEntry();
 				$data  = array(
 					'title'            => $entry->getVideoTitle(),
-					'updated'          => (string) $entry->getUpdated(),
+					'updated'          => strtotime((string) $entry->getUpdated()),
 					'description'      => $entry->getVideoDescription(),
 					'category'         => $entry->getVideoCategory(),
 					'tags'             => $entry->getVideoTags(),
 					'watch_page'       => $entry->getVideoWatchPageUrl(),
 					'flash_player_url' => $entry->getFlashPlayerUrl(),
-					'duration'         => $entry->getVideoDuration(),
+					'duration'         => (int) $entry->getVideoDuration(),
 					'view_count'       => $entry->getVideoViewCount(),
 					'rating'           => $entry->getVideoRatingInfo(),
 					'geo_location'     => $entry->getVideoGeoLocation(),
 			$this->data = $data;
 		}
 
-		return $this->data;
+		return $key ? (isset($this->data[$key]) ? $this->data[$key] : null) : $this->data;
 	}
+
+	public function getTitle()          { return $this->getData('title');            }
+	public function getUpdated()        { return $this->getData('updated');          }
+	public function getDescription()    { return $this->getData('description');      }
+	public function getCategory()       { return $this->getData('category');         }
+	public function getTags()           { return $this->getData('tags');             }
+	public function getWatchPageUrl()   { return $this->getData('watch_page');       }
+	public function getFlashPlayerUrl() { return $this->getData('flash_player_url'); }
+	public function getDuration()       { return $this->getData('duration');         }
+	public function getViewCount()      { return $this->getData('view_count');       }
+	public function getRatingInfo()     { return $this->getData('rating');           }
+	public function getGeoLocation()    { return $this->getData('geo_location');     }
+	public function getRecorded()       { return $this->getData('recorded_on');      }
+	public function getThumbnails()     { return $this->getData('thumbnails');       }
+	public function getEditLink()       { return $this->getData('edit_link');        }
+	public function isPrivate()         { return $this->getData('private');          }
+	public function getState()          { return $this->getData('state');            }
 }