2 $gamefiles = glob('devs.ouya.tv/api/v1/apps/*.json');
4 foreach ($gamefiles as $file) {
5 echo "Processing $file\n";
6 $data = json_decode(file_get_contents($file));
8 echo "error opening " . $file . "\n";
11 $package = strtolower(basename($file, '.json'));
13 $dir = 'game-images/' . $package . '/';
15 mkdir($dir, 0777, true);
19 foreach ($data->app->filepickerScreenshots as $imageUrl) {
21 copyImageUrl($imageUrl, $dir . 'screenshot-' . $pos);
24 copyImageUrl($data->app->mainImageFullUrl, $dir . 'main');
28 function copyImageUrl($imageUrl, $newPath)
30 $imageLocal = getLocalPath($imageUrl);
31 if (!file_exists($imageLocal)) {
32 echo "Local file not found: $imageLocal\n";
35 if (file_exists($newPath)) {
41 copy($imageLocal, $newPath);
43 'map-game-images.csv',
45 . 'http://ouya.cweiske.de/' . $newPath
51 function getLocalPath($imageUrl)
53 return str_replace('https://', '', $imageUrl);