mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 16:28:51 -05:00
* make subtitle parser less verbose
This commit is contained in:
parent
99a61f53ce
commit
9657bc904d
@ -48,6 +48,9 @@ public class MicroDVDReader extends SubtitleReader {
|
||||
int endFrame = Integer.parseInt(properties.get(1));
|
||||
String text = line.substring(from).trim();
|
||||
|
||||
// cancel format markers
|
||||
text = text.replaceAll("\\{[^\\}]*\\}", "");
|
||||
|
||||
if (startFrame == 1 && endFrame == 1) {
|
||||
// override fps
|
||||
fps = Double.parseDouble(text);
|
||||
|
@ -6,6 +6,7 @@ import static java.util.regex.Pattern.*;
|
||||
import static net.sourceforge.tuned.StringUtilities.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -39,6 +40,9 @@ public class SubViewerReader extends SubtitleReader {
|
||||
String[] lines = newline.split(scanner.nextLine());
|
||||
|
||||
return new SubtitleElement(t1, t2, join(lines, "\n"));
|
||||
} catch (ParseException e) {
|
||||
// can't parse interval, ignore line
|
||||
return null;
|
||||
} catch (InputMismatchException e) {
|
||||
// can't parse interval, ignore line
|
||||
return null;
|
||||
|
@ -33,7 +33,7 @@ public abstract class SubtitleReader implements Iterator<SubtitleElement>, Close
|
||||
current = readNext();
|
||||
} catch (Exception e) {
|
||||
// log and ignore
|
||||
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.toString(), e);
|
||||
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Illegal input: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user