matroska-subtitles
Advanced tools
Comparing version 2.0.1 to 2.0.2
22
index.js
@@ -15,5 +15,5 @@ const Writable = require('stream').Writable | ||
var currentTrack = null | ||
var currentSubtitleBlock = null | ||
var currentClusterTimecode = null | ||
let currentTrack = null | ||
let currentSubtitleBlock = null | ||
let currentClusterTimecode = null | ||
@@ -34,3 +34,3 @@ this.decoder = new ebml.Decoder() | ||
var self = this | ||
const self = this | ||
@@ -58,3 +58,3 @@ function _onMetaData (chunk) { | ||
if (SUBTITLE_TYPES.includes(currentTrack.CodecID)) { | ||
var track = { | ||
const track = { | ||
number: currentTrack.TrackNumber, | ||
@@ -93,8 +93,8 @@ language: currentTrack.Language, | ||
if (chunk[1].name === 'Block') { | ||
var block = ebmlBlock(chunk[1].data) | ||
const block = ebmlBlock(chunk[1].data) | ||
if (self.subtitleTracks.has(block.trackNumber)) { | ||
var type = self.subtitleTracks.get(block.trackNumber).type | ||
const type = self.subtitleTracks.get(block.trackNumber).type | ||
var subtitle = { | ||
const subtitle = { | ||
text: block.frames[0].toString('utf8'), | ||
@@ -106,9 +106,9 @@ time: (block.timecode + currentClusterTimecode) * self.timecodeScale | ||
// extract SSA/ASS keys | ||
var values = subtitle.text.split(',') | ||
const values = subtitle.text.split(',') | ||
// ignore read-order, and skip layer if ssa | ||
var i = type === 'ssa' ? 2 : 1 | ||
const i = type === 'ssa' ? 2 : 1 | ||
for (; i < 9; i++) { | ||
subtitle[ASS_KEYS[i]] = values[i] | ||
} | ||
// re-append extra text that might have been splitted | ||
// re-append extra text that might have been split | ||
for (i = 9; i < values.length; i++) { | ||
@@ -115,0 +115,0 @@ subtitle.text += ',' + values[i] |
{ | ||
"name": "matroska-subtitles", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Writable stream for parsing embedded .mkv subtitles.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9002