podverse-parser 5.1.13-alpha.0 → 5.1.14-alpha.0
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/dist/lib/compat/partytime/channel.d.ts.map +1 -1
- package/dist/lib/compat/partytime/channel.js +9 -4
- package/dist/lib/compat/partytime/publisher.d.ts +3 -0
- package/dist/lib/compat/partytime/publisher.d.ts.map +1 -0
- package/dist/lib/compat/partytime/publisher.js +39 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,oBAAoB,CAAC;AAQ9D,eAAO,MAAM,gBAAgB,GAAI,YAAY,UAAU;;;;;CAWtD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,YAAY,UAAU;;;;;;;;CAqB1D,CAAC;AAEH,eAAO,MAAM,yBAAyB,GAAI,YAAY,UAAU;;GAU/D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,UAAU;;;;;QAU1D,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,YAAY,UAAU;;QAOjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;GAe9D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU;;;;;;IA8B5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;QAQ7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;;QAU9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;;;;GAkB7D,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,YAAY,UAAU;;;;;GAgBxE,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAAI,YAAY,UAAU;;;;;GAa1E,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,YAAY,UAAU;;;;;GAiBjE,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,YAAY,UAAU;;;;;;GAiBrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU;;;GA0B7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,YAAY,UAAU;;;;;;;GAkB9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,UAAU;;;GAY1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU;;;;;;;;;;;;;;;GAiB5D,CAAC"}
|
|
@@ -5,13 +5,18 @@ const podverse_partytime_1 = require("podverse-partytime");
|
|
|
5
5
|
const podverse_helpers_1 = require("podverse-helpers");
|
|
6
6
|
const podverse_orm_1 = require("podverse-orm");
|
|
7
7
|
const value_1 = require("@parser/lib/compat/partytime/value");
|
|
8
|
+
const publisher_1 = require("./publisher");
|
|
8
9
|
const compatChannelDto = (parsedFeed) => {
|
|
9
10
|
var _a, _b, _c, _d;
|
|
11
|
+
let medium_id = (0, podverse_helpers_1.getMediumEnumValue)((_a = parsedFeed.medium) !== null && _a !== void 0 ? _a : podverse_partytime_1.Phase4Medium.Podcast);
|
|
12
|
+
const detected = (0, publisher_1.detectDuckTypedPublisherMediumId)(parsedFeed);
|
|
13
|
+
if (detected !== null)
|
|
14
|
+
medium_id = detected;
|
|
10
15
|
return {
|
|
11
|
-
podcast_guid: ((
|
|
12
|
-
title: ((
|
|
13
|
-
sortable_title: ((
|
|
14
|
-
medium_id
|
|
16
|
+
podcast_guid: ((_b = parsedFeed.guid) === null || _b === void 0 ? void 0 : _b.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_guid)) || null,
|
|
17
|
+
title: ((_c = parsedFeed.title) === null || _c === void 0 ? void 0 : _c.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_normal)) || null,
|
|
18
|
+
sortable_title: ((_d = (0, podverse_helpers_1.createSortableTitle)(parsedFeed.title)) === null || _d === void 0 ? void 0 : _d.slice(0, podverse_helpers_1.DATABASE_CONSTANTS.varchar_short)) || null,
|
|
19
|
+
medium_id
|
|
15
20
|
};
|
|
16
21
|
};
|
|
17
22
|
exports.compatChannelDto = compatChannelDto;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../../../../src/lib/compat/partytime/publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,eAAO,MAAM,gCAAgC,GAAI,YAAY,UAAU,iDA6BtE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectDuckTypedPublisherMediumId = void 0;
|
|
4
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
5
|
+
// Determine the most-appropriate publisher medium based on podcastRemoteItems
|
|
6
|
+
const detectDuckTypedPublisherMediumId = (parsedFeed) => {
|
|
7
|
+
const mediumRaw = parsedFeed.medium;
|
|
8
|
+
const isPublisher = (typeof mediumRaw === 'string' && mediumRaw.toLowerCase() === 'publisher');
|
|
9
|
+
if (!isPublisher)
|
|
10
|
+
return null;
|
|
11
|
+
let countPodcast = 0;
|
|
12
|
+
let countVideo = 0;
|
|
13
|
+
let countMusic = 0;
|
|
14
|
+
if (Array.isArray(parsedFeed.podcastRemoteItems)) {
|
|
15
|
+
for (const ri of parsedFeed.podcastRemoteItems) {
|
|
16
|
+
const m = ((ri === null || ri === void 0 ? void 0 : ri.medium) || '').toString().toLowerCase();
|
|
17
|
+
if (!m)
|
|
18
|
+
continue;
|
|
19
|
+
if (m.includes('music'))
|
|
20
|
+
countMusic++;
|
|
21
|
+
else if (m.includes('video'))
|
|
22
|
+
countVideo++;
|
|
23
|
+
else if (m.includes('podcast'))
|
|
24
|
+
countPodcast++;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const maxCount = Math.max(countPodcast, countVideo, countMusic);
|
|
28
|
+
if (maxCount === 0) {
|
|
29
|
+
return (0, podverse_helpers_1.getMediumEnumValue)('podcast');
|
|
30
|
+
}
|
|
31
|
+
else if (maxCount === countVideo) {
|
|
32
|
+
return (0, podverse_helpers_1.getMediumEnumValue)('publishervideo');
|
|
33
|
+
}
|
|
34
|
+
else if (maxCount === countMusic) {
|
|
35
|
+
return (0, podverse_helpers_1.getMediumEnumValue)('publishermusic');
|
|
36
|
+
}
|
|
37
|
+
return (0, podverse_helpers_1.getMediumEnumValue)('publisherpodcast');
|
|
38
|
+
};
|
|
39
|
+
exports.detectDuckTypedPublisherMediumId = detectDuckTypedPublisherMediumId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podverse-parser",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.14-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"license": "AGPLv3",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"module-alias": "^2.2.3",
|
|
20
|
-
"podverse-external-services": "^5.1.
|
|
21
|
-
"podverse-helpers": "^5.1.
|
|
22
|
-
"podverse-orm": "^5.1.
|
|
20
|
+
"podverse-external-services": "^5.1.14-alpha.0",
|
|
21
|
+
"podverse-helpers": "^5.1.14-alpha.0",
|
|
22
|
+
"podverse-orm": "^5.1.14-alpha.0",
|
|
23
23
|
"podverse-partytime": "^5.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|