Socket
Book a DemoInstallSign in
Socket

supertitle

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supertitle

0.1.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

Supertitle

A little gem to help deal with converting between to & from various subtitle and transcript formats. Right now it only handles conversion of SRT files to a text transcript that's more appropriate for being read by humans.

CLI

The CLI takes four arguments:

Usage: supertitle input_file input_format output_file output_format

Example:
  $ supertitle scna.srt srt scna-script.txt transcript

This will read the SRT input file and write a human-readable transcript to scna-script.txt.

API

Reading

First, parse some content into "supertitles", the arbitrary object model of this gem:

srt = File.read("test/fixtures/scna.srt")
supertitles = Supertitle.parse(srt, :srt)

Supported input formats:

  • :srt - SRT

Object model

The Supertitle.read method will return an array of Supertitle::Line objects, each providing start, stop, and text attributes. start and stop are millisecond offsets, relative to the start of the subtitles or transcript. text will strip and join any multi-line subtitles into a single line, separated by a single space.

Writing

To write out those supertitles into a supported string format:

transcript = Supertitle.write(supertitles, :transcript) #=> a multi-line string

Supported output formats:

  • :transcript - a human-readable custom transcript format ([mm:ss] text…)

FAQs

Package last updated on 11 May 2017

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.