@pixwel/pixwel-sdk 1.1.8 → 1.1.10
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/coverage/clover.xml +138 -132
- package/coverage/coverage-final.json +8 -8
- package/coverage/lcov-report/Ass.js.html +212 -216
- package/coverage/lcov-report/Asset.js.html +25 -29
- package/coverage/lcov-report/Filename.js.html +257 -261
- package/coverage/lcov-report/Ingest.js.html +608 -600
- package/coverage/lcov-report/IngestFile.js.html +8 -12
- package/coverage/lcov-report/Order.js.html +51 -55
- package/coverage/lcov-report/Srt.js.html +112 -116
- package/coverage/lcov-report/Sub.js.html +40 -44
- package/coverage/lcov-report/TimeFormat.js.html +61 -65
- package/coverage/lcov-report/base.css +3 -14
- package/coverage/lcov-report/index.html +33 -37
- package/coverage/lcov.info +285 -279
- package/dist/src/Filename.js +10 -10
- package/dist/src/Ingest.js +4 -0
- package/package.json +1 -1
- package/src/Filename.js +10 -10
- package/src/Ingest.js +4 -0
- package/test/Ingest.spec.js +12 -0
package/dist/src/Filename.js
CHANGED
|
@@ -45,19 +45,19 @@ var Filename = function () {
|
|
|
45
45
|
var mediaType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
|
46
46
|
|
|
47
47
|
if (!asset.project) {
|
|
48
|
-
throw "missing asset.project";
|
|
48
|
+
throw new Error("missing asset.project");
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (asset.project && !asset.project.filePrefix) {
|
|
52
|
-
throw "missing asset.project.filePrefix";
|
|
52
|
+
throw new Error("missing asset.project.filePrefix");
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (!asset.name) {
|
|
56
|
-
throw "missing asset.name";
|
|
56
|
+
throw new Error("missing asset.name");
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
if (!asset.type) {
|
|
60
|
-
throw "missing asset.type";
|
|
60
|
+
throw new Error("missing asset.type");
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
var defaults = {
|
|
@@ -82,23 +82,23 @@ var Filename = function () {
|
|
|
82
82
|
options = _lodash2.default.merge(defaults, options);
|
|
83
83
|
|
|
84
84
|
if (!options.language) {
|
|
85
|
-
throw "missing options.language";
|
|
85
|
+
throw new Error("missing options.language");
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (mediaType && mediaType == "video" && !options.tags.Codec) {
|
|
89
|
-
throw "missing options.tags.Codec";
|
|
89
|
+
throw new Error("missing options.tags.Codec");
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
if (mediaType && mediaType == "video" && !options.tags.Resolution) {
|
|
93
|
-
throw "missing options.tags.Resolution";
|
|
93
|
+
throw new Error("missing options.tags.Resolution");
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
if (mediaType && mediaType == "video" && !options.tags.Framerate) {
|
|
97
|
-
throw "missing options.tags.Framerate";
|
|
97
|
+
throw new Error("missing options.tags.Framerate");
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
if (mediaType == "video" && !options.tags["Frame Mode"]) {
|
|
101
|
-
throw "missing options.tags[Frame Mode]";
|
|
101
|
+
throw new Error("missing options.tags[Frame Mode]");
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function assetType(asset, types) {
|
|
@@ -108,7 +108,7 @@ var Filename = function () {
|
|
|
108
108
|
|
|
109
109
|
var matchingType = _lodash2.default.find(types, { name: asset.type });
|
|
110
110
|
if (!matchingType) {
|
|
111
|
-
throw "Asset type \"" + asset.type + "\" could not be found";
|
|
111
|
+
throw new Error("Asset type \"" + asset.type + "\" could not be found");
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
return matchingType.file || matchingType.name.replace(".", "-").toUpperCase();
|
package/dist/src/Ingest.js
CHANGED
|
@@ -312,6 +312,10 @@ var Ingest = function () {
|
|
|
312
312
|
ingest.selected.asset = filename.asset._id;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
+
if (order.asset) {
|
|
316
|
+
ingest.selected.asset = order.asset;
|
|
317
|
+
}
|
|
318
|
+
|
|
315
319
|
if (ingest.workRequest) {
|
|
316
320
|
ingest.selected.project = ingest.context.project;
|
|
317
321
|
ingest.selected.asset = ingest.context.asset;
|
package/package.json
CHANGED
package/src/Filename.js
CHANGED
|
@@ -24,19 +24,19 @@ export default class Filename {
|
|
|
24
24
|
mediaType = ""
|
|
25
25
|
) {
|
|
26
26
|
if (!asset.project) {
|
|
27
|
-
throw "missing asset.project";
|
|
27
|
+
throw new Error("missing asset.project");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
if (asset.project && !asset.project.filePrefix) {
|
|
31
|
-
throw "missing asset.project.filePrefix";
|
|
31
|
+
throw new Error("missing asset.project.filePrefix");
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (!asset.name) {
|
|
35
|
-
throw "missing asset.name";
|
|
35
|
+
throw new Error("missing asset.name");
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (!asset.type) {
|
|
39
|
-
throw "missing asset.type";
|
|
39
|
+
throw new Error("missing asset.type");
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
let defaults = {
|
|
@@ -61,23 +61,23 @@ export default class Filename {
|
|
|
61
61
|
options = _.merge(defaults, options);
|
|
62
62
|
|
|
63
63
|
if (!options.language) {
|
|
64
|
-
throw "missing options.language";
|
|
64
|
+
throw new Error("missing options.language");
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (mediaType && mediaType == "video" && !options.tags.Codec) {
|
|
68
|
-
throw "missing options.tags.Codec";
|
|
68
|
+
throw new Error("missing options.tags.Codec");
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
if (mediaType && mediaType == "video" && !options.tags.Resolution) {
|
|
72
|
-
throw "missing options.tags.Resolution";
|
|
72
|
+
throw new Error("missing options.tags.Resolution");
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
if (mediaType && mediaType == "video" && !options.tags.Framerate) {
|
|
76
|
-
throw "missing options.tags.Framerate";
|
|
76
|
+
throw new Error("missing options.tags.Framerate");
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
if (mediaType == "video" && !options.tags["Frame Mode"]) {
|
|
80
|
-
throw "missing options.tags[Frame Mode]";
|
|
80
|
+
throw new Error("missing options.tags[Frame Mode]");
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
function assetType(asset, types) {
|
|
@@ -87,7 +87,7 @@ export default class Filename {
|
|
|
87
87
|
|
|
88
88
|
let matchingType = _.find(types, { name: asset.type });
|
|
89
89
|
if (!matchingType) {
|
|
90
|
-
throw `Asset type "${asset.type}" could not be found
|
|
90
|
+
throw new Error(`Asset type "${asset.type}" could not be found`);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
return (
|
package/src/Ingest.js
CHANGED
|
@@ -284,6 +284,10 @@ export default class Ingest {
|
|
|
284
284
|
ingest.selected.asset = filename.asset._id;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
if (order.asset) {
|
|
288
|
+
ingest.selected.asset = order.asset;
|
|
289
|
+
}
|
|
290
|
+
|
|
287
291
|
if (ingest.workRequest) {
|
|
288
292
|
ingest.selected.project = ingest.context.project;
|
|
289
293
|
ingest.selected.asset = ingest.context.asset;
|
package/test/Ingest.spec.js
CHANGED
|
@@ -27,6 +27,18 @@ describe("Ingest", () => {
|
|
|
27
27
|
expect(ingest.selected.download.language).toBe("ENG");
|
|
28
28
|
expect(ingest.selected.download.country).toBe("US");
|
|
29
29
|
});
|
|
30
|
+
it('should use asset from order when available', () => {
|
|
31
|
+
let original = {
|
|
32
|
+
context: {}
|
|
33
|
+
};
|
|
34
|
+
let filename = {
|
|
35
|
+
asset: { _id: "a1b2c3" }
|
|
36
|
+
};
|
|
37
|
+
let mediainfo = {};
|
|
38
|
+
let order = new Order({ asset: 'z1x2c3' });
|
|
39
|
+
let ingest = Ingest.assemble(original, filename, mediainfo, order);
|
|
40
|
+
expect(ingest.selected.asset).toBe("z1x2c3");
|
|
41
|
+
});
|
|
30
42
|
it("should use asset from filename when there is no context", () => {
|
|
31
43
|
let original = {
|
|
32
44
|
context: {}
|