Here is what I have so far:
Code: Select all
O:\movies\{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b(?i: II| III| IV| V| VI| VII| VIII| IX| X| XI| XII)\b/, { it.upper() }).replaceAll(/1St/, "1st").replaceAll(/2Nd/, "2nd").replaceAll(/3Rd/, "3rd").replaceAll(/4Th/, "4th").replaceAll(/5Th/, "5th").replaceAll(/6Th/, "6th").replaceAll(/7Th/, "7th").replaceAll(/8Th/, "8th").replaceAll(/9Th/, "9th").replaceAll(/0Th/, "0th")}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{fn.contains('Extended') || fn.contains('EXTENDED') || fn.contains('extended.cut') ? ' (Extended)' : fn.contains('Special Edition') || fn.contains('SPECIAL EDITION') || fn.contains('SPECIAL.EDITION') ? ' (Special Edition)' : fn.contains('Unrated') || fn.contains('UNRATED') ? ' (Unrated)' : fn.contains('Uncensored') || fn.contains('UNCENSORED') ? ' (Uncensored)' : fn.contains('Remastered') || fn.contains('REMASTERED') ? ' (Remastered)':""} ({y}){" - $vf"}
The Hunger Games (2012)
The Hunger Games: Catching Fire (2013)
The Hunger Games: Mockingjay - Part 1 (2014)
The Hunger Games: Mockingjay - Part 2 (2015)
What I want after my formatting code:
Hunger Games, The (2012) - 1080p.mp4
Hunger Games, The - Catching Fire (2012) - 1080p.mp4
Hunger Games, The - Mockingjay - Part I (2012) - 1080p.mp4
Hunger Games, The - Mockingjay - Part II (2012) - 1080p.mp4
So basically, I I haven't solved how to move ", The " in front of the first - that appears.
I think the logical way to do this is something like this (forgive my pseudo-code, just explaining the best way I know how)
Code: Select all
if n starts with "The " = true
if n contains ":" = true
.replaceFirst(/[:|]/, ", The - ")
.replaceAll(/[:|]/, ", - ")
else
.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)
.replaceAll(/[:|]/, ", - ")
end if
end if
2) My formatting adds unrated or extended back to the movie filename, but it doesn't work for most subtitle as they don't contain extra tags in their filenames, usually stuff like "eng.srt".
I want to get:
Argo (Extended) (2012) - 1080p.mp4
Argo (Extended) (2012) - 1080p.eng.srt
but my code gives me:
Argo (Extended) (2012) - 1080p.mp4
Argo (2012) - 1080p.eng.srt
3) I have this from another user's code but I can't figure out exactly what it does. I know it's related to adding the Japanese name in anime but I don't get the terms or functions.
{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}
Any help is greatly appreciated.