Giter Site home page Giter Site logo

supertitle's Introduction

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:

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…)

supertitle's People

Contributors

searls avatar joshtgreenwood avatar

Stargazers

Daniel Petelin avatar Josh Teneycke avatar Benjamin Mosior avatar

Watchers

Todd Kaufman avatar  avatar Ross Brandes avatar James Cloos avatar  avatar

Forkers

joshtgreenwood

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.