Coder Social home page Coder Social logo

subsrt's People

Contributors

dnjstlr555 avatar papnkukn avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

subsrt's Issues

Unable to convert LF vtt content to smi

Hello there.
I have an issue trying to convert a vtt content to smi.

When I convert CRLF files it works just fine, but I'm getting subtitles from a service that returns me LF files, and when I try to convert them, i only get an empty body on my smi file, like:

<SAMI>
<HEAD>
<TITLE></TITLE>
<STYLE TYPE="text/css">
<!--
P { font-family: Arial; font-weight: normal; color: white; background-color: black; text-align: center; }
.LANG { Name: English; lang: en-US; SAMIType: CC; }
-->
</STYLE>
</HEAD>
<BODY>
</BODY>
</SAMI>

If I locally save manually the file as CRLF, the conversion works fine.
But using a regex , such as .replace(/(?<!\r)\n/g, '\r\n') to replace end of lines doesn't seem to work.

This is an example of a subtitle file I'm trying to convert:
vtt.zip

Any ideas on that?
Thanks.

Problem with blank lines in VTT file

In VTT files, a blank line indicates the end of the cue. So if you have something like "Line 1\r\n\r\nLine 2" you need to write a space to the otherwise blank middle line. Here's a fix to the build() function in vtt.js.

    if (typeof caption.type === "undefined" || caption.type == "caption") {
      content += (i + 1).toString() + eol;
      content += helper.toTimeString(caption.start) + " --> " + helper.toTimeString(caption.end) + eol;
      content += replaceAll(caption.text, "\r\n\r\n", "\r\n \r\n") + eol;   //ADD A SPACE TO EACH BLANK LINE
      content += eol;
      continue;
    }

For testing, I've attached the SSA cues from One Piece S13:E1030 on Crunchyroll. Lines 118 & 119 have cues with two blank lines between two text lines. In the VTT output these lines need to have spaces:

98
00:06:22.240 --> 00:06:22.860
Ascensore diretto per l'8° piano
 
 
(In discesa ferma a tutti i piani)

99
00:06:22.860 --> 00:06:23.610
Ascensore diretto per l'8° piano
 
 
(In discesa ferma a tutti i piani)

OnePiece.ssa.txt

Have a way to specify subtitle format of the input file

I have converted few .srt files to .vtt. But sometime i get the error "Cannot determine subtitle format" while the input file is correctly formatted by .srt.

Is there anyway to make it works? (like help the parser know exactly what kind of input format)
Thanks for making this awesome library

Output is blank

const subsrt = require('subsrt');

const vttContent = `WEBVTT

00:00.000 --> 00:04.000
Welcome to English in a Minute.

00:04.000 --> 00:07.000
Most people enjoy going to parties.

00:07.000 --> 00:25.000
You got to be a...`;

const options = { format: 'srt' };
const srtContent = subsrt.convert(vttContent, options);

console.log('SRT content:', srtContent);

Screen Shot 2023-02-28 at 4 32 15 PM

keep getting "Unknown part 1" in command line

Dear papnkukn,

Thank you for creating this wonderful cli.

When I use the "parse" command e.g.
subsrt parse sample.srt output.json --verbose

I keep getting the following message "WARN: Unknown part 1" and the first section in srt can never be written in the json output.

Can you please advise?

Thank you very much!

Command line not working

Hi, your script looks promising, but it didn't work for me when I tried to install it globally and run it:

$ subsrt
module.js:538
    throw err;
    ^

Error: Cannot find module '../subsrt.js'

I may take a look myself in case I don't find an alternative.

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.