Skip to content

mdaubie/subtitles-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Subtitles Parser

checks status release status publish status
license version Maven Central

Library for parsing subtitles files using regexes

Handled formats

  • Currently: SubRip
  • Upcoming: MicroDVD, WebVTT, SSA, ASS

How to use

  • Parse your file with the Parser class, you will need the format of the file and its path
  • Apply your changes: for example fix the overlapping subtitles in the file with the dedicated tool
  • Serialize your file back, you will need the format of the file and the path of the new file
public class Main {
    public static void main(String[] args) throws IOException {
        File mySubtitlesFile = new File("path/myFile");
        SubRipFile parsedFile = new Parser<>(SUB_RIP_FORMAT).parseFile(mySubtitlesFile);
        FixOverlappingSubtitles.fixOverlapping(parsedFile, FixOverlappingSubtitles.STRATEGY.MERGE);
        new Serializer<>(SUB_RIP_FORMAT).writeToFile(parsedFile, new File("path/myFileFixed"));
    }
}

Upcoming features

  • New subtitles formats: MicroDVD, WebVTT, SSA, ASS
  • New tool: subtitles shifting
  • Format conversion: parse a SubRip file and serialize it as an SSA file to customize it for example
  • Format auto-detection: might be done simply on file extension, or by pattern recognition

Related projects

I am working on a web app project to handle my collection of downloaded movies and series, you can find it here: The Movie Shelf

This is a personal project for my needs, so it probably won't be interesting for you (I might actually keep it private), but I need to develop some libraries for this main project which might be useful to you: