ApayRus / frazy-parser

Universal subtitle/caption parser. Identifies a subs type by its text and converts it to a JavaScript object.
MIT License
9 stars 0 forks source link

cant read subtitles correctly except .srt content #1

Closed DhansAL closed 3 years ago

DhansAL commented 3 years ago

following the same test in react 17 import { parseSubs } from '../../parsers/subtitles.js' const srtExample = any format except .srt text const result = parseSubs(srtExample)`

//output takes every line as an array elm in output

ApayRus commented 3 years ago

following the same test in react 17 import { parseSubs } from '../../parsers/subtitles.js' const srtExample = any format except .srt text const result = parseSubs(srtExample)`

//output takes every line as an array elm in output

Thank you for feedback! You are the first one :) I use it in my project and it works. Maybe it's because of different characters for line breakes? I am using ubuntu... Please check out test section, there are examples with different formats. You can just read them, or run.

ApayRus commented 3 years ago

following the same test in react 17 import { parseSubs } from '../../parsers/subtitles.js' const srtExample = any format except .srt text const result = parseSubs(srtExample)`

//output takes every line as an array elm in output

Can you share with me subs, that don't work in this parser?

DhansAL commented 3 years ago

i think the problem is with this.

const assExample = `0:00:23.90,0:00:26.60 line one 
0:00:27.83,0:00:32.03 line two 
0:00:32.43,0:00:41.89 line three 
0:01:01.15,0:01:04.45 line four 
0:01:05.75,0:01:09.85 line five`

this is from test files and after checking this out I think test case example is wrong itself, as a normal .ass file would be something like,

////////// ` [Script Info] ; Script generated by Aegisub ; http://www.aegisub.net Title: Neon Genesis Evangelion - Episode 26 (neutral Spanish) Original Script: RoRo Script Updated By: version 2.8.01 ScriptType: v4.00+ Collisions: Normal PlayResY: 600 PlayDepth: 0 Timer: 100,0000 Video Aspect Ratio: 0 Video Zoom: 6 Video Position: 0

[V4+ Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding Style: DefaultVCD, Arial,28,&H00B4FCFC,&H00B4FCFC,&H00000008,&H80000008,-1,0,0,0,100,100,0.00,0.00,1,1.00,2.00,2,30,30,30,0

[Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:01.18,0:00:06.85,DefaultVCD, NTP,0000,0000,0000,,{\pos(400,570)}Like an Angel with pity on nobody\NThe second line in subtitle
`

////////////////////////

so I think we gotta convert this to a format similar to the test case but I don't know how to do that.

PS. I found no error while working with .srt formats

ApayRus commented 3 years ago

I'm sorry, this parser doesn't support whole ass structure, because it is complicated and not stable (can be different schemas, lots of additional info, layers, etc). For my purposes, I extract phrases part manually, and do find/remove everything except start, end, text.

DhansAL commented 3 years ago

yeah, I just figured this out a moment ago and my bad it is mentioned here thanks mate ;)