Skip to content

Commit

Permalink
exoplayer string fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed Jan 13, 2024
1 parent 14d08b9 commit e65fa8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,10 @@ class AnimeNameAdapter {
text
}
}

fun removeEpisodeNumberCompletely(text: String): String {
val regexPattern = Regex(episodeRegex, RegexOption.IGNORE_CASE)
return text.replace(regexPattern, "")
}
}
}
3 changes: 2 additions & 1 deletion app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,8 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
val episodeTitleArr = arrayListOf<String>()
episodes.forEach {
val episode = it.value
episodeTitleArr.add("${if (!episode.title.isNullOrEmpty() && episode.title != "null") "" else "numeric :"}${episode.number}${if (episode.filler) " [Filler]" else ""}${if (!episode.title.isNullOrEmpty() && episode.title != "null") " : " + episode.title else ""}")
val cleanedTitle = AnimeNameAdapter.removeEpisodeNumberCompletely(episode.title ?: "")
episodeTitleArr.add("Episode ${episode.number}${if (episode.filler) " [Filler]" else ""}${if (cleanedTitle.isNotEmpty() && cleanedTitle != "null") ": $cleanedTitle" else ""}")
}

for (i in episodeTitleArr.indices) {
Expand Down

0 comments on commit e65fa8d

Please sign in to comment.