diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/Overview.php | 52 | ||||
-rw-r--r-- | model/Room.php | 49 | ||||
-rw-r--r-- | model/Stream.php | 5 | ||||
-rw-r--r-- | model/StreamList.php | 28 |
4 files changed, 134 insertions, 0 deletions
diff --git a/model/Overview.php b/model/Overview.php new file mode 100644 index 0000000..005233f --- /dev/null +++ b/model/Overview.php @@ -0,0 +1,52 @@ +<?php + +require_once('model/Room.php'); + +class Overview +{ + public function getGroups() { + $groups = array(); + + foreach(get('OVERVIEW.GROUPS') as $group => $rooms) + { + foreach($rooms as $room) + { + try { + $groups[$group][] = Room::get($room); + } + catch(NotFountException $e) + { + // just ignore unknown rooms + continue; + } + } + } + + return $groups; + } + + public function getReleasesUrl() { + return get('OVERVIEW.RELEASES'); + } + + public function getReliveUrl() { + if(has('OVERVIEW.RELIVE')) + return get('OVERVIEW.RELIVE'); + + elseif(has('OVERVIEW.RELIVE_JSON')) + return 'relive/'; + + else + return null; + } + + + + public function hasRelive() { + return has('OVERVIEW.RELIVE') || has('OVERVIEW.RELIVE_JSON'); + } + + public function hasReleases() { + return has('OVERVIEW.RELEASES'); + } +} diff --git a/model/Room.php b/model/Room.php new file mode 100644 index 0000000..7394870 --- /dev/null +++ b/model/Room.php @@ -0,0 +1,49 @@ +<?php + +class Room { + private $slug; + + public static function get($slug) + { + return new Room($slug); + } + + private function __construct($slug) + { + if(! has('ROOMS.'.$slug)) + throw new NotFoundException('Room '.$slug); + + $this->slug = $slug; + } + + + public function getSlug() { + return $this->slug; + } + + public function getThumb() { + return 'thumbs/'.$this->getStream().'.png'; + } + + public function getLink() { + return rawurlencode($this->getSlug()).'/'; + } + + public function getStream() { + return get('ROOMS.'.$this->getSlug().'.STREAM', $this->getSlug()); + } + + public function getDisplay() { + return get('ROOMS.'.$this->getSlug().'.DISPLAY', $this->getSlug()); + } + + + + public function hasPreview() { + return get('ROOMS.'.$this->getSlug().'.PREVIEW'); + } + + public function hasSchedule() { + return get('ROOMS.'.$this->getSlug().'.SCHEDULE') && has('SCHEDULE'); + } +} diff --git a/model/Stream.php b/model/Stream.php new file mode 100644 index 0000000..a60284a --- /dev/null +++ b/model/Stream.php @@ -0,0 +1,5 @@ +<?php + +class Room { + +} diff --git a/model/StreamList.php b/model/StreamList.php new file mode 100644 index 0000000..4fd035e --- /dev/null +++ b/model/StreamList.php @@ -0,0 +1,28 @@ +<?php + +class StreamList implements AggregateIterator { + private $streams = array(); + + public function getIterator() { + return new ArrayIterator($this->streams); + } + + + public function hasTranslation() { + } + + public function hasRTMP() { + } + + public function hasHLS() { + } + + public function hasWebM() { + } + + public function hasHD() { + } + + public function hasSD() { + } +} |