Feature/image desc #1
|
|
@ -17,6 +17,7 @@ export type Episode = {
|
||||||
titles: {
|
titles: {
|
||||||
title: string,
|
title: string,
|
||||||
description: string,
|
description: string,
|
||||||
|
subtitle: string,
|
||||||
},
|
},
|
||||||
durationInSeconds: number,
|
durationInSeconds: number,
|
||||||
date: string,
|
date: string,
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,12 @@ import { HandlerContext } from "$fresh/server.ts";
|
||||||
import { serialize, tag, declaration } from "https://deno.land/x/serializexml@v0.3.2/mod.ts";
|
import { serialize, tag, declaration } from "https://deno.land/x/serializexml@v0.3.2/mod.ts";
|
||||||
|
|
||||||
function toItemTag(episode: Episode) {
|
function toItemTag(episode: Episode) {
|
||||||
|
const description = episode.titles.description || episode.titles.subtitle;
|
||||||
return tag("item", [
|
return tag("item", [
|
||||||
tag("title", episode.titles.title),
|
tag("title", episode.titles.title),
|
||||||
tag("link", episode.url),
|
tag("link", episode.url),
|
||||||
tag("description", episode.titles.description),
|
tag("description", description),
|
||||||
tag("itunes:summary", episode.titles.description),
|
tag("itunes:summary", description),
|
||||||
tag("guid", episode.id, [["isPermaLink", "false"]]),
|
tag("guid", episode.id, [["isPermaLink", "false"]]),
|
||||||
tag("pubDate", episode.date),
|
tag("pubDate", episode.date),
|
||||||
tag("enclosure", "", [
|
tag("enclosure", "", [
|
||||||
|
|
@ -22,7 +23,6 @@ function toItemTag(episode: Episode) {
|
||||||
async function buildFeed(seriesId: any) {
|
async function buildFeed(seriesId: any) {
|
||||||
const serie = await nrkRadio.getSerieData(seriesId)
|
const serie = await nrkRadio.getSerieData(seriesId)
|
||||||
|
|
||||||
|
|
||||||
// Quickly adapted from https://raw.githubusercontent.com/olaven/paperpod/1cde9abd3174b26e126aa74fc5a3b63fd078c0fd/packages/converter/src/rss.ts
|
// Quickly adapted from https://raw.githubusercontent.com/olaven/paperpod/1cde9abd3174b26e126aa74fc5a3b63fd078c0fd/packages/converter/src/rss.ts
|
||||||
return serialize(
|
return serialize(
|
||||||
declaration([
|
declaration([
|
||||||
|
|
@ -40,8 +40,11 @@ async function buildFeed(seriesId: any) {
|
||||||
serie.subtitle
|
serie.subtitle
|
||||||
),
|
),
|
||||||
tag("ttl", "60"), //60 minutes
|
tag("ttl", "60"), //60 minutes
|
||||||
|
tag("itunes:image", "", [
|
||||||
|
["href", serie.image.url],
|
||||||
|
]),
|
||||||
tag("image", [
|
tag("image", [
|
||||||
tag("url", serie.image.uri),
|
tag("url", serie.image.url),
|
||||||
tag("title", serie.title),
|
tag("title", serie.title),
|
||||||
]),
|
]),
|
||||||
...serie.episodes.map(toItemTag),
|
...serie.episodes.map(toItemTag),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue