Initial commit

This commit is contained in:
2020-11-13 22:41:03 +01:00
commit bbfb050279
8 changed files with 2309 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Edit episode {{episode.title}}</title>
</head>
<body>
<form id="form" method="post">
<input type="hidden" id="pub_date" name="pub_date" value="{{episode.pub_date.to_rfc3339()}}">
<table border="0">
<tr><td>Title</td><td><input type="text" name="title" value="{{episode.title}}" required="true"></td></tr>
<tr><td>GUID</td><td><input type="text" name="guid" value="{{episode.guid}}" required="true"></td></tr>
<tr><td>Pub Date</td><td><input type="date" id="date" required="true"><input type="time" id="time" required="true"></td></tr>
<tr><td>Video URL</td><td><input type="text" name="video_url" value="{{episode.video_url}}" required="true"></td></tr>
</table>
<button type="submit">Save</button>
</form>
<script type="text/javascript">
"use strict"
function leadingzero(s) {
s = s.toString()
if (s.length == 1) {
return "0" + s;
}
return s;
}
function calcdate() {
let datestr = document.getElementById("date").value + " " + document.getElementById("time").value;
let datetime = new Date(datestr);
document.getElementById("pub_date").value = datetime.toISOString();
return true;
}
let datetime = new Date(document.getElementById("pub_date").value)
console.log(datetime.getFullYear() + "-" + (datetime.getMonth() + 1) + "-" + datetime.getDate())
document.getElementById("date").value = datetime.getFullYear() + "-" + leadingzero(datetime.getMonth() + 1) + "-" + leadingzero(datetime.getDate())
document.getElementById("time").value = leadingzero(datetime.getHours()) + ":" + leadingzero(datetime.getMinutes())
document.getElementById("form").onsubmit = calcdate;
</script>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Edit {{podcast.title}}</title>
</head>
<body>
<form method="post">
<table border="0">
<tr><td>Title</td><td><input type="text" name="title" value="{{podcast.title}}"></td></tr>
<tr><td>Logo URL</td><td><input type="text" name="logo_url" value="{{podcast.logo_url.as_ref().unwrap_or(String::new())}}"></td></tr>
<tr><td>Homepage</td><td><input type="text" name="homepage" value="{{podcast.homepage}}"></td></tr>
<tr><td colspan="2"><button type="submit">Save</button></td></tr>
<tr><td>Episodes</td><td><a href="./new">Add</a></td></tr>
<tr><td colspan="2">
<table border="0">
{%- for episode in podcast.episodes %}
<tr><td>{{episode.title}}</td><td>{{episode.guid}}</td><td>{{episode.pub_date}}</td><td><a href="./edit/{{loop.index}}"></a></td></tr>
{%- endfor %}
</table>
</td></tr>
</table>
</form>
</body>
</html>

24
templates/feed.xml Normal file
View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss>
<channel>
<title>{{podcast.title}}</title>
<link>{{podcast.homepage}}</link>
{%- match podcast.logo_url %}
{%- when Some with (logo_url) %}
<image>
<title>{{podcast.title}} Logo</title>
<url>{{logo_url}}</url>
</image>
{%- when None %}
{%- endmatch %}
{%- for episode in podcast.episodes %}
<item>
<title>{{episode.title}}</title>
<enclosure url="{{episode.video_url}}" type="video/mpeg"/>
<guid>{{episode.guid}}</guid>
<pubDate>{{episode.pub_date.to_rfc2822()}}</pubDate>
</item>
{%- endfor %}
</channel>
</rss>