New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

srt-engine

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

srt-engine

srt-engine

latest
npmnpm
Version
0.0.9-beta.4
Version published
Maintainers
1
Created
Source

srt engine

srt editor engine, improve performance by indexing

install

npm i -S srt-engine

usage

import StrEngine from 'srt-engine';
let se = new SrtEngine();
se.load('your srt file url');

or you can load srt through compile method, or transform a content array to a srt-engine instance.

se.compile(text);
let dialogue = se.findByTime(10000); // milliseconds
const fileText = se.stringify({
  fontSize: 16,
  fontColor: #ffffff,
  bold: true,
  italic: true,
  underground: true,
  // align default 2, values: 
  // 7, 8, 9
  // 4, 5, 6
  // 1, 2, 3
  align: 2, 
})

dialogue object like this:

{
  id: 1,
  uid: 1, // unique id
  startTimeInMilliSeconds: 0,
  endTimeInMilliSeconds: 3000,
  texts: ['an dialogue', '一个对话'],
}

methods:

load

param: url

return: promise --> SE instance

compile

param: file text

return: SE instance

transform

param: content Array

return: SE instance

stringify

param: styles Object(all dialogue support fontSize, font), start, end

return: file text

findByTime

param: milliseconds Number

return: dialogue Array

findByText

param: text

return: dialogue Array

findByUid

param: uid (an attribute of dialogue object)

return: an dialogue

findByTimeRange

param: start end

return: dialogue Array

addDialogue

param: dialogue index(position)

return: dialogue(cloneDeep)

updateDialogueByUid

param: uid, dialogueInfos(like dialogue, not strict)

return: SE instance

removeDialogueByUid

param: uid

return: SE instance

sort

param: none

return: SE instance

getContent

param: none

return: dialogue Array

getOriginText

param: none

return: origin file text

Keywords

srt

FAQs

Package last updated on 13 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts