Giter Site home page Giter Site logo

srttotext's Introduction

srttotext

This is a simple command-line subtitle converter. It converts subtitle file to plain text/

What does it make?

Lets see the example

Before

    $cat Star.Wars.Episode.5.The.Empire.Strikes.Back.1980.1080p.BrRip.x264.BOKUTOX.YIFY.srt | head
1
00:00:05,000 --> 00:00:10,000
<font color="#20e020">Cleaned, corrected, some OCR errors
fixed and some timings optimized by Tronar</font>

2
00:03:33,585 --> 00:03:35,498
Echo Three to Echo Seven.

3

After

    $srt2text Star.Wars.Episode.5.The.Empire.Strikes.Back.1980.1080p.BrRip.x264.BOKUTOX.YIFY.srt | head

It produces:

Cleaned, corrected, some OCR errors
fixed and some timings optimized by Tronar
Echo Three to Echo Seven.
Han, old buddy,
do you read me?
Loud and clear, kid.
What's up?
Well, I finished my circle.
I don't pick up any life readings.
There isn't enough life on this ice cube

Getting started

Clone the repository using git, make it executable, then move the binary file to one of you bin folders

git clone https://github.com/oshenc/srttotext.git
cd srttotext
chmod +x srt2text.sh
sudo mv srt2text.sh /usr/local/bin/srt2text

Usage

$srt2text 
Ussage srt2text SRTFILE

By default it outputs text to stdoutput. So you can redirect the output to the file.

E.g

$srt2text somesrtcfile.srt > output.txt

srttotext's People

Contributors

oshenc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

vdivakar

srttotext's Issues

Remove duplicate lines using awk

Hi,

nice script, thanks.

Sometimes after downloading videos with autogenerated subs you get many duplicate lines.
To remove them I just added an AWK one-liner to the SED command like this:

sed -r -e 's/^\xef\xbb\xbf//'
-e 's/\r//'
-e 's/^[0-9]$//'
-e '/^[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3} --> [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}$/d'
-e 's/^\s
$//'
-e '/^$/d;s/<[^>]*>//g' "$1" | awk '!NF || NR > rec[$0]; {rec[$0] = NR+2}'

This now removes duplicate lines only if the duplicate item follow s immediately immediately follow one another.

Bye

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.