Skip to content

Commit

Permalink
refactor: Clean up movie titles
Browse files Browse the repository at this point in the history
- Removed technology and sound information from the original movie name, such as "(IMAX, 2D)" and "dub".
- Implemented with Regex.
  • Loading branch information
diareuse committed Feb 16, 2025
1 parent 7870a75 commit 4f3bec1
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,13 @@ internal data class MovieFromResponse(
get() = movie.name
override val original: String
get() = movie.nameOriginal
.replace(Technology, "")
.replace(Sound, "")
.trim()
}

companion object {
private val Technology = Regex("(IMAX|(?:[2-4]DX?))")
private val Sound = Regex("\\s*-\\s*((?:(d|s)ub(?:titles)?)|original)")
}
}

0 comments on commit 4f3bec1

Please sign in to comment.