1
0
mirror of https://github.com/mbirth/tcl_update_db.git synced 2024-12-25 12:04:07 +00:00

Make RSS more valid.

This commit is contained in:
Markus Birth 2018-05-20 17:09:36 +02:00
parent a5977b67c0
commit b815acee05
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A

31
rss.php
View File

@ -1,9 +1,3 @@
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>TCL OTA</title>
<link>https://tclota.birth-online.de/timeline.php</link>
<description>TCL OTA updates</description>
<?php
require_once __DIR__ . '/lib/autoloader.php';
@ -24,6 +18,18 @@ if (count($unknowns) > 0) {
}
}
header('Content-Type: application/rss+xml');
?>
<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>TCL OTA</title>
<link>https://tclota.birth-online.de/timeline.php</link>
<atom:link href="https://tclota.birth-online.de/rss.php" rel="self" type="application/rss+xml" />
<description>TCL OTA updates</description>
<?php
/*
* NOTE: it would be nice to have a filter for device id to be able to subscribe only to specific model/variant
*/
@ -52,18 +58,19 @@ foreach ($allfiles as $file) {
$date->setTimezone(new DateTimeZone('CET'));
$dateLast = new DateTime($file['published_last']);
$dateLast->setTimezone(new DateTimeZone('CET'));
echo '<item>';
echo '<title>' . $file['tv'] . '</title>';
echo '<link>https://tclota.birth-online.de/timeline.php</link>';
echo '<description>';
echo '<item>' . PHP_EOL;
echo ' <title>' . $file['tv'] . '</title>' . PHP_EOL;
echo ' <link>https://tclota.birth-online.de/timeline.php</link>' . PHP_EOL;
echo ' <description><![CDATA[';
if ($file['fv']) {
echo '(OTA from ' . $file['fv'] . ')';
}
echo $date->format('Y-m-d') . ' ' . $date->format('H:i.s') . ' CET<br />';
echo 'Devices: ' . implode(', ', $validDevs) . '<br />';
echo 'Last released: ' . $dateLast->format('Y-m-d H:i.s') . ' (first seen in the wild: ' . $firstSeen->format('Y-m-d H:i.s') . ')<br/>';
echo 'Valid for (order of release): ' . implode(', ', $validRefs) . '</description>';
echo 'Valid for (order of release): ' . implode(', ', $validRefs);
echo ']]></description>' . PHP_EOL;
echo '</item>' . PHP_EOL;
}
?>