@pixwel/pixwel-sdk 1.1.7 → 1.1.9
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 +469 -3
- package/coverage/coverage-final.json +10 -1
- package/coverage/lcov-report/Ass.js.html +1 -1
- package/coverage/lcov-report/Asset.js.html +25 -25
- package/coverage/lcov-report/Filename.js.html +209 -242
- package/coverage/lcov-report/Ingest.js.html +578 -116
- package/coverage/lcov-report/IngestFile.js.html +1 -1
- package/coverage/lcov-report/IngestFileDrop.js.html +3 -3
- package/coverage/lcov-report/Order.js.html +62 -26
- package/coverage/lcov-report/Srt.js.html +1 -1
- package/coverage/lcov-report/Sub.js.html +1 -1
- package/coverage/lcov-report/TimeFormat.js.html +1 -1
- package/coverage/lcov-report/index.html +128 -11
- package/coverage/lcov.info +967 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +0 -9
- package/dist/src/Filename.js +13 -20
- package/dist/src/Ingest.js +241 -88
- package/dist/src/Order.js +12 -0
- package/index.js +0 -1
- package/package.json +32 -26
- package/src/Filename.js +13 -24
- package/src/Ingest.js +241 -91
- package/src/Order.js +13 -1
- package/test/Filename.spec.js +74 -38
- package/test/Ingest.spec.js +306 -68
- package/test/mocks/mediainfo.mock.js +89 -66
- package/test/mocks/mocks.js +5 -1
- package/test/mocks/prores.mock.js +119 -70
- package/.vscode/launch.json +0 -0
- package/dist/src/IngestFileDrop.js +0 -178
- package/src/IngestFileDrop.js +0 -157
- package/src/docs.json +0 -1
|
@@ -1,67 +1,90 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
2
|
+
File: {
|
|
3
|
+
track: [
|
|
4
|
+
{
|
|
5
|
+
VideoCount: "1",
|
|
6
|
+
AudioCount: "1",
|
|
7
|
+
FileExtension: "mp4",
|
|
8
|
+
Format: "MPEG-4",
|
|
9
|
+
Format_Profile: "QuickTime",
|
|
10
|
+
CodecID: "qt",
|
|
11
|
+
FileSize: "1161190",
|
|
12
|
+
Duration: "10.055",
|
|
13
|
+
OverallBitRate: "923871",
|
|
14
|
+
FrameRate: "23.976",
|
|
15
|
+
FrameCount: "240",
|
|
16
|
+
StreamSize: "8911",
|
|
17
|
+
HeaderSize: "28",
|
|
18
|
+
DataSize: "1152287",
|
|
19
|
+
FooterSize: "8875",
|
|
20
|
+
IsStreamable: "No",
|
|
21
|
+
Encoded_Application: "Lavf57.83.100",
|
|
22
|
+
_type: "General"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
StreamOrder: "0",
|
|
26
|
+
ID: "1",
|
|
27
|
+
Format: "AVC",
|
|
28
|
+
Format_Profile: "High",
|
|
29
|
+
Format_Level: "3",
|
|
30
|
+
Format_Settings_CABAC: "Yes",
|
|
31
|
+
Format_Settings_RefFrames: "4",
|
|
32
|
+
CodecID: "avc1",
|
|
33
|
+
Duration: "10.010",
|
|
34
|
+
BitRate: "791333",
|
|
35
|
+
Width: "640",
|
|
36
|
+
Height: "360",
|
|
37
|
+
Stored_Height: "368",
|
|
38
|
+
Sampled_Width: "640",
|
|
39
|
+
Sampled_Height: "360",
|
|
40
|
+
PixelAspectRatio: "1.000",
|
|
41
|
+
DisplayAspectRatio: "1.778",
|
|
42
|
+
Rotation: "0.000",
|
|
43
|
+
FrameRate_Mode: "CFR",
|
|
44
|
+
FrameRate_Mode_Original: "VFR",
|
|
45
|
+
FrameRate: "23.976",
|
|
46
|
+
FrameCount: "240",
|
|
47
|
+
ColorSpace: "YUV",
|
|
48
|
+
ChromaSubsampling: "4:2:0",
|
|
49
|
+
BitDepth: "8",
|
|
50
|
+
ScanType: "Progressive",
|
|
51
|
+
StreamSize: "990157",
|
|
52
|
+
Encoded_Library: "x264 - core 148 r2795 aaa9aa8",
|
|
53
|
+
Encoded_Library_Name: "x264",
|
|
54
|
+
Encoded_Library_Version: "core 148 r2795 aaa9aa8",
|
|
55
|
+
Encoded_Library_Settings:
|
|
56
|
+
"cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00",
|
|
57
|
+
Language: "en",
|
|
58
|
+
_type: "Video"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
StreamOrder: "1",
|
|
62
|
+
ID: "2",
|
|
63
|
+
Format: "AAC",
|
|
64
|
+
Format_Profile: "LC",
|
|
65
|
+
Format_Settings_SBR: "No (Explicit)",
|
|
66
|
+
CodecID: "mp4a-40-2",
|
|
67
|
+
Duration: "10.055",
|
|
68
|
+
BitRate_Mode: "CBR",
|
|
69
|
+
BitRate: "128997",
|
|
70
|
+
Channels: "2",
|
|
71
|
+
ChannelPositions: "Front: L R",
|
|
72
|
+
ChannelLayout: "L R",
|
|
73
|
+
SamplesPerFrame: "1024",
|
|
74
|
+
SamplingRate: "44100",
|
|
75
|
+
SamplingCount: "443426",
|
|
76
|
+
FrameRate: "43.066",
|
|
77
|
+
FrameCount: "433",
|
|
78
|
+
Compression_Mode: "Lossy",
|
|
79
|
+
StreamSize: "162122",
|
|
80
|
+
StreamSize_Proportion: "0.13962",
|
|
81
|
+
Language: "en",
|
|
82
|
+
Default: "Yes",
|
|
83
|
+
AlternateGroup: "1",
|
|
84
|
+
_type: "Audio"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
_ref:
|
|
88
|
+
"https://pixwel-slurpee2-input-dev-west.s3.amazonaws.com/5b52055b22a1a925008b456c/MI6_TV-SPOT-INTL_TECH-INTL-20_ENG-IE_TXTD_JULY25_H264_1080p.mp4"
|
|
89
|
+
}
|
|
90
|
+
};
|
package/test/mocks/mocks.js
CHANGED
|
@@ -13,10 +13,14 @@ module.exports = {
|
|
|
13
13
|
{ name: 'txtl2', type: 'Text' },
|
|
14
14
|
{ name: 'h264', type: 'Codec'},
|
|
15
15
|
{ name: '1920x1080', type: 'Resolution'},
|
|
16
|
-
|
|
16
|
+
{ name: '1080p', set: ['h264', '1920x1080', 'online']},
|
|
17
|
+
{ name: 'sub', type: 'SubDub'},
|
|
18
|
+
{ name: 'dub', type: 'SubDub'}
|
|
17
19
|
],
|
|
18
20
|
|
|
19
21
|
types: [
|
|
22
|
+
{ name: 'film-clip', category: 'av', group: 'av' },
|
|
23
|
+
{ name: 'featurette', category: 'av', group: 'av' },
|
|
20
24
|
{ name: 'trailer.us', category: 'av', group: 'av' },
|
|
21
25
|
{ name: 'trailer.intl', category: 'av', group: 'av'},
|
|
22
26
|
{ name: 'tv-spot.us', category: 'av', group: 'av' },
|
|
@@ -1,71 +1,120 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
2
|
+
File: {
|
|
3
|
+
track: [
|
|
4
|
+
{
|
|
5
|
+
_type: "General",
|
|
6
|
+
VideoCount: "1",
|
|
7
|
+
AudioCount: "1",
|
|
8
|
+
OtherCount: "1",
|
|
9
|
+
FileExtension: "mp4",
|
|
10
|
+
Format: "MPEG-4",
|
|
11
|
+
Format_Profile: "QuickTime",
|
|
12
|
+
CodecID: "qt",
|
|
13
|
+
FileSize: "132980532",
|
|
14
|
+
Duration: "6.006",
|
|
15
|
+
OverallBitRate_Mode: "VBR",
|
|
16
|
+
OverallBitRate: "177130240",
|
|
17
|
+
FrameRate: "23.976",
|
|
18
|
+
FrameCount: "144",
|
|
19
|
+
StreamSize: "1048580",
|
|
20
|
+
HeaderSize: "1048568",
|
|
21
|
+
DataSize: "131931964",
|
|
22
|
+
FooterSize: "0",
|
|
23
|
+
IsStreamable: "Yes",
|
|
24
|
+
Encoded_Date: "UTC 2018-01-31 17:35:26",
|
|
25
|
+
Tagged_Date: "UTC 2018-01-31 17:36:10",
|
|
26
|
+
File_Modified_Date: "UTC 2018-07-02 23:18:18",
|
|
27
|
+
File_Modified_Date_Local: "2018-07-02 18:18:18",
|
|
28
|
+
Encoded_Library: "Apple QuickTime",
|
|
29
|
+
Encoded_Library_Name: "Apple QuickTime",
|
|
30
|
+
extra: {
|
|
31
|
+
TIM: "01:00:00:00",
|
|
32
|
+
TSC: "24000",
|
|
33
|
+
TSZ: "1001"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
_type: "Video",
|
|
38
|
+
StreamOrder: "0",
|
|
39
|
+
ID: "1",
|
|
40
|
+
Format: "ProRes",
|
|
41
|
+
Format_Version: "0",
|
|
42
|
+
Format_Profile: "422 HQ",
|
|
43
|
+
CodecID: "apch",
|
|
44
|
+
Duration: "6.006",
|
|
45
|
+
BitRate_Mode: "VBR",
|
|
46
|
+
BitRate: "173429362",
|
|
47
|
+
Width: "1920",
|
|
48
|
+
Height: "1080",
|
|
49
|
+
PixelAspectRatio: "1.000",
|
|
50
|
+
DisplayAspectRatio: "1.778",
|
|
51
|
+
Rotation: "0.000",
|
|
52
|
+
FrameRate_Mode: "CFR",
|
|
53
|
+
FrameRate: "23.976",
|
|
54
|
+
FrameCount: "144",
|
|
55
|
+
ColorSpace: "YUV",
|
|
56
|
+
ChromaSubsampling: "4:2:2",
|
|
57
|
+
ScanType: "Progressive",
|
|
58
|
+
Delay: "3600.000",
|
|
59
|
+
StreamSize: "130202224",
|
|
60
|
+
Encoded_Library: "aut0",
|
|
61
|
+
Language: "en",
|
|
62
|
+
Encoded_Date: "UTC 2018-01-31 17:35:26",
|
|
63
|
+
Tagged_Date: "UTC 2018-01-31 17:35:26",
|
|
64
|
+
colour_description_present: "Yes",
|
|
65
|
+
colour_primaries: "BT.709",
|
|
66
|
+
transfer_characteristics: "BT.709",
|
|
67
|
+
matrix_coefficients: "BT.709",
|
|
68
|
+
colour_description_present_Original: "Yes",
|
|
69
|
+
matrix_coefficients_Original: "BT.709",
|
|
70
|
+
extra: {
|
|
71
|
+
Menus: "0"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
_type: "Audio",
|
|
76
|
+
StreamOrder: "1",
|
|
77
|
+
ID: "2",
|
|
78
|
+
Format: "PCM",
|
|
79
|
+
Format_Settings_Endianness: "Little",
|
|
80
|
+
Format_Settings_Sign: "Signed",
|
|
81
|
+
CodecID: "in24",
|
|
82
|
+
Duration: "6.006",
|
|
83
|
+
BitRate_Mode: "CBR",
|
|
84
|
+
BitRate: "2304000",
|
|
85
|
+
Channels: "2",
|
|
86
|
+
ChannelPositions: "Front: L R",
|
|
87
|
+
ChannelLayout: "L R",
|
|
88
|
+
SamplingRate: "48000",
|
|
89
|
+
SamplingCount: "288288",
|
|
90
|
+
BitDepth: "24",
|
|
91
|
+
Delay: "3600.000",
|
|
92
|
+
Delay_DropFrame: "No",
|
|
93
|
+
Delay_Source: "Container",
|
|
94
|
+
StreamSize: "1729728",
|
|
95
|
+
StreamSize_Proportion: "0.01301",
|
|
96
|
+
Language: "en",
|
|
97
|
+
Encoded_Date: "UTC 2018-01-31 17:35:26",
|
|
98
|
+
Tagged_Date: "UTC 2018-01-31 17:35:26",
|
|
99
|
+
extra: {
|
|
100
|
+
Menus: "0"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
_type: "Other",
|
|
105
|
+
StreamOrder: "2",
|
|
106
|
+
ID: "3",
|
|
107
|
+
Type: "Time code",
|
|
108
|
+
Format: "QuickTime TC",
|
|
109
|
+
Duration: "6.006",
|
|
110
|
+
TimeCode_FirstFrame: "01:00:00:00",
|
|
111
|
+
TimeCode_Striped: "Yes",
|
|
112
|
+
Language: "en",
|
|
113
|
+
extra: {
|
|
114
|
+
Encoded_Date: "UTC 2018-01-31 17:35:26",
|
|
115
|
+
Tagged_Date: "UTC 2018-01-31 17:35:26"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
};
|
package/.vscode/launch.json
DELETED
|
File without changes
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
-
|
|
9
|
-
var _pixwelSdk = require("@pixwel/pixwel-sdk");
|
|
10
|
-
|
|
11
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Collects file handles from HTML5, full paths from Aspera, inspects
|
|
15
|
-
* the dropped file using mediainfo, then renames the file according to
|
|
16
|
-
* the data from Mediainfo and the Order and submits it for upload.
|
|
17
|
-
* @type {Object}
|
|
18
|
-
*/
|
|
19
|
-
var IngestFileDrop = function () {
|
|
20
|
-
/**
|
|
21
|
-
* Map that contains data from HTML5 file drop and Aspera file drop
|
|
22
|
-
* @type {Object}
|
|
23
|
-
*/
|
|
24
|
-
function IngestFileDrop(scope, Mediainfo, IngestUpload) {
|
|
25
|
-
_classCallCheck(this, IngestFileDrop);
|
|
26
|
-
|
|
27
|
-
this.map = {};
|
|
28
|
-
this.scope = scope;
|
|
29
|
-
this.IngestUpload = IngestUpload;
|
|
30
|
-
this.Mediainfo = Mediainfo;
|
|
31
|
-
this.asperaDropHandler = this.asperaDropHandler.bind(this);
|
|
32
|
-
this.htmlDropHandler = this.htmlDropHandler.bind(this);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* HTML file drop handler
|
|
36
|
-
* @param {[type]} e [description]
|
|
37
|
-
* @return {[type]} [description]
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_createClass(IngestFileDrop, [{
|
|
42
|
-
key: "htmlDropHandler",
|
|
43
|
-
value: function htmlDropHandler(e) {
|
|
44
|
-
var files = e.dataTransfer.files;
|
|
45
|
-
for (var i = 0; i < files.length; i++) {
|
|
46
|
-
this.registerHtmlFile(files[i]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Aspera drop handler
|
|
51
|
-
* @param {[type]} data [description]
|
|
52
|
-
* @return {[type]} [description]
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
}, {
|
|
56
|
-
key: "asperaDropHandler",
|
|
57
|
-
value: function asperaDropHandler(data) {
|
|
58
|
-
var that = this;
|
|
59
|
-
var files = data.files.dataTransfer.files;
|
|
60
|
-
if (!files.length) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
for (var i = 0; i < files.length; i++) {
|
|
64
|
-
this.registerAsperaFile(files[i]);
|
|
65
|
-
}
|
|
66
|
-
return Promise.all(this.export()).then(function (renamed) {
|
|
67
|
-
that.IngestUpload.uploadFiles(renamed, {}).then(function () {
|
|
68
|
-
that.map = {};
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Registers and HTML file drop
|
|
74
|
-
* @param {[type]} file [description]
|
|
75
|
-
* @return {[type]} [description]
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
}, {
|
|
79
|
-
key: "registerHtmlFile",
|
|
80
|
-
value: function registerHtmlFile(file) {
|
|
81
|
-
this.map[file.name] = file;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Registers and Aspera file drop
|
|
85
|
-
* @param {[type]} file [description]
|
|
86
|
-
* @return {[type]} [description]
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
}, {
|
|
90
|
-
key: "registerAsperaFile",
|
|
91
|
-
value: function registerAsperaFile(file) {
|
|
92
|
-
var basename = this.getBasename(file);
|
|
93
|
-
this.map[basename]["path"] = file.name;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Gets correct basename for MacOS and Windows
|
|
97
|
-
* @param {[type]} file [description]
|
|
98
|
-
* @return {[type]} [description]
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
}, {
|
|
102
|
-
key: "getBasename",
|
|
103
|
-
value: function getBasename(file) {
|
|
104
|
-
return file.name[0] === "/" ? file.name.split("/").pop() : file.name.split("\\").pop();
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Renames and generates ingest record for internal filemap
|
|
108
|
-
* @return {[type]} [description]
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
}, {
|
|
112
|
-
key: "export",
|
|
113
|
-
value: function _export() {
|
|
114
|
-
var that = this;
|
|
115
|
-
return Object.values(this.map).map(function (file) {
|
|
116
|
-
return that.rename(file);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Renames the file and decorates it with ingest data using data from
|
|
121
|
-
* mediainfo and the Order
|
|
122
|
-
* @param {[type]} file [description]
|
|
123
|
-
* @return {[type]} [description]
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
}, {
|
|
127
|
-
key: "rename",
|
|
128
|
-
value: function rename(file) {
|
|
129
|
-
var that = this;
|
|
130
|
-
return this.Mediainfo.inform(file).then(function (meta) {
|
|
131
|
-
var order = void 0;
|
|
132
|
-
var asset = void 0;
|
|
133
|
-
var mediaType = file.type.split("/")[0];
|
|
134
|
-
|
|
135
|
-
var tags = _pixwelSdk.Ingest.mapMetaToTags(meta, mediaType);
|
|
136
|
-
|
|
137
|
-
if (!that.scope.workRequest) {
|
|
138
|
-
order = new _pixwelSdk.Order();
|
|
139
|
-
asset = new _pixwelSdk.Asset();
|
|
140
|
-
tags.Text = "txtd";
|
|
141
|
-
file.ingest = _pixwelSdk.Ingest.mapFromKnownData(that.scope.context, order, tags, that.scope.watermarks);
|
|
142
|
-
return file;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
order = new _pixwelSdk.Order(that.scope.workRequest);
|
|
146
|
-
asset = _pixwelSdk.Asset.mapFromOrder(order);
|
|
147
|
-
|
|
148
|
-
var options = {
|
|
149
|
-
tags: tags,
|
|
150
|
-
country: order.country,
|
|
151
|
-
language: order.language
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
if (that.scope.request && that.scope.request.tag) {
|
|
155
|
-
options.tags.Extra = [that.scope.request.tag.replace(" ", "-")];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
options.tags.SubDub = {
|
|
159
|
-
sub: order.isSub(),
|
|
160
|
-
dub: order.isDub()
|
|
161
|
-
};
|
|
162
|
-
if (!order.isSub() && !order.isDub()) {
|
|
163
|
-
options.tags.Text = "txtd";
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
var basename = _pixwelSdk.Filename.render(that.scope.tags, that.scope.assetTypes, asset, options, mediaType);
|
|
167
|
-
var extension = file.name.split(".").pop();
|
|
168
|
-
file.renderedName = basename + "." + extension;
|
|
169
|
-
file.ingest = _pixwelSdk.Ingest.mapFromKnownData(that.scope.context, order, tags, that.scope.watermarks);
|
|
170
|
-
return file;
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}]);
|
|
174
|
-
|
|
175
|
-
return IngestFileDrop;
|
|
176
|
-
}();
|
|
177
|
-
|
|
178
|
-
exports.default = IngestFileDrop;
|