fix for decimal episodes

This commit is contained in:
Finnley Somdahl 2023-12-27 07:07:10 -06:00
parent ebabff4667
commit bf908c5e37
2 changed files with 24 additions and 2 deletions

View file

@ -16,5 +16,17 @@ class AnimeNameAdapter {
null
}
}
fun findEpisodeNumber(text: String): Float? {
val episodeRegex = "(episode|ep|e)[\\s:.\\-]*([\\d]+\\.?[\\d]*)"
val episodePattern: Pattern = Pattern.compile(episodeRegex, Pattern.CASE_INSENSITIVE)
val episodeMatcher: Matcher = episodePattern.matcher(text)
return if (episodeMatcher.find()) {
episodeMatcher.group(2)?.toFloat()
} else {
null
}
}
}
}