This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
forked from RSS-Bridge/rss-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ParksOnTheAir] New bridge for amateur radio (RSS-Bridge#2086)
- Loading branch information
1 parent
3370cf7
commit 2cdb1bf
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
class ParksOnTheAirBridge extends BridgeAbstract { | ||
const MAINTAINER = 's0lesurviv0r'; | ||
const NAME = 'Parks On The Air Spots'; | ||
const URI = 'https://api.pota.app/spot/activator'; | ||
const CACHE_TIMEOUT = 60; // 1m | ||
const DESCRIPTION = 'Parks On The Air Activator Spots'; | ||
|
||
public function collectData() { | ||
|
||
$header = array('Content-type:application/json'); | ||
$opts = array(CURLOPT_HTTPGET => 1); | ||
$json = getContents($this->getURI(), $header, $opts); | ||
|
||
$spots = json_decode($json, true); | ||
|
||
foreach ($spots as $spot) { | ||
$title = $spot['activator'] . ' @ ' . $spot['reference'] . ' ' . | ||
$spot['frequency'] . ' kHz'; | ||
|
||
$content = <<<EOL | ||
<a href="https://pota.us/#/parks/{$spot['reference']}"> | ||
{$spot['reference']}, {$spot['name']}</a><br /> | ||
Location: {$spot['locationDesc']}<br /> | ||
Frequency: {$spot['frequency']} kHz<br /> | ||
Spotter: {$spot['spotter']}<br /> | ||
Comments: {$spot['comments']} | ||
EOL; | ||
|
||
$this->items[] = array( | ||
'uri' => 'https://pota.us/#/', | ||
'title' => $title, | ||
'content' => $content, | ||
'timestamp' => $spot['spotTime'] | ||
); | ||
} | ||
} | ||
} |