' . PHP_EOL;
$app = new Phlaym\Roastmonday\Roastmonday($config, realpath($internal_pics_dir));
$app->authenticateServerToken();
$tm = $app->findThemeMondays();
echo 'Only checking the latest four mondays for new pictures
\n';
$tm = array_slice($tm, 0, 4);
foreach ($tm as $monday) {
$monday['id'] = $app->addTheme($monday['tag'], $monday['date']);
echo $monday['tag'] . ' with id ' . $monday['id'] . '
\n';
try {
$app->savePicturesForTheme($monday);
} catch (\Exception $e) {
echo 'Error saving pictures for ' . $monday['tag'] . ':' . $e->getMessage();
}
}