Bringing scripts up-to-date, 2 issues: 'The', music deleted

All about user-defined episode / movie / file name format expressions
Post Reply
Mimo
Posts: 12
Joined: 15 Sep 2013, 09:46

Bringing scripts up-to-date, 2 issues: 'The', music deleted

Post by Mimo »

Hi!

Filebot is phenomenal. I have been using it for more than a year, but have recently found out some things are not working the same way anymore so I have to make some corrections.

I have stumbled upon 2 issues:

1. The expression to move the word "The" to the end of the title in the folder name (except when used in "Collections") is somehow not working anymore but I can not see why.
My expression, customized from some provided in forum:

Code: Select all

"movieFormat=Movies/{def t = c{collection.upperInitial().replaceAll(':',' -').replaceAll(/[\`´‘’‘]/, \"'\").replaceAll(/[!?.]+$/).replaceTrailingBrackets()};if(t!=null) return (t+'/');}{(n =~ /\^[Tt]he / ? n[4..-1]+', The' : n =~ /\^[Aa] / ? n[2..-1]+', A' : n).upperInitial().replaceAll(':',' -').replaceAll(/[\`´‘’‘]/, \"'\").replaceAll(/[!?.]+$/).replaceTrailingBrackets()} ({y}){\" [$source]\"}{def g = c{group}; if(g!=null && g!=\"DrSi\") return ('['+g+']');}{def h = c{group}; def m = c{fn.match(/-([\^-.]+)/)}; if(m!=null && m!=\"DL\" && m!=\"dl\" && (h != m || m==\"DrSi\")) return ('['+m+']');}/{n.upperInitial().replaceAll(':',' -').replaceAll(/[\`´‘’‘]/, \"'\").replaceAll(/[!?.]+$/).replaceTrailingBrackets()}{\".($y)\"}{'['+fn.replaceAll(/(?i)directors|theatrical/, '$0 Cut').matchAll(/UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTORS.CUT|THEATRICAL.CUT/).join('][').upperInitial().lowerTrail()+']'}{def e = c{fn.matchAll(/3D/)}; if(e!=null) return ('.['+e+']')}{\".[$source]\"}{\".[$vf]\"}{\".[$resolution]\"}{\".[$vc]\"}{\".[$ac]\"}{\".[$af]\"}{def g = c{group}; if(g!=null && g!=\"DrSi\") return ('.['+g+']');}{def h = c{group}; def m = c{fn.match(/-([\^-.]+)/)}; if(m!=null && m!=\"DL\" && m!=\"dl\" && (h != m || m==\"DrSi\")) return ('.['+m+']');}{\".CD$pi\"}{\".$lang\"}{fn.match(/[.]fanart|[.]mkv|[.]avi|[.]mp4|[.]nfo/)}"
2. I have always had music option turned off and had no problem with it but with the latest update the music files in the original folder were deleted:
Log shows (not to clutter post I'm just pasting relevant info):

Parameter: music = n
...
Exclude: H:\New Media\Summer Hits 2014\01............
Exclude: H:\New Media\Summer Hits 2014\02............
...
(all music files listed)
...
Clean clutter files and empty folders
Delete H:\New Media\Summer Hits 2014\01............
Delete H:\New Media\Summer Hits 2014\02............
...
(all music files actually deleted)
...
Delete H:\New Media\Summer Hits 2014
Done Ńâż(´╝áÔîĺŃâ╝Ôîĺ´╝á)ŃâÄ


Is it possible to identify the (likely mine) errors and make it work again perfectly?
Thanks!
Mimo
Mimo
Posts: 12
Joined: 15 Sep 2013, 09:46

Re: Bringing scripts up-to-date, 2 issues: 'The', music dele

Post by Mimo »

Hi!

This is really weird: putting "The" to the end of the (folder) name does not work, even with this updated format (as it is called from command line):

Code: Select all

"movieFormat=Movies/{def t = c{collection.upperInitial().replaceAll(':',' -').replaceAll(/[\`´‘’‘]/, \"'\").replaceAll(/[!?.]+$/).replaceTrailingBrackets()};if(t!=null) return (t+'/');}{n.replaceFirst(/\^(?i)(The|A|An)\\s(.+)/, /$2, $1/).upperInitial().replaceAll(':',' -').replaceAll(/[\`´‘’‘]/, \"'\").replaceAll(/[!?.]+$/).replaceTrailingBrackets()} ({y}){\" [$source]\"}
If of any use, pasting it from log directly too:
...
Parameter: movieFormat = Movies/{def t = c{collection.upperInitial().replaceAll(':',' -').replaceAll(/[\`+─╣─║─╣]/, "'").replaceAll(/[!?.]+$/).replaceTrailingBrackets()};if(t!=null) return (t+'/');}{n.replaceFirst(/\^^(?i)(The|A|An)\\s(.+)/, /$2, $1/).upperInitial().replaceAll(':',' -').replaceAll(/[\`+─╣─║─╣]/, "'").replaceAll(/[!?.]+$/).replaceTrailingBrackets()}
...

The movie folder is still named beginning with "The ...".
Btw, for collections I prefer retaining the original name even if beginning with "The" but for movies' folder names putting it behind is very useful.


Is there a problem with the original script or... ?

Any clue regarding the deleted music files?

Thanks for your patience!
Mimo
Posts: 12
Joined: 15 Sep 2013, 09:46

Re: Bringing scripts up-to-date, 2 issues: 'The', music dele

Post by Mimo »

Ok, there seems to be a problem with escaping the characters because in the app window the format code is working right.

But I have used the Escape tool to take care of that.
I have had no success identifying the issue further.
Mimo
Posts: 12
Joined: 15 Sep 2013, 09:46

Re: Bringing scripts up-to-date, 2 issues: 'The', music dele

Post by Mimo »

I may have sorted out the "The" issue:

If the function is not escaped it works. The Escape tool is not helpful in this case, it seems.
So just calling the format with:

Code: Select all

n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)
via the command line/batch call looks to be working without escaping the "$" (dollar sign).


I hope everything else turns out to be without such hiccups. ;)
Post Reply