I have a movie naming scheme that I am happy with, borrowed and plagiarized extensively and shamelessly from others' examples.
Code: Select all
{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() })}; norm(n)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y}){genres != null && (genres.contains('animation') || genres.contains('Animation')) ? ' (Animation)':""}{genre != null && !genres.contains('animation') && !genres.contains('Animation') ? ' ('+{genre}+')':""}{if (any{imdb.certification}{certification} != null) ' ('+any{imdb.certification}{certification}+')'} {'{imdb-'+imdbid+'}'}\{norm(n)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y}){genres != null && (genres.contains('animation') || genres.contains('Animation')) ? ' (Animation)':""}{genre != null && !genres.contains('animation') && !genres.contains('Animation') ? ' ('+{genre}+')':""}{if (any{imdb.certification}{certification} != null) ' ('+any{imdb.certification}{certification}+')'} {languages.toString().toUpperCase()} ({vs == "" ? "" : vs+" "}{vf.removeIllegalCharacters()}) ({AC} {channels}) ({vc.replaceAll('AVC','h264').replaceAll('HEVC','h265')})
[*]101 Dalmatians II - Patch's London Adventure (2003) (Animation) (G) {imdb-tt0324941}/101 Dalmatians II - Patch's London Adventure (2003) (Animation) (G) [ENG] (BluRay 1080p) (AC3 5.1) (x265)
[*]Escape Plan 2 - Hades (2018) (Action) (R) {imdb-tt6513656}/Escape Plan 2 - Hades (2018) (Action) (R) [ENG] (BluRay 720p) (DTS 5.1) (x264)
What I cannot master is one final piece: If a movie is split across multiple files, I'd like to add "Part_X" to the end of the name. The original name of the file will contain, somewhere in it, words such as "CD1", "Part1", "Part 1", Part_1", "PT_1" and so forth.
I can do a "contains" statement to check for the existence of such phrases - like
Code: Select all
original.toUpperCase().contains('CD')
I suspect there is a clever RegEx that might accomplish it, but when it comes to regular expressions I'm afraid I am at sea.
Does anybody have any suggestions? Or even point me to an existing post that covers this kind of thing?
Eternally grateful
