Problem with sortName

All your suggestions, requests and ideas for future development
Post Reply
Xiphan
Posts: 9
Joined: 21 May 2020, 20:45

Problem with sortName

Post by Xiphan »

I like using sortName to move 'The' to the end of the Movie or TV series name but I have noticed that if the media name has a default year in the title because it's a common title the 'the' gets moved behind the year instead of before the year.

For example:

Using TheTVDB as a source The Outer Limits would become:

Code: Select all

Outer Limits (1995), The
Instead of becoming:

Code: Select all

Outer Limits, The (1995)
Is there anyway to create a custom regex that can correctly swap The or A to the end, but putting it before the year if a year already exists in the default title? :?:
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Problem with sortName

Post by rednoah »

Xiphan wrote: 03 Mar 2022, 19:00 Is there anyway to create a custom regex that can correctly swap The or A to the end, but putting it before the year if a year already exists in the default title? :?:
Please read [SNIPPET] Sort Name on how to do just that. Though you'll have to come up with the regex pattern yourself.


:arrow: I'd just do n.sortName() and then leave it at that. Drop the "The" and make life easy.


:arrow: If you must have Movie, The (2021) naming though (BAD IDEA; WILL BREAK MATCHING IN THE FUTURE) then I'd do it like this:

Code: Select all

{ ny.before(/[(]\d{4}[)]/).sortName('$2, $1') } ({ y })
:idea: Please read the FAQ and How to Request Help.
Post Reply