First pass at dinosaurwet rss
This commit is contained in:
@@ -35,7 +35,8 @@
|
||||
"ramda": "^0.29.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rxjs": "^7.8.1",
|
||||
"slate-irc": "^0.9.3"
|
||||
"slate-irc": "^0.9.3",
|
||||
"xml": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^10.0.0",
|
||||
@@ -49,6 +50,7 @@
|
||||
"@types/ramda": "^0.29.3",
|
||||
"@types/slate-irc": "^0.0.29",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@types/xml": "^1.0.9",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"eslint": "^8.42.0",
|
||||
|
@@ -11,6 +11,7 @@ import configuration from './config/configuration';
|
||||
import { CacheModule } from '@nestjs/cache-manager';
|
||||
import { IrcbotModule } from './ircbot/ircbot.module';
|
||||
import { IrcbotService } from './ircbot/ircbot.service';
|
||||
import { DinosaurwetModule } from './dinosaurwet/dinosaurwet.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -25,6 +26,7 @@ import { IrcbotService } from './ircbot/ircbot.service';
|
||||
UsersModule,
|
||||
DomainrproxyModule,
|
||||
IrcbotModule,
|
||||
DinosaurwetModule,
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
|
108
src/dinosaurwet/dinosaurwet.controller.ts
Normal file
108
src/dinosaurwet/dinosaurwet.controller.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
import { Controller, Get, Res } from '@nestjs/common';
|
||||
import { Response } from 'express';
|
||||
import * as xml from 'xml';
|
||||
|
||||
const episodeFiles: [number, string][] = [
|
||||
[27544345, '01-Into-the-Big-Wet.mp3'],
|
||||
[30724178, '02-Ocean-Rumours.mp3'],
|
||||
[30752181, '03-Step-Two.mp3'],
|
||||
[28793207, '04-Red-Ladder-Revelations.mp3'],
|
||||
[29684714, '05-What-to-do-with-a-Problem-Like-Daveda.mp3'],
|
||||
[29387545, '06-Hair-Bussy.mp3'],
|
||||
[30789798, '07-Monkey-Monkey-Cock-a-Roach.mp3'],
|
||||
[29449403, '08-SS-Jungle-and-Blood.mp3'],
|
||||
[29554728, '09-A-Bad-Day-in-Sogland.mp3'],
|
||||
[31728952, '10-A-Loathed-Trip-Down-Memory-Lane.mp3'],
|
||||
[29711881, '11-Dog-Egg-Consumption.mp3'],
|
||||
[31212772, '12-Meg-and-Bobs-Wedding-Bussy.mp3'],
|
||||
[30951548, '13-100-Genuine-Pussy-Hound.mp3'],
|
||||
[33766503, '14-One-Perfect-Answer.mp3'],
|
||||
[29643754, '15-Succulent-Pig-Excitement.mp3'],
|
||||
[29797145, '16-Welcome-to-Jackson-Island.mp3'],
|
||||
[37926451, '17-Infinite-Meat.mp3'],
|
||||
[33863888, '18-The-Jackson-Triumvirate.mp3'],
|
||||
[30256482, '19-A-Lucky-Day-to-be-a-Jackson.mp3'],
|
||||
[40947042, '20-The-Joels-Triumphant.mp3'],
|
||||
];
|
||||
|
||||
const startDate = new Date('2023-10-02');
|
||||
|
||||
const episodes = episodeFiles.map((file, i) => {
|
||||
const [length, filename] = file;
|
||||
return {
|
||||
filename,
|
||||
length,
|
||||
url: `https://s3.apps.hnl.byoi.net/dinosaurpark/DinosaurWet/${filename}`,
|
||||
title: filename
|
||||
.replace(/^\d+/, '')
|
||||
.replace('.mp3', '')
|
||||
.replace(/-/g, ' ')
|
||||
.trim(),
|
||||
description:
|
||||
'A bootleg-ish of Dinosar Wet, making the downloaded files more like and RSS feed',
|
||||
fakeReleaseDate: new Date(startDate).setDate(startDate.getDate() + i * 7),
|
||||
};
|
||||
});
|
||||
|
||||
@Controller('dinosaurwet')
|
||||
export class DinosaurwetController {
|
||||
@Get('')
|
||||
getAllAtOnce(@Res() response: Response) {
|
||||
response.header('Content-Type', 'application/xml');
|
||||
const feedObject = {
|
||||
rss: [
|
||||
{
|
||||
_attr: {
|
||||
version: '2.0',
|
||||
'xmlns:atom': 'http://www.w3.org/2005/Atom',
|
||||
},
|
||||
},
|
||||
{
|
||||
channel: [
|
||||
{
|
||||
'atom:link': {
|
||||
_attr: {
|
||||
href: 'https://api.us.dev/dinosaurwet',
|
||||
rel: 'self',
|
||||
type: 'application/rss+xml',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Dinosaur Wet - All At Once',
|
||||
},
|
||||
{
|
||||
link: 'https://sanspantsradio.com',
|
||||
},
|
||||
{
|
||||
description:
|
||||
'A recreation of Dinosaur Wet as an RSS feed for listeners-with-licenses enjoyment.',
|
||||
},
|
||||
{ language: 'en-US' },
|
||||
...episodes.map(({ title, url, length }) => ({
|
||||
item: [
|
||||
{ title },
|
||||
{ guid: url },
|
||||
{ pubDate: startDate.toUTCString() },
|
||||
{
|
||||
enclosure: [
|
||||
{
|
||||
_attr: {
|
||||
url,
|
||||
type: 'audio/mpeg',
|
||||
length,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})),
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const feed = '<?xml version="1.0" encoding="UTF-8"?>' + xml(feedObject);
|
||||
return response.send(feed);
|
||||
}
|
||||
}
|
7
src/dinosaurwet/dinosaurwet.module.ts
Normal file
7
src/dinosaurwet/dinosaurwet.module.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { DinosaurwetController } from './dinosaurwet.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [DinosaurwetController]
|
||||
})
|
||||
export class DinosaurwetModule {}
|
@@ -1140,6 +1140,13 @@
|
||||
dependencies:
|
||||
"@types/superagent" "*"
|
||||
|
||||
"@types/xml@^1.0.9":
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/xml/-/xml-1.0.9.tgz#f3688ecbcc8e5a58d0deca789aaa6c351106bbb7"
|
||||
integrity sha512-Wo71d7qF1TPcjbg251MS4m4MeK8F8/+ND2t6qTnwoK+jVmD9k9nGN1g9ocu4pRzLSjKMkbnowb88FFPnt+6Wiw==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/yargs-parser@*":
|
||||
version "21.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b"
|
||||
|
Reference in New Issue
Block a user