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 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10 |
|
11 | var Cue = exports.Cue = function Cue() {
|
12 | return {
|
13 | start: 0,
|
14 | end: 0,
|
15 | text: ''
|
16 | };
|
17 | };
|
18 |
|
19 | var textStyle = exports.textStyle = function textStyle() {
|
20 | return {
|
21 | color: '',
|
22 | face: ''
|
23 | };
|
24 | };
|
25 |
|
26 | var SubtitleWriter = exports.SubtitleWriter = function () {
|
27 | function SubtitleWriter(parsed, type, encoding, fs) {
|
28 | _classCallCheck(this, SubtitleWriter);
|
29 |
|
30 | this.styleList = parsed.styleList;
|
31 | this.cueList = parsed.cueList;
|
32 | this.commentList = parsed.commentList;
|
33 | this.type = type;
|
34 | this.encoding = encoding;
|
35 | this.fs = fs;
|
36 | }
|
37 |
|
38 | _createClass(SubtitleWriter, [{
|
39 | key: 'writeFile',
|
40 | value: function writeFile(target, buf) {
|
41 | if (typeof target === 'string') {
|
42 | if (!process.browser) {
|
43 | var fp = this.fs.createWriteStream(target, {
|
44 | flags: 'w',
|
45 | encoding: this.encoding
|
46 | });
|
47 | fp.write(buf);
|
48 | fp.end();
|
49 | return true;
|
50 | }
|
51 | }
|
52 | return false;
|
53 | }
|
54 | }]);
|
55 |
|
56 | return SubtitleWriter;
|
57 | }();
|
58 |
|
59 | exports.default = { Cue: Cue, textStyle: textStyle, SubtitleWriter: SubtitleWriter }; |
\ | No newline at end of file |