| 15 | #include "subrip.h" |
| 16 | |
| 17 | bool SubRipSubtitleFormat::detect(const QStringList &lines) const { |
| 18 | QStringList lines2 = lines; |
| 19 | while (!lines2.isEmpty() && lines2.first().trimmed().isEmpty()) { |
| 20 | lines2.pop_front(); |
| 21 | } |
| 22 | |
| 23 | QString firstEntryBuff; |
| 24 | |
| 25 | foreach (QString line, lines2) { |
| 26 | if (line.isEmpty()) break; |
| 27 | firstEntryBuff += line + "\n"; |
| 28 | } |
| 29 | |
| 30 | QRegExp r( |
| 31 | "^(\\d+)(\\n|\\r\\n|\\s+)(\\d{2}):(\\d{2}):(\\d{2})\\,(\\d{3})\\s+\\-\\->" |
| 32 | "\\s+(\\d{2}):(\\d{2}):(\\d{2})\\,(\\d{3})(.*)"); |
| 33 | |
| 34 | return r.exactMatch(firstEntryBuff); |
| 35 | } |
| 36 | |
| 37 | SubFile SubRipSubtitleFormat::decode(const QStringList &lines) const { |
| 38 | SubFile sf; |
nothing calls this directly
no outgoing calls
no test coverage detected