Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
int? extractEpisodeNumberFromTitle(String title) {
|
||||
for (final p in _episodeTitlePatterns) {
|
||||
final m = p.firstMatch(title);
|
||||
if (m != null) {
|
||||
final n = int.tryParse(m.group(1)!);
|
||||
if (n != null) return n;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<RegExp> _episodeTitlePatterns = [
|
||||
RegExp(r'第\s*0*(\d+)\s*[话集話]'),
|
||||
RegExp(r'\bS\d+E0*(\d+)\b', caseSensitive: false),
|
||||
RegExp(r'\bEP?\s*0*(\d+)\b', caseSensitive: false),
|
||||
];
|
||||
Reference in New Issue
Block a user