srt_parser_2 2.0.2 copy "srt_parser_2: ^2.0.2" to clipboard
srt_parser_2: ^2.0.2 copied to clipboard

A cross-platform, .srt parser that allows you to read a String containing Html and Coordinates and results to subtitle objects.

example/example.dart

import 'package:srt_parser_2/srt_parser_2.dart';

const String data = '''1
00:02:26,407 --> 00:02:31,356  X1:100 X2:100 Y1:100 Y2:100
+ time to move on, <u><b><font color="#00ff00">Arman</font></b></u>.
- OK, will do.

2
00:02:31,567 --> 00:02:37,164 
+ Lukas is publishing his library.
- I like the man.
''';

void main() {
  List<Subtitle> subtitles = parseSrt(data);
  for (Subtitle item in subtitles) {
    print('subtitle\'s ID is: ${item.id}');
    print(
        'subtitle\'s Begin is: ${item.range.begin} and End is: ${item.range.end}');
    item.parsedLines.forEach((Line line) {
      return line.subLines.forEach((SubLine subLine) => print(
          'line${item.parsedLines.indexOf(line)} subline${line.subLines.indexOf(subLine)} is: ${subLine.rawString}'));
    });
    print('----');
  }
  if (subtitles[0].parsedLines[0].subLines[1].htmlCode.b == true) {
    print('true');
  }
}
1
likes
130
pub points
77%
popularity

Publisher

verified publisherdra11y.com

A cross-platform, .srt parser that allows you to read a String containing Html and Coordinates and results to subtitle objects.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

collection, csslib, meta

More

Packages that depend on srt_parser_2