X-Git-Url: https://git.cweiske.de/ouya-game-data.git/blobdiff_plain/59733655dd3d8fe22e7be21ec56cb35bc04f0ec0..ef5020152268a7503a1aa83b56b3fd0181067290:/bin/copy-game-images.php diff --git a/bin/copy-game-images.php b/bin/copy-game-images.php new file mode 100644 index 0000000..d8ac102 --- /dev/null +++ b/bin/copy-game-images.php @@ -0,0 +1,55 @@ +app->filepickerScreenshots as $imageUrl) { + $pos++; + copyImageUrl($imageUrl, $dir . 'screenshot-' . $pos); + } + + copyImageUrl($data->app->mainImageFullUrl, $dir . 'main'); + echo "\n"; +} + +function copyImageUrl($imageUrl, $newPath) +{ + $imageLocal = getLocalPath($imageUrl); + if (!file_exists($imageLocal)) { + echo "Local file not found: $imageLocal\n"; + return; + } + if (file_exists($newPath)) { + echo "S"; + return; + } + + echo "."; + copy($imageLocal, $newPath); + file_put_contents( + 'map-game-images.csv', + $imageUrl . ',' + . 'http://ouya.cweiske.de/' . $newPath + . "\n", + FILE_APPEND + ); +} + +function getLocalPath($imageUrl) +{ + return str_replace('https://', '', $imageUrl); +} +?>