late updates from readme writing

This commit is contained in:
Alexis Marie Wright 2022-04-15 12:43:44 -04:00
parent ad04f87299
commit 78349c0058
2 changed files with 19 additions and 6 deletions

View File

@ -4,8 +4,12 @@ declare(strict_types = 1);
class Config {
const feed = [
'title' => '[INHUMAN] a sci-fi webcomic',
'description' => '...',
'description' => 'A schizophrenic GMO is kidnapped by fringe militants. When it\'s revealed he\'s part of a top-secret project, he goes on the run with a PTSD alcoholic alien while his kidnappers try to figure out the truth.',
'feedUrl' => 'http://www.inhuman-comic.com/feed.xml',
// Since site pages aren't dated by publication, we have to
// fake it in the RSS feed so readers can show items with
// correct ordering. This value determines how much fake
// time to put between each pair of items.
'itemDelaySeconds' => 604800, // 1 "week"
];
@ -27,7 +31,7 @@ class Config {
const logLevels = [
'warn' => true,
'info' => true,
'debug' => true,
'debug' => false,
'silly' => false
];
}

View File

@ -11,8 +11,11 @@ function fetchSiteContent($knownContent = array()) {
$comicPages = array();
$knownPageUrls = array();
foreach ($knownContent as $knownItem) {
$knownPageUrls[$knownItem->href] = $knownItem;
if ($knownContent) {
foreach ($knownContent as $knownItem) {
$knownPageUrls[$knownItem->href] = $knownItem;
};
};
$archivePage = fetchUrl(Config::archiveUrl);
@ -70,10 +73,16 @@ function fetchSiteContent($knownContent = array()) {
$link->title = trim(substr($arcHtml, $start, $end - $start));
$link->imageUrl = Config::baseUrl . '/' . $comicPage->find('div.page img')[0]->src;
$link->imageUrl = $comicPage->find('div.page img')[0]->src;
if (!$link->imageUrl) {
throw new Exception("Failed to find an image in {$el} ({$el->href})");
};
$link->imageUrl = Config::baseUrl . '/' . $link->imageUrl;
array_push($comicPages, $link);
Log::debug($link);
Log::info("Fetched " . $link->href);
usleep(250000); // don't be too rude
};