--- /dev/null
+<?php
+namespace imagestore;
+
+class Controller_Api_Apps extends Controller_Api_ImageBase
+{
+ public function handle($data)
+ {
+ $path = str_replace('-.-', '/', $data);
+ $fullPath = $GLOBALS['imagestore']['basedir'] . $path;
+ if (!is_dir($fullPath)) {
+ return $this->error('404 Not Found', 'Path not found');
+ }
+
+ $dirInfo = new \SplFileInfo($fullPath);
+
+ $data = array(
+ 'app' => array(
+ 'apkFileSize' => 123456789,
+ 'contentRating' => 'Everyone',
+ 'description' => 'Images from folder ' . $fullPath,
+ 'developer' => 'Christian Weiske',
+ 'filepickerScreenshots' => $this->getScreenshots($dirInfo),
+ 'founder' => false,
+ 'latestVersion' => '11111111-0000-1111-0000-111111111111',
+ 'likeCount' => 1337,
+ 'mainImageFullUrl' => $this->getImageUrl($this->getFirstImage($dirInfo)),
+ 'overview' => 'Images from a folder',
+ 'publishedAt' => date('c', $dirInfo->getMTime()),
+ 'screenshots' => array(),
+ 'supportEmailAddress' => 'cweiske+ouya@cweiske.de',
+ 'supportPhone' => null,
+ 'title' => $dirInfo->getBasename(),
+ 'uuid' => $data,
+ 'versionNumber' => '0.0.1',
+ 'website' => 'http://git.cweiske.de/ouya-imagestore.git/'
+ )
+ );
+
+ header('Content-Type: application/json');
+ echo json_encode($data, JSON_PRETTY_PRINT);
+ }
+
+ protected function getScreenshots(\SplFileInfo $dirInfo)
+ {
+ $lit = new \LimitIterator($this->getImageIterator($dirInfo), 0, 20);
+ $urls = array();
+ foreach ($lit as $file) {
+ $urls[] = $this->getImageUrl($file);
+ }
+ return $urls;
+ }
+}
+?>