Page 1 of 1

File Renaming including English and Foreign Titles

Posted: 25 Feb 2019, 03:03
by jerome
I've only been testing this program for about a week on Windows 10. I have managed to find the answers to most of my questions on this great forum for my GUI coding (not yet prepared to try AMC script). Except I am stumped with one specific movie that is not yielding the expected result

Here is the movie link
https://www.themoviedb.org/movie/401545 ... uage=en-US

Here is the code:

Code: Select all

{n.colon("-").replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)} ({y}) {info.OriginalLanguage =~ /^(?i)['en']/ ? '' : primaryTitle.transliterate("latin")}
Similar to my other foreign movies I was expecting the output to be:
Everybody Knows (2018) Todos lo saben

Instead it's just
Everybody Knows (2018)

These are the results of some of the partial coding:
{primaryTitle.transliterate("latin")} yields Todos lo saben
{info.OriginalLanguage} yields es
{info.SpokenLanguages} yields en,de,es,it,ca

I thought maybe it was because this movie has two languages listed as Original Languages but not sure how to correct for that. Any help or direction would be appreciated.

Thanks
J

Re: File Renaming including English and Foreign Titles

Posted: 25 Feb 2019, 07:05
by rednoah
1.
This works for me:

Code: Select all

{n.colon('-').sortName('$2, $1')} ({y}) {info.OriginalLanguage =~ /en/ ? null : primaryTitle.ascii()}


2.
This regular expression doesn't do what you think it does:

Code: Select all

/^(?i)['en']/
https://regexr.com/

You probably mean this:

Code: Select all

/^(?i)en/

Re: File Renaming including English and Foreign Titles

Posted: 26 Feb 2019, 03:38
by jerome
Thanks rednoah for those pointers and the direction to some further reading. Those snippets helped fix the script. I was aware of the sortName('$2, $1') binding and the ascii but I prefer only to move the word "The" in movies and leave "A" and "And" as is, as well as have the accents on my foreign titles.

I have a lot to learn here and I really appreciate your guidance. I wish I had found this program sooner.

J