podverse-parser 1.0.0 → 5.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -81
- package/dist/lib/chapters/chapters.d.ts +3 -0
- package/dist/lib/chapters/chapters.d.ts.map +1 -0
- package/dist/lib/chapters/chapters.js +59 -0
- package/dist/lib/compat/channel.d.ts +108 -0
- package/dist/lib/compat/channel.d.ts.map +1 -0
- package/dist/lib/compat/channel.js +279 -0
- package/dist/lib/compat/chapters/chapters.d.ts +11 -0
- package/dist/lib/compat/chapters/chapters.d.ts.map +1 -0
- package/dist/lib/compat/chapters/chapters.js +16 -0
- package/dist/lib/compat/partytime/channel.d.ts +110 -0
- package/dist/lib/compat/partytime/channel.d.ts.map +1 -0
- package/dist/lib/compat/partytime/channel.js +281 -0
- package/dist/lib/compat/partytime/compatFull.d.ts +6 -0
- package/dist/lib/compat/partytime/compatFull.d.ts.map +1 -0
- package/dist/lib/compat/partytime/compatFull.js +11 -0
- package/dist/lib/compat/partytime/funding.d.ts +6 -0
- package/dist/lib/compat/partytime/funding.d.ts.map +1 -0
- package/dist/lib/compat/partytime/funding.js +10 -0
- package/dist/lib/compat/partytime/item.d.ts +146 -0
- package/dist/lib/compat/partytime/item.d.ts.map +1 -0
- package/dist/lib/compat/partytime/item.js +264 -0
- package/dist/lib/compat/partytime/liveItem.d.ts +11 -0
- package/dist/lib/compat/partytime/liveItem.d.ts.map +1 -0
- package/dist/lib/compat/partytime/liveItem.js +20 -0
- package/dist/lib/compat/partytime/value.d.ts +62 -0
- package/dist/lib/compat/partytime/value.d.ts.map +1 -0
- package/dist/lib/compat/partytime/value.js +69 -0
- package/dist/lib/rss/base/handleParsedManyData.d.ts +7 -0
- package/dist/lib/rss/base/handleParsedManyData.d.ts.map +1 -0
- package/dist/lib/rss/base/handleParsedManyData.js +21 -0
- package/dist/lib/rss/base/handleParsedOneData.d.ts +7 -0
- package/dist/lib/rss/base/handleParsedOneData.d.ts.map +1 -0
- package/dist/lib/rss/base/handleParsedOneData.js +21 -0
- package/dist/lib/rss/channel/channel.d.ts +4 -0
- package/dist/lib/rss/channel/channel.d.ts.map +1 -0
- package/dist/lib/rss/channel/channel.js +61 -0
- package/dist/lib/rss/channel/channelAbout.d.ts +4 -0
- package/dist/lib/rss/channel/channelAbout.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelAbout.js +20 -0
- package/dist/lib/rss/channel/channelChat.d.ts +4 -0
- package/dist/lib/rss/channel/channelChat.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelChat.js +21 -0
- package/dist/lib/rss/channel/channelDescription.d.ts +4 -0
- package/dist/lib/rss/channel/channelDescription.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelDescription.js +21 -0
- package/dist/lib/rss/channel/channelFunding.d.ts +4 -0
- package/dist/lib/rss/channel/channelFunding.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelFunding.js +21 -0
- package/dist/lib/rss/channel/channelImage.d.ts +4 -0
- package/dist/lib/rss/channel/channelImage.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelImage.js +21 -0
- package/dist/lib/rss/channel/channelLicense.d.ts +4 -0
- package/dist/lib/rss/channel/channelLicense.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelLicense.js +21 -0
- package/dist/lib/rss/channel/channelLocation.d.ts +4 -0
- package/dist/lib/rss/channel/channelLocation.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelLocation.js +21 -0
- package/dist/lib/rss/channel/channelPerson.d.ts +4 -0
- package/dist/lib/rss/channel/channelPerson.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelPerson.js +21 -0
- package/dist/lib/rss/channel/channelPodroll.d.ts +4 -0
- package/dist/lib/rss/channel/channelPodroll.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelPodroll.js +28 -0
- package/dist/lib/rss/channel/channelRemoteItem.d.ts +4 -0
- package/dist/lib/rss/channel/channelRemoteItem.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelRemoteItem.js +21 -0
- package/dist/lib/rss/channel/channelSeason.d.ts +4 -0
- package/dist/lib/rss/channel/channelSeason.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelSeason.js +25 -0
- package/dist/lib/rss/channel/channelSocialInteract.d.ts +4 -0
- package/dist/lib/rss/channel/channelSocialInteract.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelSocialInteract.js +21 -0
- package/dist/lib/rss/channel/channelTrailer.d.ts +4 -0
- package/dist/lib/rss/channel/channelTrailer.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelTrailer.js +36 -0
- package/dist/lib/rss/channel/channelTxt.d.ts +4 -0
- package/dist/lib/rss/channel/channelTxt.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelTxt.js +21 -0
- package/dist/lib/rss/channel/channelValue.d.ts +4 -0
- package/dist/lib/rss/channel/channelValue.d.ts.map +1 -0
- package/dist/lib/rss/channel/channelValue.js +37 -0
- package/dist/lib/rss/feed/feed.d.ts +5 -0
- package/dist/lib/rss/feed/feed.d.ts.map +1 -0
- package/dist/lib/rss/feed/feed.js +80 -0
- package/dist/lib/rss/hash/parsedFeed.d.ts +3 -0
- package/dist/lib/rss/hash/parsedFeed.d.ts.map +1 -0
- package/dist/lib/rss/hash/parsedFeed.js +22 -0
- package/dist/lib/rss/item/item.d.ts +5 -0
- package/dist/lib/rss/item/item.d.ts.map +1 -0
- package/dist/lib/rss/item/item.js +80 -0
- package/dist/lib/rss/item/itemAbout.d.ts +4 -0
- package/dist/lib/rss/item/itemAbout.d.ts.map +1 -0
- package/dist/lib/rss/item/itemAbout.js +20 -0
- package/dist/lib/rss/item/itemChaptersFeed.d.ts +4 -0
- package/dist/lib/rss/item/itemChaptersFeed.d.ts.map +1 -0
- package/dist/lib/rss/item/itemChaptersFeed.js +21 -0
- package/dist/lib/rss/item/itemChat.d.ts +4 -0
- package/dist/lib/rss/item/itemChat.d.ts.map +1 -0
- package/dist/lib/rss/item/itemChat.js +21 -0
- package/dist/lib/rss/item/itemContentLink.d.ts +1 -0
- package/dist/lib/rss/item/itemContentLink.d.ts.map +1 -0
- package/dist/lib/rss/item/itemContentLink.js +1 -0
- package/dist/lib/rss/item/itemDescription.d.ts +4 -0
- package/dist/lib/rss/item/itemDescription.d.ts.map +1 -0
- package/dist/lib/rss/item/itemDescription.js +21 -0
- package/dist/lib/rss/item/itemEnclosure.d.ts +4 -0
- package/dist/lib/rss/item/itemEnclosure.d.ts.map +1 -0
- package/dist/lib/rss/item/itemEnclosure.js +40 -0
- package/dist/lib/rss/item/itemImage.d.ts +4 -0
- package/dist/lib/rss/item/itemImage.d.ts.map +1 -0
- package/dist/lib/rss/item/itemImage.js +21 -0
- package/dist/lib/rss/item/itemLicense.d.ts +4 -0
- package/dist/lib/rss/item/itemLicense.d.ts.map +1 -0
- package/dist/lib/rss/item/itemLicense.js +21 -0
- package/dist/lib/rss/item/itemLocation.d.ts +4 -0
- package/dist/lib/rss/item/itemLocation.d.ts.map +1 -0
- package/dist/lib/rss/item/itemLocation.js +21 -0
- package/dist/lib/rss/item/itemPerson.d.ts +4 -0
- package/dist/lib/rss/item/itemPerson.d.ts.map +1 -0
- package/dist/lib/rss/item/itemPerson.js +21 -0
- package/dist/lib/rss/item/itemSeason.d.ts +4 -0
- package/dist/lib/rss/item/itemSeason.d.ts.map +1 -0
- package/dist/lib/rss/item/itemSeason.js +30 -0
- package/dist/lib/rss/item/itemSeasonEpisode.d.ts +4 -0
- package/dist/lib/rss/item/itemSeasonEpisode.d.ts.map +1 -0
- package/dist/lib/rss/item/itemSeasonEpisode.js +21 -0
- package/dist/lib/rss/item/itemSocialInteract.d.ts +4 -0
- package/dist/lib/rss/item/itemSocialInteract.d.ts.map +1 -0
- package/dist/lib/rss/item/itemSocialInteract.js +21 -0
- package/dist/lib/rss/item/itemSoundbite.d.ts +4 -0
- package/dist/lib/rss/item/itemSoundbite.d.ts.map +1 -0
- package/dist/lib/rss/item/itemSoundbite.js +21 -0
- package/dist/lib/rss/item/itemTranscript.d.ts +4 -0
- package/dist/lib/rss/item/itemTranscript.d.ts.map +1 -0
- package/dist/lib/rss/item/itemTranscript.js +21 -0
- package/dist/lib/rss/item/itemTxt.d.ts +4 -0
- package/dist/lib/rss/item/itemTxt.d.ts.map +1 -0
- package/dist/lib/rss/item/itemTxt.js +21 -0
- package/dist/lib/rss/item/itemValue.d.ts +4 -0
- package/dist/lib/rss/item/itemValue.d.ts.map +1 -0
- package/dist/lib/rss/item/itemValue.js +65 -0
- package/dist/lib/rss/liveItem/liveItem.d.ts +4 -0
- package/dist/lib/rss/liveItem/liveItem.d.ts.map +1 -0
- package/dist/lib/rss/liveItem/liveItem.js +41 -0
- package/dist/lib/rss/parser.d.ts +4 -0
- package/dist/lib/rss/parser.d.ts.map +1 -0
- package/dist/lib/rss/parser.js +83 -0
- package/dist/module-alias-config.d.ts +2 -0
- package/dist/module-alias-config.d.ts.map +1 -0
- package/dist/module-alias-config.js +7 -0
- package/eslint.config.mjs +38 -0
- package/package.json +20 -29
- package/src/index.ts +3 -0
- package/src/lib/chapters/chapters.ts +54 -0
- package/src/lib/compat/channel.ts +287 -0
- package/src/lib/compat/chapters/chapters.ts +23 -0
- package/src/lib/compat/partytime/channel.ts +289 -0
- package/src/lib/compat/partytime/compatFull.ts +7 -0
- package/src/lib/compat/partytime/funding.ts +8 -0
- package/src/lib/compat/partytime/item.ts +273 -0
- package/src/lib/compat/partytime/liveItem.ts +18 -0
- package/src/lib/compat/partytime/value.ts +64 -0
- package/src/lib/rss/base/handleParsedManyData.ts +16 -0
- package/src/lib/rss/base/handleParsedOneData.ts +17 -0
- package/src/lib/rss/channel/channel.ts +55 -0
- package/src/lib/rss/channel/channelAbout.ts +13 -0
- package/src/lib/rss/channel/channelChat.ts +14 -0
- package/src/lib/rss/channel/channelDescription.ts +14 -0
- package/src/lib/rss/channel/channelFunding.ts +14 -0
- package/src/lib/rss/channel/channelImage.ts +14 -0
- package/src/lib/rss/channel/channelLicense.ts +14 -0
- package/src/lib/rss/channel/channelLocation.ts +14 -0
- package/src/lib/rss/channel/channelPerson.ts +14 -0
- package/src/lib/rss/channel/channelPodroll.ts +21 -0
- package/src/lib/rss/channel/channelRemoteItem.ts +14 -0
- package/src/lib/rss/channel/channelSeason.ts +14 -0
- package/src/lib/rss/channel/channelSocialInteract.ts +14 -0
- package/src/lib/rss/channel/channelTrailer.ts +31 -0
- package/src/lib/rss/channel/channelTxt.ts +14 -0
- package/src/lib/rss/channel/channelValue.ts +30 -0
- package/src/lib/rss/feed/feed.ts +79 -0
- package/src/lib/rss/hash/parsedFeed.ts +9 -0
- package/src/lib/rss/item/item.ts +85 -0
- package/src/lib/rss/item/itemAbout.ts +13 -0
- package/src/lib/rss/item/itemChaptersFeed.ts +14 -0
- package/src/lib/rss/item/itemChat.ts +14 -0
- package/src/lib/rss/item/itemContentLink.ts +0 -0
- package/src/lib/rss/item/itemDescription.ts +14 -0
- package/src/lib/rss/item/itemEnclosure.ts +35 -0
- package/src/lib/rss/item/itemImage.ts +14 -0
- package/src/lib/rss/item/itemLicense.ts +14 -0
- package/src/lib/rss/item/itemLocation.ts +14 -0
- package/src/lib/rss/item/itemPerson.ts +14 -0
- package/src/lib/rss/item/itemSeason.ts +26 -0
- package/src/lib/rss/item/itemSeasonEpisode.ts +14 -0
- package/src/lib/rss/item/itemSocialInteract.ts +14 -0
- package/src/lib/rss/item/itemSoundbite.ts +14 -0
- package/src/lib/rss/item/itemTranscript.ts +14 -0
- package/src/lib/rss/item/itemTxt.ts +14 -0
- package/src/lib/rss/item/itemValue.ts +60 -0
- package/src/lib/rss/liveItem/liveItem.ts +34 -0
- package/src/lib/rss/parser.ts +85 -0
- package/src/module-alias-config.ts +8 -0
- package/tsconfig.json +25 -0
- package/LICENSE +0 -674
- package/README.md +0 -2
- package/dist/index.js.map +0 -7
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import type { Episode } from 'podcast-partytime';
|
|
2
|
+
import { Phase4PodcastImage } from 'podcast-partytime/dist/parser/phase/phase-4';
|
|
3
|
+
import { getItemItunesEpisodeTypeEnumValue } from 'podverse-orm';
|
|
4
|
+
import { compatItemValue } from './value';
|
|
5
|
+
|
|
6
|
+
export const compatItemDto = (parsedItem: Episode) => ({
|
|
7
|
+
guid: parsedItem.guid || null,
|
|
8
|
+
guid_enclosure_url: parsedItem.enclosure.url,
|
|
9
|
+
pubdate: parsedItem.pubDate || null,
|
|
10
|
+
title: parsedItem.title || null
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const compatItemAboutDto = (parsedItem: Episode) => ({
|
|
14
|
+
duration: parsedItem.duration?.toFixed(2) || null,
|
|
15
|
+
explicit: parsedItem.explicit || false,
|
|
16
|
+
website_link_url: parsedItem.link || null,
|
|
17
|
+
item_itunes_episode_type: getItemItunesEpisodeTypeEnumValue(parsedItem.itunesEpisodeType || 'full')
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const compatItemChaptersFeedDto = (parsedItem: Episode) => {
|
|
21
|
+
if (!parsedItem.podcastChapters?.url && !parsedItem.podcastChapters?.type) return null;
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
url: parsedItem.podcastChapters?.url,
|
|
25
|
+
type: parsedItem.podcastChapters?.type
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const compatItemChatDto = (parsedItem: Episode) => {
|
|
30
|
+
if (!parsedItem.chat) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
server: parsedItem.chat.server,
|
|
35
|
+
protocol: parsedItem.chat.protocol,
|
|
36
|
+
account_id: parsedItem.chat.accountId || null,
|
|
37
|
+
space: parsedItem.chat.space || null
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const compatItemDescriptionDto = (parsedItem: Episode) => {
|
|
42
|
+
if (!parsedItem.description) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
value: parsedItem.description
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const compatItemEnclosureDtos = (parsedItem: Episode) => {
|
|
51
|
+
const dtos = [];
|
|
52
|
+
|
|
53
|
+
if (parsedItem.alternativeEnclosures && parsedItem.alternativeEnclosures.length > 0) {
|
|
54
|
+
for (const alternativeEnclosure of parsedItem.alternativeEnclosures) {
|
|
55
|
+
const item_enclosure = {
|
|
56
|
+
type: alternativeEnclosure.type,
|
|
57
|
+
length: alternativeEnclosure.length || null,
|
|
58
|
+
bitrate: alternativeEnclosure.bitrate || null,
|
|
59
|
+
height: alternativeEnclosure.height || null,
|
|
60
|
+
language: alternativeEnclosure.lang || null,
|
|
61
|
+
title: alternativeEnclosure.title || null,
|
|
62
|
+
rel: alternativeEnclosure.rel || null,
|
|
63
|
+
codecs: alternativeEnclosure.codecs || null,
|
|
64
|
+
item_enclosure_default: false
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
PTDO: why am I getting this error when I don't use any?
|
|
69
|
+
src/lib/compat/partytime/item.ts:50:14 - error TS4023: Exported variable
|
|
70
|
+
'compatItemEnclosureDtos' has or is using name 'IntegrityType' from external module
|
|
71
|
+
"/podverse-parser/node_modules/podcast-partytime/dist/parser/phase/phase-3" but cannot be named.
|
|
72
|
+
*/
|
|
73
|
+
const item_enclosure_integrity = (alternativeEnclosure.integrity as any) || null;
|
|
74
|
+
|
|
75
|
+
const item_enclosure_sources = alternativeEnclosure.source.map(source => ({
|
|
76
|
+
uri: source.uri,
|
|
77
|
+
content_type: source.contentType
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
const formattedDto = {
|
|
81
|
+
item_enclosure,
|
|
82
|
+
item_enclosure_integrity,
|
|
83
|
+
item_enclosure_sources
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
dtos.push(formattedDto);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return dtos;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const compatItemImageDtos = (parsedItem: Episode) => {
|
|
94
|
+
const dtos = [];
|
|
95
|
+
if (parsedItem.itunesImage) {
|
|
96
|
+
dtos.push({
|
|
97
|
+
url: parsedItem.itunesImage,
|
|
98
|
+
image_width_size: null
|
|
99
|
+
});
|
|
100
|
+
} else if (parsedItem.image) {
|
|
101
|
+
dtos.push({
|
|
102
|
+
url: parsedItem.image,
|
|
103
|
+
image_width_size: null
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function hasWidth(image: Phase4PodcastImage['parsed']): image is { url: string; width: number } {
|
|
108
|
+
return (image as { width: number }).width !== undefined;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (Array.isArray(parsedItem.podcastImages)) {
|
|
112
|
+
for (const image of parsedItem.podcastImages) {
|
|
113
|
+
if (image.parsed.url && hasWidth(image.parsed)) {
|
|
114
|
+
dtos.push({
|
|
115
|
+
url: image.parsed.url,
|
|
116
|
+
image_width_size: image.parsed.width
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return dtos;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const compatItemLicenseDto = (parsedItem: Episode) => {
|
|
126
|
+
if (!parsedItem?.license?.identifier) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
identifier: parsedItem.license.identifier,
|
|
131
|
+
url: parsedItem.license.url || null
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const compatItemLocationDto = (parsedItem: Episode) => {
|
|
136
|
+
if (!parsedItem?.podcastLocation?.geo && !parsedItem?.podcastLocation?.osm) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
geo: parsedItem.podcastLocation.geo || null,
|
|
142
|
+
osm: parsedItem.podcastLocation.osm || null,
|
|
143
|
+
name: parsedItem.podcastLocation.name || null
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const compatItemPersonDtos = (parsedItem: Episode) => {
|
|
148
|
+
const dtos = [];
|
|
149
|
+
|
|
150
|
+
if (Array.isArray(parsedItem.podcastPeople)) {
|
|
151
|
+
for (const p of parsedItem.podcastPeople) {
|
|
152
|
+
if (p.name) {
|
|
153
|
+
dtos.push({
|
|
154
|
+
name: p.name,
|
|
155
|
+
role: p.role?.toLowerCase() || null,
|
|
156
|
+
person_group: p.group?.toLowerCase() || 'cast',
|
|
157
|
+
img: p.img || null,
|
|
158
|
+
href: p.href || null
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return dtos;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const compatItemSeasonDto = (parsedItem: Episode) => {
|
|
168
|
+
if (!parsedItem.podcastSeason?.number) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
number: parsedItem.podcastSeason.number,
|
|
174
|
+
title: parsedItem.podcastSeason.name || null
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const compatItemSeasonEpisodeDto = (parsedItem: Episode) => {
|
|
179
|
+
if (!parsedItem.podcastEpisode) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
display: parsedItem.podcastEpisode.display || null,
|
|
185
|
+
number: parsedItem.podcastEpisode.number
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const compatItemSocialInteractDtos = (parsedItem: Episode) => {
|
|
190
|
+
const dtos = [];
|
|
191
|
+
|
|
192
|
+
if (parsedItem?.podcastSocialInteraction?.length) {
|
|
193
|
+
for (const ps of parsedItem.podcastSocialInteraction) {
|
|
194
|
+
dtos.push({
|
|
195
|
+
// PTDO: fix keys mismatch between partytime and podverse
|
|
196
|
+
protocol: ps.platform,
|
|
197
|
+
uri: ps.url,
|
|
198
|
+
account_id: ps.id || null,
|
|
199
|
+
account_url: ps.profileUrl || null,
|
|
200
|
+
priority: ps.priority || null
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return dtos;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export const compatItemSoundbiteDtos = (parsedItem: Episode) => {
|
|
209
|
+
const dtos = [];
|
|
210
|
+
|
|
211
|
+
if (parsedItem?.podcastSoundbites?.length) {
|
|
212
|
+
for (const s of parsedItem.podcastSoundbites) {
|
|
213
|
+
dtos.push({
|
|
214
|
+
start_time: s.startTime.toFixed(2),
|
|
215
|
+
duration: s.duration.toFixed(2),
|
|
216
|
+
title: s.title || null
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return dtos;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const compatItemTranscriptDtos = (parsedItem: Episode) => {
|
|
225
|
+
const dtos = [];
|
|
226
|
+
|
|
227
|
+
if (parsedItem?.podcastTranscripts?.length) {
|
|
228
|
+
for (const t of parsedItem.podcastTranscripts) {
|
|
229
|
+
dtos.push({
|
|
230
|
+
url: t.url,
|
|
231
|
+
type: t.type,
|
|
232
|
+
language: t.language || null,
|
|
233
|
+
rel: t.rel || null
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return dtos;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export const compatItemTxtDtos = (parsedItem: Episode) => {
|
|
242
|
+
const dtos = [];
|
|
243
|
+
|
|
244
|
+
if (parsedItem?.podcastTxt?.length) {
|
|
245
|
+
for (const txt of parsedItem.podcastTxt) {
|
|
246
|
+
dtos.push({
|
|
247
|
+
purpose: txt.purpose || null,
|
|
248
|
+
value: txt.value
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return dtos;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export const compatItemValueDtos = (parsedItem: Episode) => {
|
|
257
|
+
let dtos = [];
|
|
258
|
+
if (parsedItem.value) {
|
|
259
|
+
const dto = compatItemValue(parsedItem.value);
|
|
260
|
+
const formattedDto = {
|
|
261
|
+
item_value: {
|
|
262
|
+
type: dto.type,
|
|
263
|
+
method: dto.method,
|
|
264
|
+
suggested: dto.suggested || null
|
|
265
|
+
},
|
|
266
|
+
item_value_recipients: dto.item_value_recipients,
|
|
267
|
+
item_value_time_splits: dto.item_value_time_splits
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
dtos.push(formattedDto);
|
|
271
|
+
}
|
|
272
|
+
return dtos;
|
|
273
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Phase4PodcastLiveItem } from "podcast-partytime/dist/parser/phase/phase-4";
|
|
2
|
+
import { getLiveItemStatusEnumValue, LiveItemStatusEnum } from "podverse-orm";
|
|
3
|
+
|
|
4
|
+
export const compatLiveItemsDtos = (parsedLiveItems: Phase4PodcastLiveItem[]) => {
|
|
5
|
+
const dtos = [];
|
|
6
|
+
for (const parsedLiveItem of parsedLiveItems) {
|
|
7
|
+
dtos.push({
|
|
8
|
+
liveItem: {
|
|
9
|
+
live_item_status: getLiveItemStatusEnumValue(parsedLiveItem.status) ?? LiveItemStatusEnum.Pending,
|
|
10
|
+
start_time: parsedLiveItem.start,
|
|
11
|
+
end_time: parsedLiveItem.end || null
|
|
12
|
+
},
|
|
13
|
+
item: parsedLiveItem
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return dtos;
|
|
18
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Phase4Value, Phase4ValueRecipient } from "podcast-partytime";
|
|
2
|
+
|
|
3
|
+
export const compatChannelValue = (value: Phase4Value) => {
|
|
4
|
+
return {
|
|
5
|
+
type: value.type,
|
|
6
|
+
method: value.method,
|
|
7
|
+
suggested: parseFloat(value.suggested ?? '0') || null,
|
|
8
|
+
channel_value_recipients: compatValueRecipients(value.recipients)
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const compatItemValue = (value: Phase4Value) => {
|
|
13
|
+
return {
|
|
14
|
+
type: value.type,
|
|
15
|
+
method: value.method,
|
|
16
|
+
suggested: parseFloat(value.suggested ?? '0') || null,
|
|
17
|
+
item_value_recipients: compatValueRecipients(value.recipients),
|
|
18
|
+
item_value_time_splits: value.valueTimeSplits?.map((valueTimeSplit) => {
|
|
19
|
+
if (valueTimeSplit.type === 'remoteItem') {
|
|
20
|
+
return {
|
|
21
|
+
meta: {
|
|
22
|
+
start_time: valueTimeSplit.startTime.toFixed(2),
|
|
23
|
+
duration: valueTimeSplit.duration.toFixed(2),
|
|
24
|
+
remote_start_time: valueTimeSplit.remoteStartTime?.toFixed(2) || (0).toFixed(2),
|
|
25
|
+
remote_percentage: valueTimeSplit.remotePercentage?.toFixed(2) || (100).toFixed(2),
|
|
26
|
+
},
|
|
27
|
+
item_value_time_splits_recipients: [],
|
|
28
|
+
item_value_time_splits_remote_item: valueTimeSplit.remoteItem ? {
|
|
29
|
+
feed_guid: valueTimeSplit.remoteItem.feedGuid,
|
|
30
|
+
feed_url: valueTimeSplit.remoteItem.feedUrl || null,
|
|
31
|
+
item_guid: valueTimeSplit.remoteItem.itemGuid || null,
|
|
32
|
+
title: /* PTDO: ri.title || */ null
|
|
33
|
+
} : null
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
36
|
+
// else: valueTimeSplit.type === 'recipients'
|
|
37
|
+
return {
|
|
38
|
+
meta: {
|
|
39
|
+
start_time: valueTimeSplit.startTime.toFixed(2),
|
|
40
|
+
duration: valueTimeSplit.duration.toFixed(2),
|
|
41
|
+
remote_start_time: (0).toFixed(2),
|
|
42
|
+
remote_percentage: (100).toFixed(2),
|
|
43
|
+
},
|
|
44
|
+
item_value_time_splits_recipients: compatValueRecipients(valueTimeSplit.recipients),
|
|
45
|
+
item_value_time_splits_remote_item: null
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}) || []
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const compatValueRecipients = (recipients: Phase4ValueRecipient[]) => {
|
|
53
|
+
return recipients.map((recipient) => {
|
|
54
|
+
return {
|
|
55
|
+
type: recipient.type,
|
|
56
|
+
address: recipient.address,
|
|
57
|
+
split: recipient.split,
|
|
58
|
+
name: recipient.name || null,
|
|
59
|
+
custom_key: recipient.customKey || null,
|
|
60
|
+
custom_value: recipient.customValue || null,
|
|
61
|
+
fee: recipient.fee || false
|
|
62
|
+
};
|
|
63
|
+
}) || [];
|
|
64
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Service<T, P> {
|
|
2
|
+
updateMany(parentEntity: P, dtos: Partial<T>[]): Promise<T[]>;
|
|
3
|
+
deleteAll(parentEntity: P): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const handleParsedManyData = async<T, P> (
|
|
7
|
+
parentEntity: P,
|
|
8
|
+
service: Service<T, P>,
|
|
9
|
+
dtos: Partial<T>[]
|
|
10
|
+
) => {
|
|
11
|
+
if (dtos.length > 0) {
|
|
12
|
+
await service.updateMany(parentEntity, dtos);
|
|
13
|
+
} else {
|
|
14
|
+
await service.deleteAll(parentEntity);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface Service<T, P> {
|
|
2
|
+
update(parentEntity: P, dto: Partial<T>): Promise<T>;
|
|
3
|
+
_delete?(parentEntity: P): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const handleParsedOneData = async <T, P>(
|
|
7
|
+
parentEntity: P,
|
|
8
|
+
service: Service<T, P>,
|
|
9
|
+
dto: Partial<T> | null
|
|
10
|
+
) => {
|
|
11
|
+
if (dto) {
|
|
12
|
+
await service.update(parentEntity, dto);
|
|
13
|
+
} else if (service._delete) {
|
|
14
|
+
await service._delete(parentEntity);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { AppDataSource, Channel, ChannelService, ChannelSeasonIndex } from "podverse-orm";
|
|
3
|
+
import { compatChannelDto } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedChannelAbout } from "@parser/lib/rss/channel/channelAbout";
|
|
5
|
+
import { handleParsedChannelChat } from "@parser/lib/rss/channel/channelChat";
|
|
6
|
+
import { handleParsedChannelDescription } from "@parser/lib/rss/channel/channelDescription";
|
|
7
|
+
import { handleParsedChannelFunding } from "@parser/lib/rss/channel/channelFunding";
|
|
8
|
+
import { handleParsedChannelImage } from "@parser/lib/rss/channel/channelImage";
|
|
9
|
+
import { handleParsedChannelLicense } from "@parser/lib/rss/channel/channelLicense";
|
|
10
|
+
import { handleParsedChannelLocation } from "@parser/lib/rss/channel/channelLocation";
|
|
11
|
+
import { handleParsedChannelPerson } from "@parser/lib/rss/channel/channelPerson";
|
|
12
|
+
import { handleParsedChannelPodroll } from "@parser/lib/rss/channel/channelPodroll";
|
|
13
|
+
import { handleParsedChannelRemoteItem } from "@parser/lib/rss/channel/channelRemoteItem";
|
|
14
|
+
import { handleParsedChannelSocialInteract } from "@parser/lib/rss/channel/channelSocialInteract";
|
|
15
|
+
import { handleParsedChannelTrailer } from "@parser/lib/rss/channel/channelTrailer";
|
|
16
|
+
import { handleParsedChannelTxt } from "@parser/lib/rss/channel/channelTxt";
|
|
17
|
+
import { handleParsedChannelValue } from "@parser/lib/rss/channel/channelValue";
|
|
18
|
+
|
|
19
|
+
export const handleParsedChannel = async (parsedFeed: FeedObject, channel: Channel, channelSeasonIndex: ChannelSeasonIndex) => {
|
|
20
|
+
const channelService = new ChannelService();
|
|
21
|
+
const channelDto = compatChannelDto(parsedFeed);
|
|
22
|
+
await channelService.update(channel.id, channelDto);
|
|
23
|
+
|
|
24
|
+
// TODO: add channelCategory support
|
|
25
|
+
|
|
26
|
+
await AppDataSource.manager.transaction(async transactionalEntityManager => {
|
|
27
|
+
await handleParsedChannelAbout(parsedFeed, channel, transactionalEntityManager);
|
|
28
|
+
await handleParsedChannelChat(parsedFeed, channel, transactionalEntityManager);
|
|
29
|
+
await handleParsedChannelDescription(parsedFeed, channel, transactionalEntityManager);
|
|
30
|
+
await handleParsedChannelFunding(parsedFeed, channel, transactionalEntityManager);
|
|
31
|
+
await handleParsedChannelImage(parsedFeed, channel, transactionalEntityManager);
|
|
32
|
+
await handleParsedChannelLicense(parsedFeed, channel, transactionalEntityManager);
|
|
33
|
+
await handleParsedChannelLocation(parsedFeed, channel, transactionalEntityManager);
|
|
34
|
+
await handleParsedChannelPerson(parsedFeed, channel, transactionalEntityManager);
|
|
35
|
+
await handleParsedChannelPodroll(parsedFeed, channel, transactionalEntityManager);
|
|
36
|
+
|
|
37
|
+
// PTDO: add channelPublisher support
|
|
38
|
+
// const channelPublisherService = new ChannelPublisherService();
|
|
39
|
+
// const channelPublisherRemoteItemService = new ChannelPublisherRemoteItemService();
|
|
40
|
+
|
|
41
|
+
// const channelPublisherRemoteItemDtos = compatChannelPublisherRemoteItemDtos(parsedFeed);
|
|
42
|
+
// if (channelPublisherRemoteItemDtos.length > 0) {
|
|
43
|
+
// const channel_publisher = await channelPublisherService.update(channel);
|
|
44
|
+
// await channelPublisherRemoteItemService.updateMany(channel_publisher, channelPodrollRemoteItemDtos);
|
|
45
|
+
// } else {
|
|
46
|
+
// await channelPublisherService.delete(channel);
|
|
47
|
+
// }
|
|
48
|
+
|
|
49
|
+
await handleParsedChannelRemoteItem(parsedFeed, channel, transactionalEntityManager);
|
|
50
|
+
await handleParsedChannelSocialInteract(parsedFeed, channel, transactionalEntityManager);
|
|
51
|
+
await handleParsedChannelTrailer(parsedFeed, channel, channelSeasonIndex, transactionalEntityManager);
|
|
52
|
+
await handleParsedChannelTxt(parsedFeed, channel, transactionalEntityManager);
|
|
53
|
+
await handleParsedChannelValue(parsedFeed, channel, transactionalEntityManager);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { ChannelAboutService, Channel, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelAboutDto } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
|
|
5
|
+
export const handleParsedChannelAbout = async (
|
|
6
|
+
parsedFeed: FeedObject,
|
|
7
|
+
channel: Channel,
|
|
8
|
+
transactionalEntityManager: EntityManager
|
|
9
|
+
) => {
|
|
10
|
+
const channelAboutService = new ChannelAboutService(transactionalEntityManager);
|
|
11
|
+
const channelAboutDto = compatChannelAboutDto(parsedFeed);
|
|
12
|
+
await channelAboutService.update(channel, channelAboutDto);
|
|
13
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelChatService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelChatDto } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedOneData } from "../base/handleParsedOneData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelChat = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelChatService = new ChannelChatService(transactionalEntityManager);
|
|
12
|
+
const channelChatDto = compatChannelChatDto(parsedFeed);
|
|
13
|
+
await handleParsedOneData(channel, channelChatService, channelChatDto);
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelDescriptionService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelDescriptionDto } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedOneData } from "../base/handleParsedOneData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelDescription = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelDescriptionService = new ChannelDescriptionService(transactionalEntityManager);
|
|
12
|
+
const channelDescriptionDto = compatChannelDescriptionDto(parsedFeed);
|
|
13
|
+
await handleParsedOneData(channel, channelDescriptionService, channelDescriptionDto);
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelFundingService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelFundingDtos } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedManyData } from "../base/handleParsedManyData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelFunding = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelFundingService = new ChannelFundingService(transactionalEntityManager);
|
|
12
|
+
const channelFundingDtos = compatChannelFundingDtos(parsedFeed);
|
|
13
|
+
await handleParsedManyData(channel, channelFundingService, channelFundingDtos);
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelImageService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelImageDtos } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedManyData } from "../base/handleParsedManyData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelImage = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelImageService = new ChannelImageService(transactionalEntityManager);
|
|
12
|
+
const channelImageDtos = compatChannelImageDtos(parsedFeed);
|
|
13
|
+
await handleParsedManyData(channel, channelImageService, channelImageDtos);
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelLicenseService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelLicenseDto } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedOneData } from "../base/handleParsedOneData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelLicense = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelLicenseService = new ChannelLicenseService(transactionalEntityManager);
|
|
12
|
+
const channelLicenseDtos = compatChannelLicenseDto(parsedFeed);
|
|
13
|
+
await handleParsedOneData(channel, channelLicenseService, channelLicenseDtos);
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelLocationService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelLocationDto } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedOneData } from "../base/handleParsedOneData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelLocation = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelLocationService = new ChannelLocationService(transactionalEntityManager);
|
|
12
|
+
const channelLocationDtos = compatChannelLocationDto(parsedFeed);
|
|
13
|
+
await handleParsedOneData(channel, channelLocationService, channelLocationDtos);
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelPersonService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelPersonDtos } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedManyData } from "../base/handleParsedManyData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelPerson = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelPersonService = new ChannelPersonService(transactionalEntityManager);
|
|
12
|
+
const channelPersonDtos = compatChannelPersonDtos(parsedFeed);
|
|
13
|
+
await handleParsedManyData(channel, channelPersonService, channelPersonDtos);
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelPodrollService, ChannelPodrollRemoteItemService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelPodrollRemoteItemDtos } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
|
|
5
|
+
export const handleParsedChannelPodroll = async (
|
|
6
|
+
parsedFeed: FeedObject,
|
|
7
|
+
channel: Channel,
|
|
8
|
+
transactionalEntityManager: EntityManager
|
|
9
|
+
) => {
|
|
10
|
+
const channelPodrollService = new ChannelPodrollService(transactionalEntityManager);
|
|
11
|
+
const channelPodrollDto = {};
|
|
12
|
+
const channelPodrollRemoteItemService = new ChannelPodrollRemoteItemService(transactionalEntityManager);
|
|
13
|
+
const channelPodrollRemoteItemDtos = compatChannelPodrollRemoteItemDtos(parsedFeed);
|
|
14
|
+
|
|
15
|
+
if (channelPodrollRemoteItemDtos.length > 0) {
|
|
16
|
+
const channel_podroll = await channelPodrollService.update(channel, channelPodrollDto);
|
|
17
|
+
await channelPodrollRemoteItemService.updateMany(channel_podroll, channelPodrollRemoteItemDtos);
|
|
18
|
+
} else {
|
|
19
|
+
await channelPodrollService.delete(channel);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelRemoteItemService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelRemoteItemDtos } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedManyData } from "../base/handleParsedManyData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelRemoteItem = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelRemoteItemService = new ChannelRemoteItemService(transactionalEntityManager);
|
|
12
|
+
const channelRemoteItemDtos = compatChannelRemoteItemDtos(parsedFeed);
|
|
13
|
+
await handleParsedManyData(channel, channelRemoteItemService, channelRemoteItemDtos);
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelSeasonService } from "podverse-orm";
|
|
3
|
+
import { compatChannelSeasonDtos } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
|
|
5
|
+
export const handleParsedChannelSeasons = async (parsedFeed: FeedObject, channel: Channel): Promise<void> => {
|
|
6
|
+
const channelSeasonService = new ChannelSeasonService();
|
|
7
|
+
const channelSeasonDtos = compatChannelSeasonDtos(parsedFeed);
|
|
8
|
+
|
|
9
|
+
if (channelSeasonDtos.length > 0) {
|
|
10
|
+
await channelSeasonService.updateMany(channel, channelSeasonDtos);
|
|
11
|
+
} else {
|
|
12
|
+
await channelSeasonService.deleteAll(channel);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelSocialInteractService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelSocialInteractDtos } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
import { handleParsedManyData } from "../base/handleParsedManyData";
|
|
5
|
+
|
|
6
|
+
export const handleParsedChannelSocialInteract = async (
|
|
7
|
+
parsedFeed: FeedObject,
|
|
8
|
+
channel: Channel,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelSocialInteractService = new ChannelSocialInteractService(transactionalEntityManager);
|
|
12
|
+
const channelSocialInteractDtos = compatChannelSocialInteractDtos(parsedFeed);
|
|
13
|
+
await handleParsedManyData(channel, channelSocialInteractService, channelSocialInteractDtos);
|
|
14
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FeedObject } from "podcast-partytime";
|
|
2
|
+
import { Channel, ChannelSeason, ChannelTrailerDto, ChannelTrailerService, EntityManager } from "podverse-orm";
|
|
3
|
+
import { compatChannelTrailerDtos } from "@parser/lib/compat/partytime/channel";
|
|
4
|
+
|
|
5
|
+
export const handleParsedChannelTrailer = async (
|
|
6
|
+
parsedFeed: FeedObject,
|
|
7
|
+
channel: Channel,
|
|
8
|
+
channelSeasonIndex: Record<number, ChannelSeason>,
|
|
9
|
+
transactionalEntityManager: EntityManager
|
|
10
|
+
) => {
|
|
11
|
+
const channelTrailerService = new ChannelTrailerService(transactionalEntityManager);
|
|
12
|
+
const channelTrailerDtos = compatChannelTrailerDtos(parsedFeed);
|
|
13
|
+
|
|
14
|
+
const enrichedChannelTrailerDtos: ChannelTrailerDto[] = channelTrailerDtos.map((channelTrailerDto) => {
|
|
15
|
+
const channel_season = channelTrailerDto.season ? channelSeasonIndex[channelTrailerDto.season] : null;
|
|
16
|
+
return {
|
|
17
|
+
url: channelTrailerDto.url,
|
|
18
|
+
pubdate: channelTrailerDto.pubdate,
|
|
19
|
+
title: channelTrailerDto.title,
|
|
20
|
+
length: channelTrailerDto.length,
|
|
21
|
+
type: channelTrailerDto.type,
|
|
22
|
+
channel_season
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (channelTrailerDtos.length > 0) {
|
|
27
|
+
await channelTrailerService.updateMany(channel, enrichedChannelTrailerDtos);
|
|
28
|
+
} else {
|
|
29
|
+
await channelTrailerService.deleteAll(channel);
|
|
30
|
+
}
|
|
31
|
+
};
|