Skip to content

Commit

Permalink
Capture whether it's floor video, improve comments
Browse files Browse the repository at this point in the history
It was necessary to move to a more complicated array structure, to
include additional fields. Toward #33.
  • Loading branch information
waldoj committed Jan 19, 2018
1 parent b9ce547 commit 3c29572
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions cron/poll_video_rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
/*
* Figure out the date of this video.
*/

/* If there's no hyphen (found in the date
* separator), then this isn't a video, and we can skip it.
*/
$pos = strpos($item->title, '-');
if ($pos === FALSE)
{
Expand All @@ -113,10 +117,17 @@
$timestamp = strtotime($date);
$date = date('Ymd', $timestamp);

$type = 'floor';

/*
* Save this video date and URL.
* Save data about this video.
*/
$videos[$date] = (string) $item->enclosure['url'];
$videos[] = array(
'date' => $date,
'url' => (string) $item->enclosure['url'],
'chamber' => $chamber,
'type' => $type
);

}

Expand All @@ -130,21 +141,21 @@
if (count($videos) > 0)
{

foreach ($videos as $date => $url)
foreach ($videos as $video)
{

/*
* Log this to SQS.
*/
$video_metadata = ['date' => $date, 'url' => $url, 'chamber' => $chamber];
$sqs_client->sendMessage([
'MessageGroupId' => '1',
'MessageDeduplicationId' => mt_rand(),
'QueueUrl' => 'https://sqs.us-east-1.amazonaws.com/947603853016/rs-video-harvester.fifo',
'MessageBody' => json_encode($video_metadata)
'MessageBody' => json_encode($video)
]);

$log->put('Found new video, for ' . $date . ', at: ' . $url, 5);
$log->put('Machine found new video, for ' . $video->date . ', at ' . $video->url
. '. Starting video processor.', 5);

}

Expand Down

0 comments on commit 3c29572

Please sign in to comment.