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.
Files changed (211) hide show
  1. package/.nvmrc +1 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +7 -81
  5. package/dist/lib/chapters/chapters.d.ts +3 -0
  6. package/dist/lib/chapters/chapters.d.ts.map +1 -0
  7. package/dist/lib/chapters/chapters.js +59 -0
  8. package/dist/lib/compat/channel.d.ts +108 -0
  9. package/dist/lib/compat/channel.d.ts.map +1 -0
  10. package/dist/lib/compat/channel.js +279 -0
  11. package/dist/lib/compat/chapters/chapters.d.ts +11 -0
  12. package/dist/lib/compat/chapters/chapters.d.ts.map +1 -0
  13. package/dist/lib/compat/chapters/chapters.js +16 -0
  14. package/dist/lib/compat/partytime/channel.d.ts +110 -0
  15. package/dist/lib/compat/partytime/channel.d.ts.map +1 -0
  16. package/dist/lib/compat/partytime/channel.js +281 -0
  17. package/dist/lib/compat/partytime/compatFull.d.ts +6 -0
  18. package/dist/lib/compat/partytime/compatFull.d.ts.map +1 -0
  19. package/dist/lib/compat/partytime/compatFull.js +11 -0
  20. package/dist/lib/compat/partytime/funding.d.ts +6 -0
  21. package/dist/lib/compat/partytime/funding.d.ts.map +1 -0
  22. package/dist/lib/compat/partytime/funding.js +10 -0
  23. package/dist/lib/compat/partytime/item.d.ts +146 -0
  24. package/dist/lib/compat/partytime/item.d.ts.map +1 -0
  25. package/dist/lib/compat/partytime/item.js +264 -0
  26. package/dist/lib/compat/partytime/liveItem.d.ts +11 -0
  27. package/dist/lib/compat/partytime/liveItem.d.ts.map +1 -0
  28. package/dist/lib/compat/partytime/liveItem.js +20 -0
  29. package/dist/lib/compat/partytime/value.d.ts +62 -0
  30. package/dist/lib/compat/partytime/value.d.ts.map +1 -0
  31. package/dist/lib/compat/partytime/value.js +69 -0
  32. package/dist/lib/rss/base/handleParsedManyData.d.ts +7 -0
  33. package/dist/lib/rss/base/handleParsedManyData.d.ts.map +1 -0
  34. package/dist/lib/rss/base/handleParsedManyData.js +21 -0
  35. package/dist/lib/rss/base/handleParsedOneData.d.ts +7 -0
  36. package/dist/lib/rss/base/handleParsedOneData.d.ts.map +1 -0
  37. package/dist/lib/rss/base/handleParsedOneData.js +21 -0
  38. package/dist/lib/rss/channel/channel.d.ts +4 -0
  39. package/dist/lib/rss/channel/channel.d.ts.map +1 -0
  40. package/dist/lib/rss/channel/channel.js +61 -0
  41. package/dist/lib/rss/channel/channelAbout.d.ts +4 -0
  42. package/dist/lib/rss/channel/channelAbout.d.ts.map +1 -0
  43. package/dist/lib/rss/channel/channelAbout.js +20 -0
  44. package/dist/lib/rss/channel/channelChat.d.ts +4 -0
  45. package/dist/lib/rss/channel/channelChat.d.ts.map +1 -0
  46. package/dist/lib/rss/channel/channelChat.js +21 -0
  47. package/dist/lib/rss/channel/channelDescription.d.ts +4 -0
  48. package/dist/lib/rss/channel/channelDescription.d.ts.map +1 -0
  49. package/dist/lib/rss/channel/channelDescription.js +21 -0
  50. package/dist/lib/rss/channel/channelFunding.d.ts +4 -0
  51. package/dist/lib/rss/channel/channelFunding.d.ts.map +1 -0
  52. package/dist/lib/rss/channel/channelFunding.js +21 -0
  53. package/dist/lib/rss/channel/channelImage.d.ts +4 -0
  54. package/dist/lib/rss/channel/channelImage.d.ts.map +1 -0
  55. package/dist/lib/rss/channel/channelImage.js +21 -0
  56. package/dist/lib/rss/channel/channelLicense.d.ts +4 -0
  57. package/dist/lib/rss/channel/channelLicense.d.ts.map +1 -0
  58. package/dist/lib/rss/channel/channelLicense.js +21 -0
  59. package/dist/lib/rss/channel/channelLocation.d.ts +4 -0
  60. package/dist/lib/rss/channel/channelLocation.d.ts.map +1 -0
  61. package/dist/lib/rss/channel/channelLocation.js +21 -0
  62. package/dist/lib/rss/channel/channelPerson.d.ts +4 -0
  63. package/dist/lib/rss/channel/channelPerson.d.ts.map +1 -0
  64. package/dist/lib/rss/channel/channelPerson.js +21 -0
  65. package/dist/lib/rss/channel/channelPodroll.d.ts +4 -0
  66. package/dist/lib/rss/channel/channelPodroll.d.ts.map +1 -0
  67. package/dist/lib/rss/channel/channelPodroll.js +28 -0
  68. package/dist/lib/rss/channel/channelRemoteItem.d.ts +4 -0
  69. package/dist/lib/rss/channel/channelRemoteItem.d.ts.map +1 -0
  70. package/dist/lib/rss/channel/channelRemoteItem.js +21 -0
  71. package/dist/lib/rss/channel/channelSeason.d.ts +4 -0
  72. package/dist/lib/rss/channel/channelSeason.d.ts.map +1 -0
  73. package/dist/lib/rss/channel/channelSeason.js +25 -0
  74. package/dist/lib/rss/channel/channelSocialInteract.d.ts +4 -0
  75. package/dist/lib/rss/channel/channelSocialInteract.d.ts.map +1 -0
  76. package/dist/lib/rss/channel/channelSocialInteract.js +21 -0
  77. package/dist/lib/rss/channel/channelTrailer.d.ts +4 -0
  78. package/dist/lib/rss/channel/channelTrailer.d.ts.map +1 -0
  79. package/dist/lib/rss/channel/channelTrailer.js +36 -0
  80. package/dist/lib/rss/channel/channelTxt.d.ts +4 -0
  81. package/dist/lib/rss/channel/channelTxt.d.ts.map +1 -0
  82. package/dist/lib/rss/channel/channelTxt.js +21 -0
  83. package/dist/lib/rss/channel/channelValue.d.ts +4 -0
  84. package/dist/lib/rss/channel/channelValue.d.ts.map +1 -0
  85. package/dist/lib/rss/channel/channelValue.js +37 -0
  86. package/dist/lib/rss/feed/feed.d.ts +5 -0
  87. package/dist/lib/rss/feed/feed.d.ts.map +1 -0
  88. package/dist/lib/rss/feed/feed.js +80 -0
  89. package/dist/lib/rss/hash/parsedFeed.d.ts +3 -0
  90. package/dist/lib/rss/hash/parsedFeed.d.ts.map +1 -0
  91. package/dist/lib/rss/hash/parsedFeed.js +22 -0
  92. package/dist/lib/rss/item/item.d.ts +5 -0
  93. package/dist/lib/rss/item/item.d.ts.map +1 -0
  94. package/dist/lib/rss/item/item.js +80 -0
  95. package/dist/lib/rss/item/itemAbout.d.ts +4 -0
  96. package/dist/lib/rss/item/itemAbout.d.ts.map +1 -0
  97. package/dist/lib/rss/item/itemAbout.js +20 -0
  98. package/dist/lib/rss/item/itemChaptersFeed.d.ts +4 -0
  99. package/dist/lib/rss/item/itemChaptersFeed.d.ts.map +1 -0
  100. package/dist/lib/rss/item/itemChaptersFeed.js +21 -0
  101. package/dist/lib/rss/item/itemChat.d.ts +4 -0
  102. package/dist/lib/rss/item/itemChat.d.ts.map +1 -0
  103. package/dist/lib/rss/item/itemChat.js +21 -0
  104. package/dist/lib/rss/item/itemContentLink.d.ts +1 -0
  105. package/dist/lib/rss/item/itemContentLink.d.ts.map +1 -0
  106. package/dist/lib/rss/item/itemContentLink.js +1 -0
  107. package/dist/lib/rss/item/itemDescription.d.ts +4 -0
  108. package/dist/lib/rss/item/itemDescription.d.ts.map +1 -0
  109. package/dist/lib/rss/item/itemDescription.js +21 -0
  110. package/dist/lib/rss/item/itemEnclosure.d.ts +4 -0
  111. package/dist/lib/rss/item/itemEnclosure.d.ts.map +1 -0
  112. package/dist/lib/rss/item/itemEnclosure.js +40 -0
  113. package/dist/lib/rss/item/itemImage.d.ts +4 -0
  114. package/dist/lib/rss/item/itemImage.d.ts.map +1 -0
  115. package/dist/lib/rss/item/itemImage.js +21 -0
  116. package/dist/lib/rss/item/itemLicense.d.ts +4 -0
  117. package/dist/lib/rss/item/itemLicense.d.ts.map +1 -0
  118. package/dist/lib/rss/item/itemLicense.js +21 -0
  119. package/dist/lib/rss/item/itemLocation.d.ts +4 -0
  120. package/dist/lib/rss/item/itemLocation.d.ts.map +1 -0
  121. package/dist/lib/rss/item/itemLocation.js +21 -0
  122. package/dist/lib/rss/item/itemPerson.d.ts +4 -0
  123. package/dist/lib/rss/item/itemPerson.d.ts.map +1 -0
  124. package/dist/lib/rss/item/itemPerson.js +21 -0
  125. package/dist/lib/rss/item/itemSeason.d.ts +4 -0
  126. package/dist/lib/rss/item/itemSeason.d.ts.map +1 -0
  127. package/dist/lib/rss/item/itemSeason.js +30 -0
  128. package/dist/lib/rss/item/itemSeasonEpisode.d.ts +4 -0
  129. package/dist/lib/rss/item/itemSeasonEpisode.d.ts.map +1 -0
  130. package/dist/lib/rss/item/itemSeasonEpisode.js +21 -0
  131. package/dist/lib/rss/item/itemSocialInteract.d.ts +4 -0
  132. package/dist/lib/rss/item/itemSocialInteract.d.ts.map +1 -0
  133. package/dist/lib/rss/item/itemSocialInteract.js +21 -0
  134. package/dist/lib/rss/item/itemSoundbite.d.ts +4 -0
  135. package/dist/lib/rss/item/itemSoundbite.d.ts.map +1 -0
  136. package/dist/lib/rss/item/itemSoundbite.js +21 -0
  137. package/dist/lib/rss/item/itemTranscript.d.ts +4 -0
  138. package/dist/lib/rss/item/itemTranscript.d.ts.map +1 -0
  139. package/dist/lib/rss/item/itemTranscript.js +21 -0
  140. package/dist/lib/rss/item/itemTxt.d.ts +4 -0
  141. package/dist/lib/rss/item/itemTxt.d.ts.map +1 -0
  142. package/dist/lib/rss/item/itemTxt.js +21 -0
  143. package/dist/lib/rss/item/itemValue.d.ts +4 -0
  144. package/dist/lib/rss/item/itemValue.d.ts.map +1 -0
  145. package/dist/lib/rss/item/itemValue.js +65 -0
  146. package/dist/lib/rss/liveItem/liveItem.d.ts +4 -0
  147. package/dist/lib/rss/liveItem/liveItem.d.ts.map +1 -0
  148. package/dist/lib/rss/liveItem/liveItem.js +41 -0
  149. package/dist/lib/rss/parser.d.ts +4 -0
  150. package/dist/lib/rss/parser.d.ts.map +1 -0
  151. package/dist/lib/rss/parser.js +83 -0
  152. package/dist/module-alias-config.d.ts +2 -0
  153. package/dist/module-alias-config.d.ts.map +1 -0
  154. package/dist/module-alias-config.js +7 -0
  155. package/eslint.config.mjs +38 -0
  156. package/package.json +20 -29
  157. package/src/index.ts +3 -0
  158. package/src/lib/chapters/chapters.ts +54 -0
  159. package/src/lib/compat/channel.ts +287 -0
  160. package/src/lib/compat/chapters/chapters.ts +23 -0
  161. package/src/lib/compat/partytime/channel.ts +289 -0
  162. package/src/lib/compat/partytime/compatFull.ts +7 -0
  163. package/src/lib/compat/partytime/funding.ts +8 -0
  164. package/src/lib/compat/partytime/item.ts +273 -0
  165. package/src/lib/compat/partytime/liveItem.ts +18 -0
  166. package/src/lib/compat/partytime/value.ts +64 -0
  167. package/src/lib/rss/base/handleParsedManyData.ts +16 -0
  168. package/src/lib/rss/base/handleParsedOneData.ts +17 -0
  169. package/src/lib/rss/channel/channel.ts +55 -0
  170. package/src/lib/rss/channel/channelAbout.ts +13 -0
  171. package/src/lib/rss/channel/channelChat.ts +14 -0
  172. package/src/lib/rss/channel/channelDescription.ts +14 -0
  173. package/src/lib/rss/channel/channelFunding.ts +14 -0
  174. package/src/lib/rss/channel/channelImage.ts +14 -0
  175. package/src/lib/rss/channel/channelLicense.ts +14 -0
  176. package/src/lib/rss/channel/channelLocation.ts +14 -0
  177. package/src/lib/rss/channel/channelPerson.ts +14 -0
  178. package/src/lib/rss/channel/channelPodroll.ts +21 -0
  179. package/src/lib/rss/channel/channelRemoteItem.ts +14 -0
  180. package/src/lib/rss/channel/channelSeason.ts +14 -0
  181. package/src/lib/rss/channel/channelSocialInteract.ts +14 -0
  182. package/src/lib/rss/channel/channelTrailer.ts +31 -0
  183. package/src/lib/rss/channel/channelTxt.ts +14 -0
  184. package/src/lib/rss/channel/channelValue.ts +30 -0
  185. package/src/lib/rss/feed/feed.ts +79 -0
  186. package/src/lib/rss/hash/parsedFeed.ts +9 -0
  187. package/src/lib/rss/item/item.ts +85 -0
  188. package/src/lib/rss/item/itemAbout.ts +13 -0
  189. package/src/lib/rss/item/itemChaptersFeed.ts +14 -0
  190. package/src/lib/rss/item/itemChat.ts +14 -0
  191. package/src/lib/rss/item/itemContentLink.ts +0 -0
  192. package/src/lib/rss/item/itemDescription.ts +14 -0
  193. package/src/lib/rss/item/itemEnclosure.ts +35 -0
  194. package/src/lib/rss/item/itemImage.ts +14 -0
  195. package/src/lib/rss/item/itemLicense.ts +14 -0
  196. package/src/lib/rss/item/itemLocation.ts +14 -0
  197. package/src/lib/rss/item/itemPerson.ts +14 -0
  198. package/src/lib/rss/item/itemSeason.ts +26 -0
  199. package/src/lib/rss/item/itemSeasonEpisode.ts +14 -0
  200. package/src/lib/rss/item/itemSocialInteract.ts +14 -0
  201. package/src/lib/rss/item/itemSoundbite.ts +14 -0
  202. package/src/lib/rss/item/itemTranscript.ts +14 -0
  203. package/src/lib/rss/item/itemTxt.ts +14 -0
  204. package/src/lib/rss/item/itemValue.ts +60 -0
  205. package/src/lib/rss/liveItem/liveItem.ts +34 -0
  206. package/src/lib/rss/parser.ts +85 -0
  207. package/src/module-alias-config.ts +8 -0
  208. package/tsconfig.json +25 -0
  209. package/LICENSE +0 -674
  210. package/README.md +0 -2
  211. package/dist/index.js.map +0 -7
