srt_parser 1.1.0+1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new63

.srt parser #

description #

A .srt file parser that allows you to read a String containing HTML, coordination and timestamps information and convert it to a list of subtitle objects.
Each Subtitle object contains a list of subtitle subsets with their corresponding metadata.

Example #

import 'package:srt_parser/srt_parser.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

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('ID is: ${item.id}');
    print('Begin is: ${item.range.begin} and End is: ${item.range.end}');
    for (String line in item.lines) {
      print(line);
    }
    print('----');
  }
}

1.1.0+1 #

  • maintenance +@visibleForTesting

1.1.0 #

  • parses html & coordination

1.0.1+1 #

  • maintenance

1.0.1 #

  • updated the package information.

1.0.0 #

  • Initial release.

example/example.dart

import 'package:srt_parser/srt_parser.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');
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  srt_parser: ^1.1.0+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:srt_parser/srt_parser.dart';
  
Version Uploaded Documentation Archive
1.1.0+1 Mar 25, 2019 Go to the documentation of srt_parser 1.1.0+1 Download srt_parser 1.1.0+1 archive
1.1.0 Mar 25, 2019 Go to the documentation of srt_parser 1.1.0 Download srt_parser 1.1.0 archive
1.0.1+1 Mar 6, 2019 Go to the documentation of srt_parser 1.0.1+1 Download srt_parser 1.0.1+1 archive
1.0.1 Mar 6, 2019 Go to the documentation of srt_parser 1.0.1 Download srt_parser 1.0.1 archive
1.0.0 Mar 6, 2019 Go to the documentation of srt_parser 1.0.0 Download srt_parser 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
26
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Mar 25, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:srt_parser/srt_parser.dart.

Health issues and suggestions

Document public APIs. (-1 points)

54 out of 54 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/srt_parser.dart. (-0.50 points)

Analysis of lib/srt_parser.dart reported 1 hint:

line 134 col 7: Use isNotEmpty instead of length

Format lib/color_map.dart.

Run dartfmt to format lib/color_map.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
csslib ^0.14.6 0.14.6
meta ^1.1.7 1.1.7
Transitive dependencies
args 1.5.1
charcode 1.1.2
logging 0.11.3+2
path 1.6.2
source_span 1.5.5
term_glyph 1.1.0
Dev dependencies
test ^1.5.1