podverse-parser 5.0.0-beta.1 → 5.0.0-beta.3
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/{src/index.ts → dist/index.d.ts} +1 -1
- package/dist/index.d.ts.map +1 -0
- 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/package.json +4 -1
- package/.nvmrc +0 -1
- package/eslint.config.mjs +0 -38
- package/src/lib/chapters/chapters.ts +0 -54
- package/src/lib/compat/channel.ts +0 -287
- package/src/lib/compat/chapters/chapters.ts +0 -23
- package/src/lib/compat/partytime/channel.ts +0 -289
- package/src/lib/compat/partytime/compatFull.ts +0 -7
- package/src/lib/compat/partytime/funding.ts +0 -8
- package/src/lib/compat/partytime/item.ts +0 -273
- package/src/lib/compat/partytime/liveItem.ts +0 -18
- package/src/lib/compat/partytime/value.ts +0 -64
- package/src/lib/rss/base/handleParsedManyData.ts +0 -16
- package/src/lib/rss/base/handleParsedOneData.ts +0 -17
- package/src/lib/rss/channel/channel.ts +0 -55
- package/src/lib/rss/channel/channelAbout.ts +0 -13
- package/src/lib/rss/channel/channelChat.ts +0 -14
- package/src/lib/rss/channel/channelDescription.ts +0 -14
- package/src/lib/rss/channel/channelFunding.ts +0 -14
- package/src/lib/rss/channel/channelImage.ts +0 -14
- package/src/lib/rss/channel/channelLicense.ts +0 -14
- package/src/lib/rss/channel/channelLocation.ts +0 -14
- package/src/lib/rss/channel/channelPerson.ts +0 -14
- package/src/lib/rss/channel/channelPodroll.ts +0 -21
- package/src/lib/rss/channel/channelRemoteItem.ts +0 -14
- package/src/lib/rss/channel/channelSeason.ts +0 -14
- package/src/lib/rss/channel/channelSocialInteract.ts +0 -14
- package/src/lib/rss/channel/channelTrailer.ts +0 -31
- package/src/lib/rss/channel/channelTxt.ts +0 -14
- package/src/lib/rss/channel/channelValue.ts +0 -30
- package/src/lib/rss/feed/feed.ts +0 -79
- package/src/lib/rss/hash/parsedFeed.ts +0 -9
- package/src/lib/rss/item/item.ts +0 -85
- package/src/lib/rss/item/itemAbout.ts +0 -13
- package/src/lib/rss/item/itemChaptersFeed.ts +0 -14
- package/src/lib/rss/item/itemChat.ts +0 -14
- package/src/lib/rss/item/itemContentLink.ts +0 -0
- package/src/lib/rss/item/itemDescription.ts +0 -14
- package/src/lib/rss/item/itemEnclosure.ts +0 -35
- package/src/lib/rss/item/itemImage.ts +0 -14
- package/src/lib/rss/item/itemLicense.ts +0 -14
- package/src/lib/rss/item/itemLocation.ts +0 -14
- package/src/lib/rss/item/itemPerson.ts +0 -14
- package/src/lib/rss/item/itemSeason.ts +0 -26
- package/src/lib/rss/item/itemSeasonEpisode.ts +0 -14
- package/src/lib/rss/item/itemSocialInteract.ts +0 -14
- package/src/lib/rss/item/itemSoundbite.ts +0 -14
- package/src/lib/rss/item/itemTranscript.ts +0 -14
- package/src/lib/rss/item/itemTxt.ts +0 -14
- package/src/lib/rss/item/itemValue.ts +0 -60
- package/src/lib/rss/liveItem/liveItem.ts +0 -34
- package/src/lib/rss/parser.ts +0 -85
- package/src/module-alias-config.ts +0 -8
- package/tsconfig.json +0 -25
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.handleParsedItemTxt = void 0;
|
|
13
|
+
const podverse_orm_1 = require("podverse-orm");
|
|
14
|
+
const item_1 = require("@parser/lib/compat/partytime/item");
|
|
15
|
+
const handleParsedManyData_1 = require("../base/handleParsedManyData");
|
|
16
|
+
const handleParsedItemTxt = (parsedItem, item, transactionalEntityManager) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const itemTxtService = new podverse_orm_1.ItemTxtService(transactionalEntityManager);
|
|
18
|
+
const itemTxtDtos = (0, item_1.compatItemTxtDtos)(parsedItem);
|
|
19
|
+
yield (0, handleParsedManyData_1.handleParsedManyData)(item, itemTxtService, itemTxtDtos);
|
|
20
|
+
});
|
|
21
|
+
exports.handleParsedItemTxt = handleParsedItemTxt;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Episode } from "podcast-partytime";
|
|
2
|
+
import { EntityManager, Item } from "podverse-orm";
|
|
3
|
+
export declare const handleParsedItemValue: (parsedItem: Episode, item: Item, transactionalEntityManager: EntityManager) => Promise<void>;
|
|
4
|
+
//# sourceMappingURL=itemValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"itemValue.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/item/itemValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,IAAI,EAE3B,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,qBAAqB,eACpB,OAAO,QACb,IAAI,8BACkB,aAAa,kBAkD1C,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.handleParsedItemValue = void 0;
|
|
13
|
+
const podverse_orm_1 = require("podverse-orm");
|
|
14
|
+
const item_1 = require("@parser/lib/compat/partytime/item");
|
|
15
|
+
const handleParsedItemValue = (parsedItem, item, transactionalEntityManager) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const itemValueService = new podverse_orm_1.ItemValueService(transactionalEntityManager);
|
|
17
|
+
const itemValueDtos = (0, item_1.compatItemValueDtos)(parsedItem);
|
|
18
|
+
const itemValueRecipientService = new podverse_orm_1.ItemValueRecipientService(transactionalEntityManager);
|
|
19
|
+
const itemValueTimeSplitService = new podverse_orm_1.ItemValueTimeSplitService(transactionalEntityManager);
|
|
20
|
+
const itemValueTimeSplitRecipientService = new podverse_orm_1.ItemValueTimeSplitRecipientService(transactionalEntityManager);
|
|
21
|
+
const itemValueTimeSplitRemoteItemService = new podverse_orm_1.ItemValueTimeSplitRemoteItemService(transactionalEntityManager);
|
|
22
|
+
if (itemValueDtos.length > 0) {
|
|
23
|
+
for (const itemValueDto of itemValueDtos) {
|
|
24
|
+
const item_value = yield itemValueService.update(item, itemValueDto.item_value);
|
|
25
|
+
const itemValueRecipientDtos = itemValueDto.item_value_recipients;
|
|
26
|
+
if (itemValueRecipientDtos.length > 0) {
|
|
27
|
+
for (const itemValueRecipientDto of itemValueRecipientDtos) {
|
|
28
|
+
yield itemValueRecipientService.update(item_value, itemValueRecipientDto);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
yield itemValueRecipientService.deleteAll(item_value);
|
|
33
|
+
}
|
|
34
|
+
const itemValueTimeSplitDtos = itemValueDto.item_value_time_splits;
|
|
35
|
+
if (itemValueTimeSplitDtos.length > 0) {
|
|
36
|
+
for (const itemValueTimeSplitDto of itemValueTimeSplitDtos) {
|
|
37
|
+
const item_value_time_split = yield itemValueTimeSplitService.update(item_value, itemValueTimeSplitDto.meta);
|
|
38
|
+
const itemValueTimeSplitRecipientDtos = itemValueTimeSplitDto.item_value_time_splits_recipients;
|
|
39
|
+
if (itemValueTimeSplitRecipientDtos.length > 0) {
|
|
40
|
+
for (const itemValueTimeSplitRecipientDto of itemValueTimeSplitRecipientDtos) {
|
|
41
|
+
yield itemValueTimeSplitRecipientService.update(item_value_time_split, itemValueTimeSplitRecipientDto);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
yield itemValueTimeSplitRecipientService.deleteAll(item_value_time_split);
|
|
46
|
+
}
|
|
47
|
+
const itemValueTimeSplitRemoteItemDto = itemValueTimeSplitDto.item_value_time_splits_remote_item;
|
|
48
|
+
if (itemValueTimeSplitRemoteItemDto) {
|
|
49
|
+
yield itemValueTimeSplitRemoteItemService.update(item_value_time_split, itemValueTimeSplitRemoteItemDto);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
yield itemValueTimeSplitRemoteItemService.deleteAll(item_value_time_split);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
yield itemValueTimeSplitService.deleteAll(item_value);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
yield itemValueService.deleteAll(item);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
exports.handleParsedItemValue = handleParsedItemValue;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Phase4PodcastLiveItem } from "podcast-partytime/dist/parser/phase/phase-4";
|
|
2
|
+
import { Channel, ChannelSeasonIndex } from "podverse-orm";
|
|
3
|
+
export declare const handleParsedLiveItems: (parsedLiveItems: Phase4PodcastLiveItem[], channel: Channel, channelSeasonIndex: ChannelSeasonIndex) => Promise<void>;
|
|
4
|
+
//# sourceMappingURL=liveItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveItem.d.ts","sourceRoot":"","sources":["../../../../src/lib/rss/liveItem/liveItem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAiB,OAAO,EAAE,kBAAkB,EAAgC,MAAM,cAAc,CAAC;AAIxG,eAAO,MAAM,qBAAqB,oBAA2B,qBAAqB,EAAE,WAAW,OAAO,sBAAsB,kBAAkB,kBA2B7I,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.handleParsedLiveItems = void 0;
|
|
13
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
14
|
+
const podverse_orm_1 = require("podverse-orm");
|
|
15
|
+
const liveItem_1 = require("@parser/lib/compat/partytime/liveItem");
|
|
16
|
+
const item_1 = require("../item/item");
|
|
17
|
+
const handleParsedLiveItems = (parsedLiveItems, channel, channelSeasonIndex) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const itemService = new podverse_orm_1.ItemService();
|
|
19
|
+
const existingLiveItems = yield itemService.getAllItemsWithLiveItemByChannel(channel, { select: ['id'] });
|
|
20
|
+
const existingLiveItemIds = existingLiveItems.map(live_item => live_item.id);
|
|
21
|
+
const updatedLiveItemIds = [];
|
|
22
|
+
const liveItemObjDtos = (0, liveItem_1.compatLiveItemsDtos)(parsedLiveItems);
|
|
23
|
+
const liveItemObjDtosBatchs = (0, podverse_helpers_1.chunkArray)(liveItemObjDtos, 100);
|
|
24
|
+
for (const liveItemObjDtosBatch of liveItemObjDtosBatchs) {
|
|
25
|
+
yield podverse_orm_1.AppDataSource.manager.transaction((transactionalEntityManager) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
for (const liveItemObjDto of liveItemObjDtosBatch) {
|
|
27
|
+
// PTDO: how to make any unnecessary?
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
const itemDto = liveItemObjDto.item;
|
|
30
|
+
const item = yield (0, item_1.handleParsedItem)(itemDto, channel, channelSeasonIndex, transactionalEntityManager);
|
|
31
|
+
updatedLiveItemIds.push(item.id);
|
|
32
|
+
const liveItemService = new podverse_orm_1.LiveItemService();
|
|
33
|
+
const liveItemDto = liveItemObjDto.liveItem;
|
|
34
|
+
yield liveItemService.update(item, liveItemDto);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
const itemIdsToDelete = existingLiveItemIds.filter(id => !updatedLiveItemIds.includes(id));
|
|
39
|
+
yield itemService.deleteMany(itemIdsToDelete);
|
|
40
|
+
});
|
|
41
|
+
exports.handleParsedLiveItems = handleParsedLiveItems;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const parseAllRSSFeeds: () => Promise<any>;
|
|
2
|
+
export declare const getAndParseRSSFeed: (url: string) => Promise<import("podcast-partytime").FeedObject>;
|
|
3
|
+
export declare const parseRSSFeedAndSaveToDatabase: (url: string, podcast_index_id: number) => Promise<any>;
|
|
4
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +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,iBA4CxF,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.parseRSSFeedAndSaveToDatabase = exports.getAndParseRSSFeed = exports.parseAllRSSFeeds = void 0;
|
|
13
|
+
const podcast_partytime_1 = require("podcast-partytime");
|
|
14
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
15
|
+
const podverse_orm_1 = require("podverse-orm");
|
|
16
|
+
const channel_1 = require("@parser/lib/rss/channel/channel");
|
|
17
|
+
const item_1 = require("./item/item");
|
|
18
|
+
const channelSeason_1 = require("./channel/channelSeason");
|
|
19
|
+
const liveItem_1 = require("./liveItem/liveItem");
|
|
20
|
+
const feed_1 = require("./feed/feed");
|
|
21
|
+
/*
|
|
22
|
+
NOTE: All RSS feeds that have a podcast_index_id will be saved to the database.
|
|
23
|
+
RSS feeds without podcast_index_id (Add By RSS feeds) will NOT be saved to the database.
|
|
24
|
+
*/
|
|
25
|
+
// TEMP: exists for development purposes
|
|
26
|
+
const parseAllRSSFeeds = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
var _a;
|
|
28
|
+
const feedService = new podverse_orm_1.FeedService();
|
|
29
|
+
const feeds = yield feedService.getAll();
|
|
30
|
+
for (const feed of feeds) {
|
|
31
|
+
return yield (0, exports.parseRSSFeedAndSaveToDatabase)(feed.url, (_a = feed === null || feed === void 0 ? void 0 : feed.channel) === null || _a === void 0 ? void 0 : _a.podcast_index_id);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
exports.parseAllRSSFeeds = parseAllRSSFeeds;
|
|
35
|
+
const getAndParseRSSFeed = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
const xml = yield (0, podverse_helpers_1.request)(url);
|
|
37
|
+
const parsedFeed = (0, podcast_partytime_1.parseFeed)(xml, { allowMissingGuid: true });
|
|
38
|
+
if (!parsedFeed) {
|
|
39
|
+
throw new Error(`getAndParseRSSFeed: parsedFeed not found for ${url}`);
|
|
40
|
+
}
|
|
41
|
+
return parsedFeed;
|
|
42
|
+
});
|
|
43
|
+
exports.getAndParseRSSFeed = getAndParseRSSFeed;
|
|
44
|
+
// export const parseRSSAddByRSSFeed = async (url: string) => {
|
|
45
|
+
// const parsedFeed = await getAndParseRSSFeed(url);
|
|
46
|
+
// const compatData = convertParsedRSSFeedToCompat(parsedFeed);
|
|
47
|
+
// return compatData;
|
|
48
|
+
// };
|
|
49
|
+
const parseRSSFeedAndSaveToDatabase = (url, podcast_index_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
const feedService = new podverse_orm_1.FeedService();
|
|
51
|
+
let feed = yield feedService.getBy({ url, podcast_index_id });
|
|
52
|
+
if (!feed) {
|
|
53
|
+
throw new Error(`parseRSSFeedAndSaveToDatabase: feed not found for ${url}`);
|
|
54
|
+
}
|
|
55
|
+
const parsedFeed = yield (0, feed_1.handleGetRSSFeed)(feed);
|
|
56
|
+
feed = yield (0, feed_1.handleParsedFeed)(parsedFeed, url, podcast_index_id);
|
|
57
|
+
try {
|
|
58
|
+
yield feedService.update(feed.id, { is_parsing: new Date() });
|
|
59
|
+
const channelService = new podverse_orm_1.ChannelService();
|
|
60
|
+
const channel = yield channelService.getOrCreateByPodcastIndexId({ feed, podcast_index_id });
|
|
61
|
+
// ChannelSeason must be parsed before anything else, because the channel season rows
|
|
62
|
+
// need to be created for other data to have a foreign key to them.
|
|
63
|
+
yield (0, channelSeason_1.handleParsedChannelSeasons)(parsedFeed, channel);
|
|
64
|
+
const channelSeasonService = new podverse_orm_1.ChannelSeasonService();
|
|
65
|
+
const channelSeasonIndex = yield channelSeasonService.getChannelSeasonIndex(channel);
|
|
66
|
+
yield (0, channel_1.handleParsedChannel)(parsedFeed, channel, channelSeasonIndex);
|
|
67
|
+
// PTDO: if publisher feed, handle publisher remote item data
|
|
68
|
+
// else handle parsed items
|
|
69
|
+
yield (0, item_1.handleParsedItems)(parsedFeed.items, channel, channelSeasonIndex);
|
|
70
|
+
if (parsedFeed.podcastLiveItems) {
|
|
71
|
+
yield (0, liveItem_1.handleParsedLiveItems)(parsedFeed.podcastLiveItems, channel, channelSeasonIndex);
|
|
72
|
+
}
|
|
73
|
+
// TODO: handle new item notifications
|
|
74
|
+
// TODO: handle new live_item notifications
|
|
75
|
+
const feedLogService = new podverse_orm_1.FeedLogService();
|
|
76
|
+
yield feedLogService.update(feed, { last_finished_parse_time: new Date() });
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
yield feedService.update(feed.id, { is_parsing: null });
|
|
80
|
+
}
|
|
81
|
+
return feed;
|
|
82
|
+
});
|
|
83
|
+
exports.parseRSSFeedAndSaveToDatabase = parseRSSFeedAndSaveToDatabase;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-alias-config.d.ts","sourceRoot":"","sources":["../src/module-alias-config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podverse-parser",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*"
|
|
9
|
+
],
|
|
7
10
|
"scripts": {
|
|
8
11
|
"dev:watch": "nodemon --watch 'src' --watch $(realpath node_modules/podverse-external-services) --watch $(realpath node_modules/podverse-orm) --watch $(realpath node_modules/podverse-shared) -x \"npm run build\"",
|
|
9
12
|
"build": "tsc",
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
v20.16.0
|
package/eslint.config.mjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import globals from "globals";
|
|
2
|
-
import pluginJs from "@eslint/js";
|
|
3
|
-
import tseslint from "@typescript-eslint/eslint-plugin";
|
|
4
|
-
import tsParser from "@typescript-eslint/parser";
|
|
5
|
-
|
|
6
|
-
const pluginJsRecommended = {
|
|
7
|
-
rules: {
|
|
8
|
-
...pluginJs.configs.recommended.rules,
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const tseslintRecommended = {
|
|
13
|
-
rules: {
|
|
14
|
-
...tseslint.configs.recommended.rules,
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default [
|
|
19
|
-
{
|
|
20
|
-
files: ["src/**/*.{js,ts}"],
|
|
21
|
-
languageOptions: {
|
|
22
|
-
globals: globals.node,
|
|
23
|
-
parser: tsParser,
|
|
24
|
-
},
|
|
25
|
-
plugins: {
|
|
26
|
-
"@typescript-eslint": tseslint,
|
|
27
|
-
},
|
|
28
|
-
rules: {
|
|
29
|
-
...pluginJsRecommended.rules,
|
|
30
|
-
...tseslintRecommended.rules,
|
|
31
|
-
"semi": ["error", "always"],
|
|
32
|
-
"indent": ["error", 2],
|
|
33
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
34
|
-
},
|
|
35
|
-
ignores: ["**/eslint.config.mjs"],
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { request, throwRequestError } from "podverse-helpers";
|
|
2
|
-
import { Item, ItemChaptersFeed, ItemChapterService, ItemChaptersFeedLogService } from "podverse-orm";
|
|
3
|
-
import { compatParsedChapters, PIChapter } from "@parser/lib/compat/chapters/chapters";
|
|
4
|
-
|
|
5
|
-
const getParsedChapters = async (item_chapters_feed: ItemChaptersFeed) => {
|
|
6
|
-
const itemChaptersFeedLogService = new ItemChaptersFeedLogService();
|
|
7
|
-
try {
|
|
8
|
-
const response: { chapters: PIChapter[] } = await request(item_chapters_feed.url);
|
|
9
|
-
await itemChaptersFeedLogService.update(item_chapters_feed, {
|
|
10
|
-
last_http_status: 200,
|
|
11
|
-
last_good_http_status_time: new Date()
|
|
12
|
-
});
|
|
13
|
-
return compatParsedChapters(response.chapters);
|
|
14
|
-
} catch (error) {
|
|
15
|
-
// TODO: how to handle errors?
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
const statusCode = (error as any).statusCode as number;
|
|
18
|
-
const item_chapters_feed_log = await itemChaptersFeedLogService.get(item_chapters_feed);
|
|
19
|
-
if (statusCode) {
|
|
20
|
-
await itemChaptersFeedLogService.update(item_chapters_feed, {
|
|
21
|
-
last_http_status: statusCode,
|
|
22
|
-
parse_errors: (item_chapters_feed_log?.parse_errors || 0) + 1,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return throwRequestError(error);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const parseChapters = async (item: Item): Promise<void> => {
|
|
30
|
-
const item_chapters_feed = item.item_chapters_feed;
|
|
31
|
-
|
|
32
|
-
if (!item_chapters_feed) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const parsedChapters = await getParsedChapters(item_chapters_feed);
|
|
37
|
-
|
|
38
|
-
const itemChapterService = new ItemChapterService();
|
|
39
|
-
|
|
40
|
-
const existingChapters = await itemChapterService.getAll(item_chapters_feed, { select: ['id'] });
|
|
41
|
-
const existingChaptersIds = existingChapters.map(item_chapter => item_chapter.id);
|
|
42
|
-
const updatedChaptersIds: number[] = [];
|
|
43
|
-
|
|
44
|
-
for (const parsedChapter of parsedChapters) {
|
|
45
|
-
await itemChapterService.update(item_chapters_feed, parsedChapter);
|
|
46
|
-
updatedChaptersIds.push(item_chapters_feed.id);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const itemChapterIdsToDelete = existingChaptersIds.filter(id => !updatedChaptersIds.includes(id));
|
|
50
|
-
await itemChapterService.deleteMany(itemChapterIdsToDelete);
|
|
51
|
-
|
|
52
|
-
const itemChaptersFeedLogService = new ItemChaptersFeedLogService();
|
|
53
|
-
await itemChaptersFeedLogService.update(item_chapters_feed, { last_finished_parse_time: new Date() });
|
|
54
|
-
};
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { FeedObject, Phase4Medium } from "podcast-partytime";
|
|
2
|
-
import { Phase4PodcastImage } from "podcast-partytime/dist/parser/phase/phase-4";
|
|
3
|
-
import { createSortableTitle, getBooleanOrNull } from "podverse-helpers";
|
|
4
|
-
import { getChannelItunesTypeItunesTypeEnumValue, getMediumEnumValue } from "podverse-orm";
|
|
5
|
-
import { compatChannelValue } from "@parser/lib/compat/partytime/value";
|
|
6
|
-
|
|
7
|
-
export const compatChannelDto = (parsedFeed: FeedObject) => ({
|
|
8
|
-
podcast_guid: parsedFeed.guid,
|
|
9
|
-
title: parsedFeed.title,
|
|
10
|
-
sortable_title: createSortableTitle(parsedFeed.title),
|
|
11
|
-
medium: getMediumEnumValue(parsedFeed.medium ?? Phase4Medium.Podcast)
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export const compatChannelAboutDto = (parsedFeed: FeedObject) => ({
|
|
15
|
-
author: (Array.isArray(parsedFeed.author) ? parsedFeed.author : parsedFeed.author ? [parsedFeed.author] : [])?.join(', ') || null,
|
|
16
|
-
explicit: getBooleanOrNull(parsedFeed.explicit),
|
|
17
|
-
language: parsedFeed.language || null,
|
|
18
|
-
website_link_url: parsedFeed.link || null,
|
|
19
|
-
itunes_type: getChannelItunesTypeItunesTypeEnumValue(parsedFeed.itunesType || 'episodic')
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export const compatChannelChatDto = (parsedFeed: FeedObject) => {
|
|
23
|
-
if (!parsedFeed.chat) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
server: parsedFeed.chat.server,
|
|
28
|
-
protocol: parsedFeed.chat.protocol,
|
|
29
|
-
account_id: parsedFeed.chat.accountId || null,
|
|
30
|
-
space: parsedFeed.chat.space || null
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const compatChannelDescriptionDto = (parsedFeed: FeedObject) => {
|
|
35
|
-
if (!parsedFeed.description) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
value: parsedFeed.description
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const compatChannelFundingDtos = (parsedFeed: FeedObject) => {
|
|
44
|
-
const dtos = [];
|
|
45
|
-
|
|
46
|
-
if (Array.isArray(parsedFeed.podcastFunding)) {
|
|
47
|
-
for (const f of parsedFeed.podcastFunding) {
|
|
48
|
-
if (f.url) {
|
|
49
|
-
dtos.push({
|
|
50
|
-
url: f.url,
|
|
51
|
-
title: f.message || null
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return dtos;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const compatChannelImageDtos = (parsedFeed: FeedObject) => {
|
|
61
|
-
const dtos = [];
|
|
62
|
-
if (parsedFeed.itunesImage) {
|
|
63
|
-
dtos.push({
|
|
64
|
-
url: parsedFeed.itunesImage,
|
|
65
|
-
image_width_size: null
|
|
66
|
-
});
|
|
67
|
-
} else if (parsedFeed.image?.url) {
|
|
68
|
-
dtos.push({
|
|
69
|
-
url: parsedFeed.image.url,
|
|
70
|
-
image_width_size: null
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function hasWidth(image: Phase4PodcastImage['parsed']): image is { url: string; width: number } {
|
|
75
|
-
return (image as { width: number }).width !== undefined;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (Array.isArray(parsedFeed.podcastImages)) {
|
|
79
|
-
for (const image of parsedFeed.podcastImages) {
|
|
80
|
-
if (image.parsed.url && hasWidth(image.parsed)) {
|
|
81
|
-
dtos.push({
|
|
82
|
-
url: image.parsed.url,
|
|
83
|
-
image_width_size: image.parsed.width
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return dtos;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const compatChannelLicenseDto = (parsedFeed: FeedObject) => {
|
|
93
|
-
if (!parsedFeed?.license?.identifier) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
identifier: parsedFeed.license.identifier,
|
|
98
|
-
url: parsedFeed.license.url || null
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const compatChannelLocationDto = (parsedFeed: FeedObject) => {
|
|
103
|
-
if (!parsedFeed?.podcastLocation?.geo && !parsedFeed?.podcastLocation?.osm) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return {
|
|
108
|
-
geo: parsedFeed.podcastLocation.geo || null,
|
|
109
|
-
osm: parsedFeed.podcastLocation.osm || null,
|
|
110
|
-
name: parsedFeed.podcastLocation.name || null
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const compatChannelPersonDtos = (parsedFeed: FeedObject) => {
|
|
115
|
-
const dtos = [];
|
|
116
|
-
|
|
117
|
-
if (Array.isArray(parsedFeed.podcastPeople)) {
|
|
118
|
-
for (const p of parsedFeed.podcastPeople) {
|
|
119
|
-
if (p.name) {
|
|
120
|
-
dtos.push({
|
|
121
|
-
name: p.name,
|
|
122
|
-
role: p.role?.toLowerCase() || null,
|
|
123
|
-
person_group: p.group?.toLowerCase() || 'cast',
|
|
124
|
-
img: p.img || null,
|
|
125
|
-
href: p.href || null
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return dtos;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export const compatChannelPodrollRemoteItemDtos = (parsedFeed: FeedObject) => {
|
|
135
|
-
const dtos = [];
|
|
136
|
-
|
|
137
|
-
if (Array.isArray(parsedFeed.podroll)) {
|
|
138
|
-
for (const ri of parsedFeed.podroll) {
|
|
139
|
-
if (ri.feedGuid) {
|
|
140
|
-
dtos.push({
|
|
141
|
-
feed_guid: ri.feedGuid,
|
|
142
|
-
feed_url: ri.feedUrl || null,
|
|
143
|
-
item_guid: null,
|
|
144
|
-
title: /* PTDO: ri.title || */ null
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return dtos;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export const compatChannelPublisherRemoteItemDtos = (parsedFeed: FeedObject) => {
|
|
154
|
-
const dtos = [];
|
|
155
|
-
|
|
156
|
-
if (Array.isArray(parsedFeed.podroll)) {
|
|
157
|
-
for (const ri of parsedFeed.podroll) {
|
|
158
|
-
if (ri.feedGuid) {
|
|
159
|
-
dtos.push({
|
|
160
|
-
feed_guid: ri.feedGuid,
|
|
161
|
-
feed_url: ri.feedUrl || null,
|
|
162
|
-
item_guid: null,
|
|
163
|
-
title: /* PTDO: ri.title || */ null
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return dtos;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export const compatChannelRemoteItemDtos = (parsedFeed: FeedObject) => {
|
|
173
|
-
const dtos = [];
|
|
174
|
-
|
|
175
|
-
if (Array.isArray(parsedFeed.podcastRemoteItems)) {
|
|
176
|
-
for (const ri of parsedFeed.podcastRemoteItems) {
|
|
177
|
-
if (ri.feedGuid) {
|
|
178
|
-
dtos.push({
|
|
179
|
-
feed_guid: ri.feedGuid,
|
|
180
|
-
feed_url: ri.feedUrl || null,
|
|
181
|
-
item_guid: null,
|
|
182
|
-
title: /* PTDO: ri.title || */ null
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return dtos;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
export const compatChannelSocialInteractDtos = (parsedFeed: FeedObject) => {
|
|
192
|
-
const dtos = [];
|
|
193
|
-
|
|
194
|
-
if (parsedFeed?.podcastSocial?.length) {
|
|
195
|
-
for (const ps of parsedFeed.podcastSocial) {
|
|
196
|
-
dtos.push({
|
|
197
|
-
// PTDO: fix keys mismatch between partytime and podverse
|
|
198
|
-
protocol: ps.platform,
|
|
199
|
-
uri: ps.url,
|
|
200
|
-
account_id: ps.id || null,
|
|
201
|
-
account_url: ps.name || null,
|
|
202
|
-
priority: ps.priority || null
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return dtos;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export const compatChannelSeasonDtos = (parsedFeed: FeedObject) => {
|
|
211
|
-
const dtos = [];
|
|
212
|
-
|
|
213
|
-
const parsedItems = parsedFeed?.items || [];
|
|
214
|
-
|
|
215
|
-
const seasonsIndex: { [key: number]: { name: string | null } } = {};
|
|
216
|
-
|
|
217
|
-
for (const parsedItem of parsedItems) {
|
|
218
|
-
const seasonNumber = parsedItem?.podcastSeason?.number || parsedItem?.itunesSeason;
|
|
219
|
-
const seasonName = parsedItem?.podcastSeason?.name || null;
|
|
220
|
-
if (Number.isInteger(seasonNumber)) {
|
|
221
|
-
const seasonNumberAsNumber = seasonNumber as number;
|
|
222
|
-
seasonsIndex[seasonNumberAsNumber] = {
|
|
223
|
-
name: seasonName
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
for (const [number, { name }] of Object.entries(seasonsIndex)) {
|
|
229
|
-
dtos.push({
|
|
230
|
-
number: parseInt(number),
|
|
231
|
-
name: name || null
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return dtos;
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
export const compatChannelTrailerDtos = (parsedFeed: FeedObject) => {
|
|
239
|
-
const dtos = [];
|
|
240
|
-
if (parsedFeed?.trailers?.length) {
|
|
241
|
-
for (const pt of parsedFeed.trailers) {
|
|
242
|
-
dtos.push({
|
|
243
|
-
url: pt.url,
|
|
244
|
-
title: /* PTDO: add pt.title || */ null,
|
|
245
|
-
pubdate: pt.pubdate,
|
|
246
|
-
length: pt.length || null,
|
|
247
|
-
type: pt.type || null,
|
|
248
|
-
season: pt.season || null
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return dtos;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
export const compatChannelTxtDtos = (parsedFeed: FeedObject) => {
|
|
257
|
-
const dtos = [];
|
|
258
|
-
if (parsedFeed?.podcastTxt?.length) {
|
|
259
|
-
for (const pt of parsedFeed.podcastTxt) {
|
|
260
|
-
dtos.push({
|
|
261
|
-
purpose: pt.purpose || null,
|
|
262
|
-
value: pt.value
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return dtos;
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
export const compatChannelValueDtos = (parsedFeed: FeedObject) => {
|
|
271
|
-
let dtos = [];
|
|
272
|
-
if (parsedFeed.value) {
|
|
273
|
-
const dto = compatChannelValue(parsedFeed.value);
|
|
274
|
-
|
|
275
|
-
const formattedDto = {
|
|
276
|
-
channel_value: {
|
|
277
|
-
type: dto.type,
|
|
278
|
-
method: dto.method,
|
|
279
|
-
suggested: dto.suggested || null
|
|
280
|
-
},
|
|
281
|
-
channel_value_recipients: dto.channel_value_recipients
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
dtos.push(formattedDto);
|
|
285
|
-
}
|
|
286
|
-
return dtos;
|
|
287
|
-
};
|