@@ -0,0 +1,3 @@
1
+ import { Item } from "podverse-orm";
2
+ export declare const parseChapters: (item: Item) => Promise<void>;
3
+ //# sourceMappingURL=chapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chapters.d.ts","sourceRoot":"","sources":["../../../src/lib/chapters/chapters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAoE,MAAM,cAAc,CAAC;AA2BtG,eAAO,MAAM,aAAa,SAAgB,IAAI,KAAG,OAAO,CAAC,IAAI,CAyB5D,CAAC"}
@@ -0,0 +1,59 @@
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.parseChapters = void 0;
13
+ const podverse_helpers_1 = require("podverse-helpers");
14
+ const podverse_orm_1 = require("podverse-orm");
15
+ const chapters_1 = require("@parser/lib/compat/chapters/chapters");
16
+ const getParsedChapters = (item_chapters_feed) => __awaiter(void 0, void 0, void 0, function* () {
17
+ const itemChaptersFeedLogService = new podverse_orm_1.ItemChaptersFeedLogService();
18
+ try {
19
+ const response = yield (0, podverse_helpers_1.request)(item_chapters_feed.url);
20
+ yield itemChaptersFeedLogService.update(item_chapters_feed, {
21
+ last_http_status: 200,
22
+ last_good_http_status_time: new Date()
23
+ });
24
+ return (0, chapters_1.compatParsedChapters)(response.chapters);
25
+ }
26
+ catch (error) {
27
+ // TODO: how to handle errors?
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ const statusCode = error.statusCode;
30
+ const item_chapters_feed_log = yield itemChaptersFeedLogService.get(item_chapters_feed);
31
+ if (statusCode) {
32
+ yield itemChaptersFeedLogService.update(item_chapters_feed, {
33
+ last_http_status: statusCode,
34
+ parse_errors: ((item_chapters_feed_log === null || item_chapters_feed_log === void 0 ? void 0 : item_chapters_feed_log.parse_errors) || 0) + 1,
35
+ });
36
+ }
37
+ return (0, podverse_helpers_1.throwRequestError)(error);
38
+ }
39
+ });
40
+ const parseChapters = (item) => __awaiter(void 0, void 0, void 0, function* () {
41
+ const item_chapters_feed = item.item_chapters_feed;
42
+ if (!item_chapters_feed) {
43
+ return;
44
+ }
45
+ const parsedChapters = yield getParsedChapters(item_chapters_feed);
46
+ const itemChapterService = new podverse_orm_1.ItemChapterService();
47
+ const existingChapters = yield itemChapterService.getAll(item_chapters_feed, { select: ['id'] });
48
+ const existingChaptersIds = existingChapters.map(item_chapter => item_chapter.id);
49
+ const updatedChaptersIds = [];
50
+ for (const parsedChapter of parsedChapters) {
51
+ yield itemChapterService.update(item_chapters_feed, parsedChapter);
52
+ updatedChaptersIds.push(item_chapters_feed.id);
53
+ }
54
+ const itemChapterIdsToDelete = existingChaptersIds.filter(id => !updatedChaptersIds.includes(id));
55
+ yield itemChapterService.deleteMany(itemChapterIdsToDelete);
56
+ const itemChaptersFeedLogService = new podverse_orm_1.ItemChaptersFeedLogService();
57
+ yield itemChaptersFeedLogService.update(item_chapters_feed, { last_finished_parse_time: new Date() });
58
+ });
59
+ exports.parseChapters = parseChapters;
@@ -0,0 +1,108 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compatChannelValueDtos = exports.compatChannelTxtDtos = exports.compatChannelTrailerDtos = exports.compatChannelSeasonDtos = exports.compatChannelSocialInteractDtos = exports.compatChannelRemoteItemDtos = exports.compatChannelPublisherRemoteItemDtos = exports.compatChannelPodrollRemoteItemDtos = exports.compatChannelPersonDtos = exports.compatChannelLocationDto = exports.compatChannelLicenseDto = exports.compatChannelImageDtos = exports.compatChannelFundingDtos = exports.compatChannelDescriptionDto = exports.compatChannelChatDto = exports.compatChannelAboutDto = exports.compatChannelDto = void 0;
4
+ const podcast_partytime_1 = require("podcast-partytime");
5
+ const podverse_helpers_1 = require("podverse-helpers");
6
+ const podverse_orm_1 = require("podverse-orm");
7
+ const value_1 = require("@parser/lib/compat/partytime/value");
8
+ const compatChannelDto = (parsedFeed) => {
9
+ var _a;
10
+ return ({
11
+ podcast_guid: parsedFeed.guid,
12
+ title: parsedFeed.title,
13
+ sortable_title: (0, podverse_helpers_1.createSortableTitle)(parsedFeed.title),
14
+ medium: (0, podverse_orm_1.getMediumEnumValue)((_a = parsedFeed.medium) !== null && _a !== void 0 ? _a : podcast_partytime_1.Phase4Medium.Podcast)
15
+ });
16
+ };
17
+ exports.compatChannelDto = compatChannelDto;
18
+ const compatChannelAboutDto = (parsedFeed) => {
19
+ var _a;
20
+ return ({
21
+ author: ((_a = (Array.isArray(parsedFeed.author) ? parsedFeed.author : parsedFeed.author ? [parsedFeed.author] : [])) === null || _a === void 0 ? void 0 : _a.join(', ')) || null,
22
+ explicit: (0, podverse_helpers_1.getBooleanOrNull)(parsedFeed.explicit),
23
+ language: parsedFeed.language || null,
24
+ website_link_url: parsedFeed.link || null,
25
+ itunes_type: (0, podverse_orm_1.getChannelItunesTypeItunesTypeEnumValue)(parsedFeed.itunesType || 'episodic')
26
+ });
27
+ };
28
+ exports.compatChannelAboutDto = compatChannelAboutDto;
29
+ const compatChannelChatDto = (parsedFeed) => {
30
+ if (!parsedFeed.chat) {
31
+ return null;
32
+ }
33
+ return {
34
+ server: parsedFeed.chat.server,
35
+ protocol: parsedFeed.chat.protocol,
36
+ account_id: parsedFeed.chat.accountId || null,
37
+ space: parsedFeed.chat.space || null
38
+ };
39
+ };
40
+ exports.compatChannelChatDto = compatChannelChatDto;
41
+ const compatChannelDescriptionDto = (parsedFeed) => {
42
+ if (!parsedFeed.description) {
43
+ return null;
44
+ }
45
+ return {
46
+ value: parsedFeed.description
47
+ };
48
+ };
49
+ exports.compatChannelDescriptionDto = compatChannelDescriptionDto;
50
+ const compatChannelFundingDtos = (parsedFeed) => {
51
+ const dtos = [];
52
+ if (Array.isArray(parsedFeed.podcastFunding)) {
53
+ for (const f of parsedFeed.podcastFunding) {
54
+ if (f.url) {
55
+ dtos.push({
56
+ url: f.url,
57
+ title: f.message || null
58
+ });
59
+ }
60
+ }
61
+ }
62
+ return dtos;
63
+ };
64
+ exports.compatChannelFundingDtos = compatChannelFundingDtos;
65
+ const compatChannelImageDtos = (parsedFeed) => {
66
+ var _a;
67
+ const dtos = [];
68
+ if (parsedFeed.itunesImage) {
69
+ dtos.push({
70
+ url: parsedFeed.itunesImage,
71
+ image_width_size: null
72
+ });
73
+ }
74
+ else if ((_a = parsedFeed.image) === null || _a === void 0 ? void 0 : _a.url) {
75
+ dtos.push({
76
+ url: parsedFeed.image.url,
77
+ image_width_size: null
78
+ });
79
+ }
80
+ function hasWidth(image) {
81
+ return image.width !== undefined;
82
+ }
83
+ if (Array.isArray(parsedFeed.podcastImages)) {
84
+ for (const image of parsedFeed.podcastImages) {
85
+ if (image.parsed.url && hasWidth(image.parsed)) {
86
+ dtos.push({
87
+ url: image.parsed.url,
88
+ image_width_size: image.parsed.width
89
+ });
90
+ }
91
+ }
92
+ }
93
+ return dtos;
94
+ };
95
+ exports.compatChannelImageDtos = compatChannelImageDtos;
96
+ const compatChannelLicenseDto = (parsedFeed) => {
97
+ var _a;
98
+ if (!((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.license) === null || _a === void 0 ? void 0 : _a.identifier)) {
99
+ return null;
100
+ }
101
+ return {
102
+ identifier: parsedFeed.license.identifier,
103
+ url: parsedFeed.license.url || null
104
+ };
105
+ };
106
+ exports.compatChannelLicenseDto = compatChannelLicenseDto;
107
+ const compatChannelLocationDto = (parsedFeed) => {
108
+ var _a, _b;
109
+ if (!((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.podcastLocation) === null || _a === void 0 ? void 0 : _a.geo) && !((_b = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.podcastLocation) === null || _b === void 0 ? void 0 : _b.osm)) {
110
+ return null;
111
+ }
112
+ return {
113
+ geo: parsedFeed.podcastLocation.geo || null,
114
+ osm: parsedFeed.podcastLocation.osm || null,
115
+ name: parsedFeed.podcastLocation.name || null
116
+ };
117
+ };
118
+ exports.compatChannelLocationDto = compatChannelLocationDto;
119
+ const compatChannelPersonDtos = (parsedFeed) => {
120
+ var _a, _b;
121
+ const dtos = [];
122
+ if (Array.isArray(parsedFeed.podcastPeople)) {
123
+ for (const p of parsedFeed.podcastPeople) {
124
+ if (p.name) {
125
+ dtos.push({
126
+ name: p.name,
127
+ role: ((_a = p.role) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || null,
128
+ person_group: ((_b = p.group) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || 'cast',
129
+ img: p.img || null,
130
+ href: p.href || null
131
+ });
132
+ }
133
+ }
134
+ }
135
+ return dtos;
136
+ };
137
+ exports.compatChannelPersonDtos = compatChannelPersonDtos;
138
+ const compatChannelPodrollRemoteItemDtos = (parsedFeed) => {
139
+ const dtos = [];
140
+ if (Array.isArray(parsedFeed.podroll)) {
141
+ for (const ri of parsedFeed.podroll) {
142
+ if (ri.feedGuid) {
143
+ dtos.push({
144
+ feed_guid: ri.feedGuid,
145
+ feed_url: ri.feedUrl || null,
146
+ item_guid: null,
147
+ title: /* PTDO: ri.title || */ null
148
+ });
149
+ }
150
+ }
151
+ }
152
+ return dtos;
153
+ };
154
+ exports.compatChannelPodrollRemoteItemDtos = compatChannelPodrollRemoteItemDtos;
155
+ const compatChannelPublisherRemoteItemDtos = (parsedFeed) => {
156
+ const dtos = [];
157
+ if (Array.isArray(parsedFeed.podroll)) {
158
+ for (const ri of parsedFeed.podroll) {
159
+ if (ri.feedGuid) {
160
+ dtos.push({
161
+ feed_guid: ri.feedGuid,
162
+ feed_url: ri.feedUrl || null,
163
+ item_guid: null,
164
+ title: /* PTDO: ri.title || */ null
165
+ });
166
+ }
167
+ }
168
+ }
169
+ return dtos;
170
+ };
171
+ exports.compatChannelPublisherRemoteItemDtos = compatChannelPublisherRemoteItemDtos;
172
+ const compatChannelRemoteItemDtos = (parsedFeed) => {
173
+ const dtos = [];
174
+ if (Array.isArray(parsedFeed.podcastRemoteItems)) {
175
+ for (const ri of parsedFeed.podcastRemoteItems) {
176
+ if (ri.feedGuid) {
177
+ dtos.push({
178
+ feed_guid: ri.feedGuid,
179
+ feed_url: ri.feedUrl || null,
180
+ item_guid: null,
181
+ title: /* PTDO: ri.title || */ null
182
+ });
183
+ }
184
+ }
185
+ }
186
+ return dtos;
187
+ };
188
+ exports.compatChannelRemoteItemDtos = compatChannelRemoteItemDtos;
189
+ const compatChannelSocialInteractDtos = (parsedFeed) => {
190
+ var _a;
191
+ const dtos = [];
192
+ if ((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.podcastSocial) === null || _a === void 0 ? void 0 : _a.length) {
193
+ for (const ps of parsedFeed.podcastSocial) {
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.name || null,
200
+ priority: ps.priority || null
201
+ });
202
+ }
203
+ }
204
+ return dtos;
205
+ };
206
+ exports.compatChannelSocialInteractDtos = compatChannelSocialInteractDtos;
207
+ const compatChannelSeasonDtos = (parsedFeed) => {
208
+ var _a, _b;
209
+ const dtos = [];
210
+ const parsedItems = (parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.items) || [];
211
+ const seasonsIndex = {};
212
+ for (const parsedItem of parsedItems) {
213
+ const seasonNumber = ((_a = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastSeason) === null || _a === void 0 ? void 0 : _a.number) || (parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.itunesSeason);
214
+ const seasonName = ((_b = parsedItem === null || parsedItem === void 0 ? void 0 : parsedItem.podcastSeason) === null || _b === void 0 ? void 0 : _b.name) || null;
215
+ if (Number.isInteger(seasonNumber)) {
216
+ const seasonNumberAsNumber = seasonNumber;
217
+ seasonsIndex[seasonNumberAsNumber] = {
218
+ name: seasonName
219
+ };
220
+ }
221
+ }
222
+ for (const [number, { name }] of Object.entries(seasonsIndex)) {
223
+ dtos.push({
224
+ number: parseInt(number),
225
+ name: name || null
226
+ });
227
+ }
228
+ return dtos;
229
+ };
230
+ exports.compatChannelSeasonDtos = compatChannelSeasonDtos;
231
+ const compatChannelTrailerDtos = (parsedFeed) => {
232
+ var _a;
233
+ const dtos = [];
234
+ if ((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.trailers) === null || _a === void 0 ? void 0 : _a.length) {
235
+ for (const pt of parsedFeed.trailers) {
236
+ dtos.push({
237
+ url: pt.url,
238
+ title: /* PTDO: add pt.title || */ null,
239
+ pubdate: pt.pubdate,
240
+ length: pt.length || null,
241
+ type: pt.type || null,
242
+ season: pt.season || null
243
+ });
244
+ }
245
+ }
246
+ return dtos;
247
+ };
248
+ exports.compatChannelTrailerDtos = compatChannelTrailerDtos;
249
+ const compatChannelTxtDtos = (parsedFeed) => {
250
+ var _a;
251
+ const dtos = [];
252
+ if ((_a = parsedFeed === null || parsedFeed === void 0 ? void 0 : parsedFeed.podcastTxt) === null || _a === void 0 ? void 0 : _a.length) {
253
+ for (const pt of parsedFeed.podcastTxt) {
254
+ dtos.push({
255
+ purpose: pt.purpose || null,
256
+ value: pt.value
257
+ });
258
+ }
259
+ }
260
+ return dtos;
261
+ };
262
+ exports.compatChannelTxtDtos = compatChannelTxtDtos;
263
+ const compatChannelValueDtos = (parsedFeed) => {
264
+ let dtos = [];
265
+ if (parsedFeed.value) {
266
+ const dto = (0, value_1.compatChannelValue)(parsedFeed.value);
267
+ const formattedDto = {
268
+ channel_value: {
269
+ type: dto.type,
270
+ method: dto.method,
271
+ suggested: dto.suggested || null
272
+ },
273
+ channel_value_recipients: dto.channel_value_recipients
274
+ };
275
+ dtos.push(formattedDto);
276
+ }
277
+ return dtos;
278
+ };
279
+ exports.compatChannelValueDtos = compatChannelValueDtos;
@@ -0,0 +1,11 @@
1
+ import { ItemChapterDto } from 'podverse-orm';
2
+ export type PIChapter = {
3
+ startTime: string;
4
+ endTime: string | null;
5
+ title: string | null;
6
+ img: string | null;
7
+ url: string | null;
8
+ toc: boolean;
9
+ };
10
+ export declare const compatParsedChapters: (chapters: PIChapter[]) => ItemChapterDto[];
11
+ //# sourceMappingURL=chapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chapters.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/chapters/chapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,OAAO,CAAA;CACb,CAAA;AAED,eAAO,MAAM,oBAAoB,aAAc,SAAS,EAAE,KAAG,cAAc,EAW1E,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compatParsedChapters = void 0;
4
+ const compatParsedChapters = (chapters) => {
5
+ return chapters.map(chapter => {
6
+ return {
7
+ start_time: chapter.startTime,
8
+ end_time: chapter.endTime || null,
9
+ title: chapter.title || null,
10
+ img: chapter.img || null,
11
+ web_url: chapter.url || null,
12
+ table_of_contents: chapter.toc || true
13
+ };
14
+ });
15
+ };
16
+ exports.compatParsedChapters = compatParsedChapters;
@@ -0,0 +1,110 @@
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
+ last_pub_date: Date | null;
13
+ website_link_url: string | null;
14
+ itunes_type: import("podverse-orm").ChannelItunesTypeItunesTypeEnum;
15
+ episode_count: number;
16
+ };
17
+ export declare const compatChannelChatDto: (parsedFeed: FeedObject) => {
18
+ server: string;
19
+ protocol: string;
20
+ account_id: string | null;
21
+ space: string | null;
22
+ } | null;
23
+ export declare const compatChannelDescriptionDto: (parsedFeed: FeedObject) => {
24
+ value: string;
25
+ } | null;
26
+ export declare const compatChannelFundingDtos: (parsedFeed: FeedObject) => {
27
+ url: string;
28
+ title: string | null;
29
+ }[];
30
+ export declare const compatChannelImageDtos: (parsedFeed: FeedObject) => ({
31
+ url: string;
32
+ image_width_size: null;
33
+ } | {
34
+ url: string;
35
+ image_width_size: number;
36
+ })[];
37
+ export declare const compatChannelLicenseDto: (parsedFeed: FeedObject) => {
38
+ identifier: string;
39
+ url: string | null;
40
+ } | null;
41
+ export declare const compatChannelLocationDto: (parsedFeed: FeedObject) => {
42
+ geo: string | null;
43
+ osm: string | null;
44
+ name: string | null;
45
+ } | null;
46
+ export declare const compatChannelPersonDtos: (parsedFeed: FeedObject) => {
47
+ name: string;
48
+ role: string | null;
49
+ person_group: string;
50
+ img: string | null;
51
+ href: string | null;
52
+ }[];
53
+ export declare const compatChannelPodrollRemoteItemDtos: (parsedFeed: FeedObject) => {
54
+ feed_guid: string;
55
+ feed_url: string | null;
56
+ item_guid: null;
57
+ title: null;
58
+ }[];
59
+ export declare const compatChannelPublisherRemoteItemDtos: (parsedFeed: FeedObject) => {
60
+ feed_guid: string;
61
+ feed_url: string | null;
62
+ item_guid: null;
63
+ title: null;
64
+ }[];
65
+ export declare const compatChannelRemoteItemDtos: (parsedFeed: FeedObject) => {
66
+ feed_guid: string;
67
+ feed_url: string | null;
68
+ item_guid: null;
69
+ title: null;
70
+ }[];
71
+ export declare const compatChannelSocialInteractDtos: (parsedFeed: FeedObject) => {
72
+ protocol: string;
73
+ uri: string;
74
+ account_id: string | null;
75
+ account_url: string | null;
76
+ priority: number | null;
77
+ }[];
78
+ export declare const compatChannelSeasonDtos: (parsedFeed: FeedObject) => {
79
+ number: number;
80
+ name: string | null;
81
+ }[];
82
+ export declare const compatChannelTrailerDtos: (parsedFeed: FeedObject) => {
83
+ url: string;
84
+ title: null;
85
+ pubdate: Date;
86
+ length: number | null;
87
+ type: string | null;
88
+ season: number | null;
89
+ }[];
90
+ export declare const compatChannelTxtDtos: (parsedFeed: FeedObject) => {
91
+ purpose: string | null;
92
+ value: string;
93
+ }[];
94
+ export declare const compatChannelValueDtos: (parsedFeed: FeedObject) => {
95
+ channel_value: {
96
+ type: string;
97
+ method: string;
98
+ suggested: number | null;
99
+ };
100
+ channel_value_recipients: {
101
+ type: string;
102
+ address: string;
103
+ split: number;
104
+ name: string | null;
105
+ custom_key: string | null;
106
+ custom_value: string | null;
107
+ fee: boolean;
108
+ }[];
109
+ }[];
110
+ //# sourceMappingURL=channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/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;;;;;;;;CAQ1D,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"}