podverse-parser 5.0.2 → 5.0.4
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/LICENSE +661 -0
- package/README.md +37 -0
- package/dist/lib/compat/partytime/channel.d.ts +5 -5
- package/dist/lib/compat/partytime/channel.d.ts.map +1 -1
- package/dist/lib/compat/partytime/channel.js +70 -55
- package/dist/lib/compat/partytime/item.d.ts +2 -2
- package/dist/lib/compat/partytime/item.d.ts.map +1 -1
- package/dist/lib/compat/partytime/item.js +67 -60
- package/dist/lib/compat/partytime/value.d.ts.map +1 -1
- package/dist/lib/compat/partytime/value.js +20 -18
- package/dist/lib/rss/feed/feed.d.ts.map +1 -1
- package/dist/lib/rss/parser.d.ts.map +1 -1
- package/dist/lib/rss/parser.js +7 -0
- package/package.json +2 -2
- package/dist/lib/compat/channel.d.ts +0 -108
- package/dist/lib/compat/channel.d.ts.map +0 -1
- package/dist/lib/compat/channel.js +0 -279
- package/dist/lib/compat/partytime/funding.d.ts +0 -6
- package/dist/lib/compat/partytime/funding.d.ts.map +0 -1
- package/dist/lib/compat/partytime/funding.js +0 -10
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compatItemValueDtos = exports.compatItemTxtDtos = exports.compatItemTranscriptDtos = exports.compatItemSoundbiteDtos = exports.compatItemSocialInteractDtos = exports.compatItemSeasonEpisodeDto = exports.compatItemSeasonDto = exports.compatItemPersonDtos = exports.compatItemLocationDto = exports.compatItemLicenseDto = exports.compatItemImageDtos = exports.compatItemEnclosureDtos = exports.compatItemDescriptionDto = exports.compatItemChatDto = exports.compatItemChaptersFeedDto = exports.compatItemAboutDto = exports.compatItemDto = void 0;
|
|
4
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
4
5
|
const podverse_orm_1 = require("podverse-orm");
|
|
5
6
|
const value_1 = require("./value");
|
|
6
|
-
const compatItemDto = (parsedItem) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const compatItemDto = (parsedItem) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
return ({
|
|
10
|
+
guid: ((_a = parsedItem.guid) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid)) || null,
|
|
11
|
+
guid_enclosure_url: parsedItem.enclosure.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
|
|
12
|
+
pubdate: parsedItem.pubDate || null,
|
|
13
|
+
title: ((_b = parsedItem.title) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
|
|
14
|
+
});
|
|
15
|
+
};
|
|
12
16
|
exports.compatItemDto = compatItemDto;
|
|
13
17
|
const compatItemAboutDto = (parsedItem) => {
|
|
14
|
-
var _a;
|
|
18
|
+
var _a, _b;
|
|
15
19
|
return ({
|
|
16
20
|
duration: ((_a = parsedItem.duration) === null || _a === void 0 ? void 0 : _a.toFixed(2)) || null,
|
|
17
21
|
explicit: parsedItem.explicit || false,
|
|
18
|
-
website_link_url: parsedItem.link || null,
|
|
22
|
+
website_link_url: ((_b = parsedItem.link) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
|
|
19
23
|
item_itunes_episode_type: (0, podverse_orm_1.getItemItunesEpisodeTypeEnumValue)(parsedItem.itunesEpisodeType || 'full')
|
|
20
24
|
});
|
|
21
25
|
};
|
|
@@ -25,20 +29,21 @@ const compatItemChaptersFeedDto = (parsedItem) => {
|
|
|
25
29
|
if (!((_a = parsedItem.podcastChapters) === null || _a === void 0 ? void 0 : _a.url) && !((_b = parsedItem.podcastChapters) === null || _b === void 0 ? void 0 : _b.type))
|
|
26
30
|
return null;
|
|
27
31
|
return {
|
|
28
|
-
url: (_c = parsedItem.podcastChapters) === null || _c === void 0 ? void 0 : _c.url,
|
|
29
|
-
type: (_d = parsedItem.podcastChapters) === null || _d === void 0 ? void 0 : _d.type
|
|
32
|
+
url: (_c = parsedItem.podcastChapters) === null || _c === void 0 ? void 0 : _c.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
|
|
33
|
+
type: (_d = parsedItem.podcastChapters) === null || _d === void 0 ? void 0 : _d.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)
|
|
30
34
|
};
|
|
31
35
|
};
|
|
32
36
|
exports.compatItemChaptersFeedDto = compatItemChaptersFeedDto;
|
|
33
37
|
const compatItemChatDto = (parsedItem) => {
|
|
38
|
+
var _a, _b;
|
|
34
39
|
if (!parsedItem.chat) {
|
|
35
40
|
return null;
|
|
36
41
|
}
|
|
37
42
|
return {
|
|
38
|
-
server: parsedItem.chat.server,
|
|
39
|
-
protocol: parsedItem.chat.protocol,
|
|
40
|
-
account_id: parsedItem.chat.accountId || null,
|
|
41
|
-
space: parsedItem.chat.space || null
|
|
43
|
+
server: parsedItem.chat.server.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_fqdn),
|
|
44
|
+
protocol: parsedItem.chat.protocol.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
45
|
+
account_id: ((_a = parsedItem.chat.accountId) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
46
|
+
space: ((_b = parsedItem.chat.space) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
|
|
42
47
|
};
|
|
43
48
|
};
|
|
44
49
|
exports.compatItemChatDto = compatItemChatDto;
|
|
@@ -47,23 +52,24 @@ const compatItemDescriptionDto = (parsedItem) => {
|
|
|
47
52
|
return null;
|
|
48
53
|
}
|
|
49
54
|
return {
|
|
50
|
-
value: parsedItem.description
|
|
55
|
+
value: parsedItem.description.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_long)
|
|
51
56
|
};
|
|
52
57
|
};
|
|
53
58
|
exports.compatItemDescriptionDto = compatItemDescriptionDto;
|
|
54
59
|
const compatItemEnclosureDtos = (parsedItem) => {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
55
61
|
const dtos = [];
|
|
56
62
|
if (parsedItem.alternativeEnclosures && parsedItem.alternativeEnclosures.length > 0) {
|
|
57
63
|
for (const alternativeEnclosure of parsedItem.alternativeEnclosures) {
|
|
58
64
|
const item_enclosure = {
|
|
59
|
-
type: alternativeEnclosure.type,
|
|
65
|
+
type: alternativeEnclosure.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
60
66
|
length: alternativeEnclosure.length || null,
|
|
61
67
|
bitrate: alternativeEnclosure.bitrate || null,
|
|
62
68
|
height: alternativeEnclosure.height || null,
|
|
63
|
-
language: alternativeEnclosure.lang || null,
|
|
64
|
-
title: alternativeEnclosure.title || null,
|
|
65
|
-
rel: alternativeEnclosure.rel || null,
|
|
66
|
-
codecs: alternativeEnclosure.codecs || null,
|
|
69
|
+
language: ((_a = alternativeEnclosure.lang) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
|
|
70
|
+
title: ((_b = alternativeEnclosure.title) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
|
|
71
|
+
rel: ((_c = alternativeEnclosure.rel) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
|
|
72
|
+
codecs: ((_d = alternativeEnclosure.codecs) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
|
|
67
73
|
item_enclosure_default: false
|
|
68
74
|
};
|
|
69
75
|
/*
|
|
@@ -74,8 +80,8 @@ const compatItemEnclosureDtos = (parsedItem) => {
|
|
|
74
80
|
*/
|
|
75
81
|
const item_enclosure_integrity = alternativeEnclosure.integrity || null;
|
|
76
82
|
const item_enclosure_sources = alternativeEnclosure.source.map(source => ({
|
|
77
|
-
uri: source.uri,
|
|
78
|
-
content_type: source.contentType
|
|
83
|
+
uri: source.uri.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_uri),
|
|
84
|
+
content_type: source.contentType.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)
|
|
79
85
|
}));
|
|
80
86
|
const formattedDto = {
|
|
81
87
|
item_enclosure,
|
|
@@ -92,13 +98,13 @@ const compatItemImageDtos = (parsedItem) => {
|
|
|
92
98
|
const dtos = [];
|
|
93
99
|
if (parsedItem.itunesImage) {
|
|
94
100
|
dtos.push({
|
|
95
|
-
url: parsedItem.itunesImage,
|
|
101
|
+
url: parsedItem.itunesImage.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
|
|
96
102
|
image_width_size: null
|
|
97
103
|
});
|
|
98
104
|
}
|
|
99
105
|
else if (parsedItem.image) {
|
|
100
106
|
dtos.push({
|
|
101
|
-
url: parsedItem.image,
|
|
107
|
+
url: parsedItem.image.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
|
|
102
108
|
image_width_size: null
|
|
103
109
|
});
|
|
104
110
|
}
|
|
@@ -109,7 +115,7 @@ const compatItemImageDtos = (parsedItem) => {
|
|
|
109
115
|
for (const image of parsedItem.podcastImages) {
|
|
110
116
|
if (image.parsed.url && hasWidth(image.parsed)) {
|
|
111
117
|
dtos.push({
|
|
112
|
-
url: image.parsed.url,
|
|
118
|
+
url: image.parsed.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
|
|
113
119
|
image_width_size: image.parsed.width
|
|
114
120
|
});
|
|
115
121
|
}
|
|
@@ -119,40 +125,40 @@ const compatItemImageDtos = (parsedItem) => {
|
|
|
119
125
|
};
|
|
120
126
|
exports.compatItemImageDtos = compatItemImageDtos;
|
|
121
127
|
const compatItemLicenseDto = (parsedItem) => {
|
|
122
|
-
var _a;
|
|
128
|
+
var _a, _b;
|
|
123
129
|
if (!((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.license) === null || _a === void 0 ? void 0 : _a.identifier)) {
|
|
124
130
|
return null;
|
|
125
131
|
}
|
|
126
132
|
return {
|
|
127
|
-
identifier: parsedItem.license.identifier,
|
|
128
|
-
url: parsedItem.license.url || null
|
|
133
|
+
identifier: parsedItem.license.identifier.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal),
|
|
134
|
+
url: ((_b = parsedItem.license.url) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
|
|
129
135
|
};
|
|
130
136
|
};
|
|
131
137
|
exports.compatItemLicenseDto = compatItemLicenseDto;
|
|
132
138
|
const compatItemLocationDto = (parsedItem) => {
|
|
133
|
-
var _a, _b;
|
|
139
|
+
var _a, _b, _c, _d, _e;
|
|
134
140
|
if (!((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastLocation) === null || _a === void 0 ? void 0 : _a.geo) && !((_b = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastLocation) === null || _b === void 0 ? void 0 : _b.osm)) {
|
|
135
141
|
return null;
|
|
136
142
|
}
|
|
137
143
|
return {
|
|
138
|
-
geo: parsedItem.podcastLocation.geo || null,
|
|
139
|
-
osm: parsedItem.podcastLocation.osm || null,
|
|
140
|
-
name: parsedItem.podcastLocation.name || null
|
|
144
|
+
geo: ((_c = parsedItem.podcastLocation.geo) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
145
|
+
osm: ((_d = parsedItem.podcastLocation.osm) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
146
|
+
name: ((_e = parsedItem.podcastLocation.name) === null || _e === void 0 ? void 0 : _e.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
|
|
141
147
|
};
|
|
142
148
|
};
|
|
143
149
|
exports.compatItemLocationDto = compatItemLocationDto;
|
|
144
150
|
const compatItemPersonDtos = (parsedItem) => {
|
|
145
|
-
var _a, _b;
|
|
151
|
+
var _a, _b, _c, _d, _e, _f;
|
|
146
152
|
const dtos = [];
|
|
147
153
|
if (Array.isArray(parsedItem.podcastPeople)) {
|
|
148
154
|
for (const p of parsedItem.podcastPeople) {
|
|
149
155
|
if (p.name) {
|
|
150
156
|
dtos.push({
|
|
151
|
-
name: p.name,
|
|
152
|
-
role: ((_a = p.role) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || null,
|
|
153
|
-
person_group: ((
|
|
154
|
-
img: p.img || null,
|
|
155
|
-
href: p.href || null
|
|
157
|
+
name: p.name.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal),
|
|
158
|
+
role: ((_b = (_a = p.role) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
159
|
+
person_group: ((_d = (_c = p.group) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || 'cast',
|
|
160
|
+
img: ((_e = p.img) === null || _e === void 0 ? void 0 : _e.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
|
|
161
|
+
href: ((_f = p.href) === null || _f === void 0 ? void 0 : _f.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null
|
|
156
162
|
});
|
|
157
163
|
}
|
|
158
164
|
}
|
|
@@ -161,37 +167,38 @@ const compatItemPersonDtos = (parsedItem) => {
|
|
|
161
167
|
};
|
|
162
168
|
exports.compatItemPersonDtos = compatItemPersonDtos;
|
|
163
169
|
const compatItemSeasonDto = (parsedItem) => {
|
|
164
|
-
var _a;
|
|
170
|
+
var _a, _b;
|
|
165
171
|
if (!((_a = parsedItem.podcastSeason) === null || _a === void 0 ? void 0 : _a.number)) {
|
|
166
172
|
return null;
|
|
167
173
|
}
|
|
168
174
|
return {
|
|
169
175
|
number: parsedItem.podcastSeason.number,
|
|
170
|
-
title: parsedItem.podcastSeason.name || null
|
|
176
|
+
title: ((_b = parsedItem.podcastSeason.name) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
|
|
171
177
|
};
|
|
172
178
|
};
|
|
173
179
|
exports.compatItemSeasonDto = compatItemSeasonDto;
|
|
174
180
|
const compatItemSeasonEpisodeDto = (parsedItem) => {
|
|
181
|
+
var _a;
|
|
175
182
|
if (!parsedItem.podcastEpisode) {
|
|
176
183
|
return null;
|
|
177
184
|
}
|
|
178
185
|
return {
|
|
179
|
-
display: parsedItem.podcastEpisode.display || null,
|
|
186
|
+
display: ((_a = parsedItem.podcastEpisode.display) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
|
|
180
187
|
number: parsedItem.podcastEpisode.number
|
|
181
188
|
};
|
|
182
189
|
};
|
|
183
190
|
exports.compatItemSeasonEpisodeDto = compatItemSeasonEpisodeDto;
|
|
184
191
|
const compatItemSocialInteractDtos = (parsedItem) => {
|
|
185
|
-
var _a;
|
|
192
|
+
var _a, _b, _c;
|
|
186
193
|
const dtos = [];
|
|
187
194
|
if ((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastSocialInteraction) === null || _a === void 0 ? void 0 : _a.length) {
|
|
188
195
|
for (const ps of parsedItem.podcastSocialInteraction) {
|
|
189
196
|
dtos.push({
|
|
190
197
|
// PTDO: fix keys mismatch between partytime and podverse
|
|
191
|
-
protocol: ps.platform,
|
|
192
|
-
uri: ps.url,
|
|
193
|
-
account_id: ps.id || null,
|
|
194
|
-
account_url: ps.profileUrl || null,
|
|
198
|
+
protocol: ps.platform.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
199
|
+
uri: ps.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_uri),
|
|
200
|
+
account_id: ((_b = ps.id) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
201
|
+
account_url: ((_c = ps.profileUrl) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url)) || null,
|
|
195
202
|
priority: ps.priority || null
|
|
196
203
|
});
|
|
197
204
|
}
|
|
@@ -200,14 +207,14 @@ const compatItemSocialInteractDtos = (parsedItem) => {
|
|
|
200
207
|
};
|
|
201
208
|
exports.compatItemSocialInteractDtos = compatItemSocialInteractDtos;
|
|
202
209
|
const compatItemSoundbiteDtos = (parsedItem) => {
|
|
203
|
-
var _a;
|
|
210
|
+
var _a, _b;
|
|
204
211
|
const dtos = [];
|
|
205
212
|
if ((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastSoundbites) === null || _a === void 0 ? void 0 : _a.length) {
|
|
206
213
|
for (const s of parsedItem.podcastSoundbites) {
|
|
207
214
|
dtos.push({
|
|
208
|
-
start_time: s.startTime
|
|
209
|
-
duration: s.duration
|
|
210
|
-
title: s.title || null
|
|
215
|
+
start_time: podverse_helpers_1.DATABASE_CONSTANTS.getMediaPlayerNumeric(s.startTime),
|
|
216
|
+
duration: podverse_helpers_1.DATABASE_CONSTANTS.getMediaPlayerNumeric(s.duration),
|
|
217
|
+
title: ((_b = s.title) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null
|
|
211
218
|
});
|
|
212
219
|
}
|
|
213
220
|
}
|
|
@@ -215,15 +222,15 @@ const compatItemSoundbiteDtos = (parsedItem) => {
|
|
|
215
222
|
};
|
|
216
223
|
exports.compatItemSoundbiteDtos = compatItemSoundbiteDtos;
|
|
217
224
|
const compatItemTranscriptDtos = (parsedItem) => {
|
|
218
|
-
var _a;
|
|
225
|
+
var _a, _b, _c;
|
|
219
226
|
const dtos = [];
|
|
220
227
|
if ((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastTranscripts) === null || _a === void 0 ? void 0 : _a.length) {
|
|
221
228
|
for (const t of parsedItem.podcastTranscripts) {
|
|
222
229
|
dtos.push({
|
|
223
|
-
url: t.url,
|
|
224
|
-
type: t.type,
|
|
225
|
-
language: t.language || null,
|
|
226
|
-
rel: t.rel || null
|
|
230
|
+
url: t.url.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
|
|
231
|
+
type: t.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
232
|
+
language: ((_b = t.language) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
|
|
233
|
+
rel: ((_c = t.rel) === null || _c === void 0 ? void 0 : _c.slice(0, 50)) || null
|
|
227
234
|
});
|
|
228
235
|
}
|
|
229
236
|
}
|
|
@@ -231,13 +238,13 @@ const compatItemTranscriptDtos = (parsedItem) => {
|
|
|
231
238
|
};
|
|
232
239
|
exports.compatItemTranscriptDtos = compatItemTranscriptDtos;
|
|
233
240
|
const compatItemTxtDtos = (parsedItem) => {
|
|
234
|
-
var _a;
|
|
241
|
+
var _a, _b;
|
|
235
242
|
const dtos = [];
|
|
236
243
|
if ((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastTxt) === null || _a === void 0 ? void 0 : _a.length) {
|
|
237
244
|
for (const txt of parsedItem.podcastTxt) {
|
|
238
245
|
dtos.push({
|
|
239
|
-
purpose: txt.purpose || null,
|
|
240
|
-
value: txt.value
|
|
246
|
+
purpose: ((_b = txt.purpose) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
247
|
+
value: txt.value.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_long)
|
|
241
248
|
});
|
|
242
249
|
}
|
|
243
250
|
}
|
|
@@ -250,8 +257,8 @@ const compatItemValueDtos = (parsedItem) => {
|
|
|
250
257
|
const dto = (0, value_1.compatItemValue)(parsedItem.value);
|
|
251
258
|
const formattedDto = {
|
|
252
259
|
item_value: {
|
|
253
|
-
type: dto.type,
|
|
254
|
-
method: dto.method,
|
|
260
|
+
type: dto.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
261
|
+
method: dto.method.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
255
262
|
suggested: dto.suggested || null
|
|
256
263
|
},
|
|
257
264
|
item_value_recipients: dto.item_value_recipients,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAGtE,eAAO,MAAM,kBAAkB,UAAW,WAAW;;;;;;;;;;;;;CAOpD,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCjD,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compatItemValue = exports.compatChannelValue = void 0;
|
|
4
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
4
5
|
const compatChannelValue = (value) => {
|
|
5
6
|
var _a;
|
|
6
7
|
return {
|
|
7
|
-
type: value.type,
|
|
8
|
-
method: value.method,
|
|
8
|
+
type: value.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
9
|
+
method: value.method.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
9
10
|
suggested: parseFloat((_a = value.suggested) !== null && _a !== void 0 ? _a : '0') || null,
|
|
10
11
|
channel_value_recipients: compatValueRecipients(value.recipients)
|
|
11
12
|
};
|
|
@@ -14,8 +15,8 @@ exports.compatChannelValue = compatChannelValue;
|
|
|
14
15
|
const compatItemValue = (value) => {
|
|
15
16
|
var _a, _b;
|
|
16
17
|
return {
|
|
17
|
-
type: value.type,
|
|
18
|
-
method: value.method,
|
|
18
|
+
type: value.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
19
|
+
method: value.method.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_long),
|
|
19
20
|
suggested: parseFloat((_a = value.suggested) !== null && _a !== void 0 ? _a : '0') || null,
|
|
20
21
|
item_value_recipients: compatValueRecipients(value.recipients),
|
|
21
22
|
item_value_time_splits: ((_b = value.valueTimeSplits) === null || _b === void 0 ? void 0 : _b.map((valueTimeSplit) => {
|
|
@@ -23,16 +24,16 @@ const compatItemValue = (value) => {
|
|
|
23
24
|
if (valueTimeSplit.type === 'remoteItem') {
|
|
24
25
|
return {
|
|
25
26
|
meta: {
|
|
26
|
-
start_time: valueTimeSplit.startTime
|
|
27
|
-
duration: valueTimeSplit.duration
|
|
28
|
-
remote_start_time: (
|
|
29
|
-
remote_percentage: (
|
|
27
|
+
start_time: podverse_helpers_1.DATABASE_CONSTANTS.getMediaPlayerNumeric(valueTimeSplit.startTime),
|
|
28
|
+
duration: podverse_helpers_1.DATABASE_CONSTANTS.getMediaPlayerNumeric(valueTimeSplit.duration),
|
|
29
|
+
remote_start_time: podverse_helpers_1.DATABASE_CONSTANTS.getMediaPlayerNumeric(valueTimeSplit.remoteStartTime) || (0).toFixed(2),
|
|
30
|
+
remote_percentage: podverse_helpers_1.DATABASE_CONSTANTS.getMediaPlayerNumeric(valueTimeSplit.remotePercentage) || (100).toFixed(2),
|
|
30
31
|
},
|
|
31
32
|
item_value_time_splits_recipients: [],
|
|
32
33
|
item_value_time_splits_remote_item: valueTimeSplit.remoteItem ? {
|
|
33
|
-
feed_guid: valueTimeSplit.remoteItem.feedGuid,
|
|
34
|
-
feed_url: valueTimeSplit.remoteItem.feedUrl || null,
|
|
35
|
-
item_guid: valueTimeSplit.remoteItem.itemGuid || null,
|
|
34
|
+
feed_guid: valueTimeSplit.remoteItem.feedGuid.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_url),
|
|
35
|
+
feed_url: ((_a = valueTimeSplit.remoteItem.feedUrl) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_uri)) || null,
|
|
36
|
+
item_guid: ((_b = valueTimeSplit.remoteItem.itemGuid) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
36
37
|
title: /* PTDO: ri.title || */ null
|
|
37
38
|
} : null
|
|
38
39
|
};
|
|
@@ -41,8 +42,8 @@ const compatItemValue = (value) => {
|
|
|
41
42
|
// else: valueTimeSplit.type === 'recipients'
|
|
42
43
|
return {
|
|
43
44
|
meta: {
|
|
44
|
-
start_time: valueTimeSplit.startTime
|
|
45
|
-
duration: valueTimeSplit.duration
|
|
45
|
+
start_time: podverse_helpers_1.DATABASE_CONSTANTS.getMediaPlayerNumeric(valueTimeSplit.startTime),
|
|
46
|
+
duration: podverse_helpers_1.DATABASE_CONSTANTS.getMediaPlayerNumeric(valueTimeSplit.duration),
|
|
46
47
|
remote_start_time: (0).toFixed(2),
|
|
47
48
|
remote_percentage: (100).toFixed(2),
|
|
48
49
|
},
|
|
@@ -56,13 +57,14 @@ const compatItemValue = (value) => {
|
|
|
56
57
|
exports.compatItemValue = compatItemValue;
|
|
57
58
|
const compatValueRecipients = (recipients) => {
|
|
58
59
|
return recipients.map((recipient) => {
|
|
60
|
+
var _a, _b, _c;
|
|
59
61
|
return {
|
|
60
|
-
type: recipient.type,
|
|
61
|
-
address: recipient.address,
|
|
62
|
+
type: recipient.type.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short),
|
|
63
|
+
address: recipient.address.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_long),
|
|
62
64
|
split: recipient.split,
|
|
63
|
-
name: recipient.name || null,
|
|
64
|
-
custom_key: recipient.customKey || null,
|
|
65
|
-
custom_value: recipient.customValue || null,
|
|
65
|
+
name: ((_a = recipient.name) === null || _a === void 0 ? void 0 : _a.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
66
|
+
custom_key: ((_b = recipient.customKey) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_long)) || null,
|
|
67
|
+
custom_value: ((_c = recipient.customValue) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_long)) || null,
|
|
66
68
|
fee: recipient.fee || false
|
|
67
69
|
};
|
|
68
70
|
}) || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/feed/feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAoC,IAAI,EAA+B,MAAM,cAAc,CAAC;AAInG,eAAO,MAAM,gBAAgB,SAAgB,IAAI,KAAG,OAAO,CAAC,UAAU,CAmCrE,CAAC;AAEF,eAAO,MAAM,gBAAgB,eAAsB,UAAU,QAAQ,IAAI,KAAG,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/feed/feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAoC,IAAI,EAA+B,MAAM,cAAc,CAAC;AAInG,eAAO,MAAM,gBAAgB,SAAgB,IAAI,KAAG,OAAO,CAAC,UAAU,CAmCrE,CAAC;AAEF,eAAO,MAAM,gBAAgB,eAAsB,UAAU,QAAQ,IAAI,KAAG,OAAO,CAAC,IAAI,CAiBvF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB,oBAM5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAe,MAAM,oDASnD,CAAC;AAQF,eAAO,MAAM,6BAA6B,QAAe,MAAM,oBAAoB,MAAM,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/rss/parser.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB,oBAM5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAe,MAAM,oDASnD,CAAC;AAQF,eAAO,MAAM,6BAA6B,QAAe,MAAM,oBAAoB,MAAM,iBAiExF,CAAC"}
|
package/dist/lib/rss/parser.js
CHANGED
|
@@ -47,6 +47,7 @@ exports.getAndParseRSSFeed = getAndParseRSSFeed;
|
|
|
47
47
|
// return compatData;
|
|
48
48
|
// };
|
|
49
49
|
const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
podverse_helpers_1.logger.info(`parseRSSFeedAndSaveToDatabase ${url} ${podcast_index_id}`);
|
|
50
51
|
const feedService = new podverse_orm_1.FeedService();
|
|
51
52
|
let feed = yield feedService.getByUrlAndPodcastIndexId({ url, podcast_index_id });
|
|
52
53
|
if (!feed) {
|
|
@@ -87,6 +88,12 @@ const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id) => __awaiter(void
|
|
|
87
88
|
const feedLogService = new podverse_orm_1.FeedLogService();
|
|
88
89
|
yield feedLogService.update(feed, { last_finished_parse_time: new Date() });
|
|
89
90
|
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
podverse_helpers_1.logger.error('parseRSSFeedAndSaveToDatabase error');
|
|
93
|
+
podverse_helpers_1.logger.error('podcast_index_id:', podcast_index_id);
|
|
94
|
+
podverse_helpers_1.logger.error('url:', url);
|
|
95
|
+
podverse_helpers_1.logger.error(error);
|
|
96
|
+
}
|
|
90
97
|
finally {
|
|
91
98
|
yield feedService.update(feed.id, { is_parsing: null });
|
|
92
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podverse-parser",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dist/**/*"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"
|
|
11
|
+
"build:watch": "nodemon --watch 'src' --watch $(realpath node_modules/podverse-helpers) --watch $(realpath node_modules/podverse-orm) --delay 500ms -x \"npm run build\"",
|
|
12
12
|
"build": "tsc",
|
|
13
13
|
"lint": "eslint ./src --ext .ts",
|
|
14
14
|
"prepare": "npm run build",
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { FeedObject } from "podcast-partytime";
|
|
2
|
-
export declare const compatChannelDto: (parsedFeed: FeedObject) => {
|
|
3
|
-
podcast_guid: string | undefined;
|
|
4
|
-
title: string;
|
|
5
|
-
sortable_title: string;
|
|
6
|
-
medium: import("podverse-orm").MediumEnum | null;
|
|
7
|
-
};
|
|
8
|
-
export declare const compatChannelAboutDto: (parsedFeed: FeedObject) => {
|
|
9
|
-
author: string | null;
|
|
10
|
-
explicit: boolean | null;
|
|
11
|
-
language: string | null;
|
|
12
|
-
website_link_url: string | null;
|
|
13
|
-
itunes_type: import("podverse-orm").ChannelItunesTypeItunesTypeEnum;
|
|
14
|
-
};
|
|
15
|
-
export declare const compatChannelChatDto: (parsedFeed: FeedObject) => {
|
|
16
|
-
server: string;
|
|
17
|
-
protocol: string;
|
|
18
|
-
account_id: string | null;
|
|
19
|
-
space: string | null;
|
|
20
|
-
} | null;
|
|
21
|
-
export declare const compatChannelDescriptionDto: (parsedFeed: FeedObject) => {
|
|
22
|
-
value: string;
|
|
23
|
-
} | null;
|
|
24
|
-
export declare const compatChannelFundingDtos: (parsedFeed: FeedObject) => {
|
|
25
|
-
url: string;
|
|
26
|
-
title: string | null;
|
|
27
|
-
}[];
|
|
28
|
-
export declare const compatChannelImageDtos: (parsedFeed: FeedObject) => ({
|
|
29
|
-
url: string;
|
|
30
|
-
image_width_size: null;
|
|
31
|
-
} | {
|
|
32
|
-
url: string;
|
|
33
|
-
image_width_size: number;
|
|
34
|
-
})[];
|
|
35
|
-
export declare const compatChannelLicenseDto: (parsedFeed: FeedObject) => {
|
|
36
|
-
identifier: string;
|
|
37
|
-
url: string | null;
|
|
38
|
-
} | null;
|
|
39
|
-
export declare const compatChannelLocationDto: (parsedFeed: FeedObject) => {
|
|
40
|
-
geo: string | null;
|
|
41
|
-
osm: string | null;
|
|
42
|
-
name: string | null;
|
|
43
|
-
} | null;
|
|
44
|
-
export declare const compatChannelPersonDtos: (parsedFeed: FeedObject) => {
|
|
45
|
-
name: string;
|
|
46
|
-
role: string | null;
|
|
47
|
-
person_group: string;
|
|
48
|
-
img: string | null;
|
|
49
|
-
href: string | null;
|
|
50
|
-
}[];
|
|
51
|
-
export declare const compatChannelPodrollRemoteItemDtos: (parsedFeed: FeedObject) => {
|
|
52
|
-
feed_guid: string;
|
|
53
|
-
feed_url: string | null;
|
|
54
|
-
item_guid: null;
|
|
55
|
-
title: null;
|
|
56
|
-
}[];
|
|
57
|
-
export declare const compatChannelPublisherRemoteItemDtos: (parsedFeed: FeedObject) => {
|
|
58
|
-
feed_guid: string;
|
|
59
|
-
feed_url: string | null;
|
|
60
|
-
item_guid: null;
|
|
61
|
-
title: null;
|
|
62
|
-
}[];
|
|
63
|
-
export declare const compatChannelRemoteItemDtos: (parsedFeed: FeedObject) => {
|
|
64
|
-
feed_guid: string;
|
|
65
|
-
feed_url: string | null;
|
|
66
|
-
item_guid: null;
|
|
67
|
-
title: null;
|
|
68
|
-
}[];
|
|
69
|
-
export declare const compatChannelSocialInteractDtos: (parsedFeed: FeedObject) => {
|
|
70
|
-
protocol: string;
|
|
71
|
-
uri: string;
|
|
72
|
-
account_id: string | null;
|
|
73
|
-
account_url: string | null;
|
|
74
|
-
priority: number | null;
|
|
75
|
-
}[];
|
|
76
|
-
export declare const compatChannelSeasonDtos: (parsedFeed: FeedObject) => {
|
|
77
|
-
number: number;
|
|
78
|
-
name: string | null;
|
|
79
|
-
}[];
|
|
80
|
-
export declare const compatChannelTrailerDtos: (parsedFeed: FeedObject) => {
|
|
81
|
-
url: string;
|
|
82
|
-
title: null;
|
|
83
|
-
pubdate: Date;
|
|
84
|
-
length: number | null;
|
|
85
|
-
type: string | null;
|
|
86
|
-
season: number | null;
|
|
87
|
-
}[];
|
|
88
|
-
export declare const compatChannelTxtDtos: (parsedFeed: FeedObject) => {
|
|
89
|
-
purpose: string | null;
|
|
90
|
-
value: string;
|
|
91
|
-
}[];
|
|
92
|
-
export declare const compatChannelValueDtos: (parsedFeed: FeedObject) => {
|
|
93
|
-
channel_value: {
|
|
94
|
-
type: string;
|
|
95
|
-
method: string;
|
|
96
|
-
suggested: number | null;
|
|
97
|
-
};
|
|
98
|
-
channel_value_recipients: {
|
|
99
|
-
type: string;
|
|
100
|
-
address: string;
|
|
101
|
-
split: number;
|
|
102
|
-
name: string | null;
|
|
103
|
-
custom_key: string | null;
|
|
104
|
-
custom_value: string | null;
|
|
105
|
-
fee: boolean;
|
|
106
|
-
}[];
|
|
107
|
-
}[];
|
|
108
|
-
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../src/lib/compat/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,mBAAmB,CAAC;AAM7D,eAAO,MAAM,gBAAgB,eAAgB,UAAU;;;;;CAKrD,CAAC;AAEH,eAAO,MAAM,qBAAqB,eAAgB,UAAU;;;;;;CAM1D,CAAC;AAEH,eAAO,MAAM,oBAAoB,eAAgB,UAAU;;;;;QAU1D,CAAC;AAEF,eAAO,MAAM,2BAA2B,eAAgB,UAAU;;QAOjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,UAAU;;;GAe9D,CAAC;AAEF,eAAO,MAAM,sBAAsB,eAAgB,UAAU;;;;;;IA8B5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,UAAU;;;QAQ7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,UAAU;;;;QAU9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,UAAU;;;;;;GAkB7D,CAAC;AAEF,eAAO,MAAM,kCAAkC,eAAgB,UAAU;;;;;GAiBxE,CAAC;AAEF,eAAO,MAAM,oCAAoC,eAAgB,UAAU;;;;;GAiB1E,CAAC;AAEF,eAAO,MAAM,2BAA2B,eAAgB,UAAU;;;;;GAiBjE,CAAC;AAEF,eAAO,MAAM,+BAA+B,eAAgB,UAAU;;;;;;GAiBrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,UAAU;;;GA0B7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,UAAU;;;;;;;GAgB9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,eAAgB,UAAU;;;GAY1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,eAAgB,UAAU;;;;;;;;;;;;;;;GAiB5D,CAAC"}
|