Update team and description parsing

This commit is contained in:
Dennis Reimann
2024-04-28 12:17:14 +02:00
parent 94bf896221
commit 7812610172
6 changed files with 22 additions and 9 deletions

View File

@@ -367,5 +367,15 @@
"customKey": "696969",
"customValue": "xVJWaSLb2QkQrhwfc3VG"
}
},
"spok": {
"name": "spok",
"url": "https://fairtalk.tv",
"image": "/img/team/spok.png",
"v4v": {
"address": "030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3",
"customKey": "696969",
"customValue": "BhSmEGwARJfwZFeZW1Ma"
}
}
}

View File

@@ -68,6 +68,8 @@ const teamWithAliases = team => {
return withAliases
}
const participantToId = p => p.replace(/\(.*?\)/, '').trim().toLowerCase()
module.exports = {
markdown: mdTransformer.render,
replacements,
@@ -75,5 +77,6 @@ module.exports = {
stripHTML,
truncate,
teamWithAliases,
participantToId,
toMeetupMapInfo
}

View File

@@ -96,7 +96,7 @@ mixin spende(d, trunc = false)
mixin participants(ps, link)
.participants
for name in ps
- const id = name.toLowerCase()
- const id = participantToId(name)
- const member = team[id]
if member
if link

BIN
static/img/team/spok.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -1,6 +1,6 @@
const { writeFileSync } = require('fs')
const { join, resolve } = require('path')
const { replacements, slugify, stripHTML, teamWithAliases } = require('../helpers')
const { replacements, slugify, stripHTML, teamWithAliases, participantToId } = require('../helpers')
const { masterFeedUrl, publicFeedUrl } = require('../content/meta.json')
const teamRaw = require('../content/team.json')
const request = require('sync-request')
@@ -67,13 +67,14 @@ const parseEpisode = e => {
: `/img/cover/${category}.png`
const duration = e['itunes:duration']
const enclosure = e.enclosure.__attr
const [, participantsString] =
const [, participantsString, additionalString] =
firstLine.match(/[-–—]\s?(?:(?:(?:von\sund\s)?mit\s)|(?:gelesen\svon\s))([^.]*)/i) || []
const participants = participantsString
? participantsString
.replace(/(\s*,\s*|\s*und\s*|\s*&\s*)/gi, '%')
.replace(/(\s*,\s*|\s*und\s*|\s*sowie\s*|\s*&\s*)/gi, '%')
.trim()
.split('%')
.filter(p => !!p)
.map(p => p.trim())
: []
return {
@@ -149,7 +150,6 @@ const parseEpisode = e => {
...item,
link, // replace Anchor link
description: { __cdata: description },
//'itunes:summary': description // please the validator, Anchor's itunes:summary contains HTML
}
// itunes:summary seems to be gone: https://help.apple.com/itc/podcasts_connect/#/itcb54353390
delete updated['itunes:summary']
@@ -164,7 +164,7 @@ const parseEpisode = e => {
}
const value = episode.participants.reduce((result, name) => {
const id = name.toLowerCase()
const id = participantToId(name)
const v4v = team[id] && team[id].v4v
if (v4v) {
result.push({ name, ...v4v })
@@ -193,7 +193,7 @@ const parseEpisode = e => {
}
const people = episode.participants.reduce((result, name) => {
const id = name.toLowerCase()
const id = participantToId(name)
const person = team[id]
if (person) {
result.push(person)

View File

@@ -1,7 +1,7 @@
const pug = require('pug')
const { mkdirSync, writeFileSync } = require('fs')
const { dirname, resolve } = require('path')
const { slugify, teamWithAliases } = require('../helpers')
const { slugify, teamWithAliases, participantToId } = require('../helpers')
const config = require('../pug.config')
const site = require('../generated/site-data.json')
const episodes = require('../generated/episodes.json')
@@ -61,6 +61,6 @@ Object.keys(categories).forEach(category => renderPage('category', `podcast/${sl
Object.keys(teamRaw).forEach(id => {
const member = teamRaw[id]
const aliases = (member.aliases || []).map(m => m.toLowerCase()).concat(member.name.toLowerCase())
const eps = episodes.filter(e => e.participants.find(p => [id, ...aliases].includes(p.toLowerCase())))
const eps = episodes.filter(e => e.participants.find(p => [id, ...aliases].includes(participantToId(p))))
renderPage('member', `team/${slugify(id)}`, { navCurrent: 'podcast', member, episodes: eps, team })
})