I did read both of those, but I must still be missing something.
Here's my original unaltered naming format for reference:
Code: Select all
{collection.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/).replaceFirst(/^(?i)(Collection of the)\s(.+)/, /$2 Collection/).replaceAll(/Saga Collection/, "Saga").replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ")}/{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() }).replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/^\d+$/, 'PG-$0')})/{norm(n.space('.'))}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{'.(' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, ".") + ')'}{".Part.$pi"}{".[$vf.$vc.$ac.$af]"}{'.'+lang}
This is what I get when I run it through the escape script:
Code: Select all
"{collection.replaceFirst(/\^(?i)(The)\\s(.+)/, /\$2, \$1/).replaceFirst(/\^(?i)(Collection of the)\\s(.+)/, /\$2 Collection/).replaceAll(/Saga Collection/, \"Saga\").replaceAll(/[\`´‘’ʻ\"\"“”]/, \"'\").replaceAll(/[:|]/, \" - \").replaceAll(/[?]/, \"!\").replaceAll(/[*\\s]+/, \" \")}/{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() }).replaceFirst(/\^(?i)(The)\\s(.+)/, /\$2, \$1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/\^\\d+\$/, 'PG-\$0')})/{norm(n.space('.'))}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"}{'.(' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \".\") + ')'}{\".Part.\$pi\"}{\".[\$vf.\$vc.\$ac.\$af]\"}{'.'+lang}"
Running that format in my command:
Code: Select all
filebot -script fn:amc --output "/mnt/user/Downloads" --action copy -non-strict "/mnt/user/Downloads/movies" --def excludeList=amc.txt --action test --def "movieFormat={collection.replaceFirst(/\^(?i)(The)\\s(.+)/, /\$2, \$1/).replaceFirst(/\^(?i)(Collection of the)\\s(.+)/, /\$2 Collection/).replaceAll(/Saga Collection/, \"Saga\").replaceAll(/[\`´‘’ʻ\"\"“”]/, \"'\").replaceAll(/[:|]/, \" - \").replaceAll(/[?]/, \"!\").replaceAll(/[*\\s]+/, \" \")}/{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() }).replaceFirst(/\^(?i)(The)\\s(.+)/, /\$2, \$1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/\^\\d+\$/, 'PG-\$0')})/{norm(n.space('.'))}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"}{'.(' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \".\") + ')'}{\".Part.\$pi\"}{\".[\$vf.\$vc.\$ac.\$af]\"}{'.'+lang}"
gives me a "-bash: !\: event not found" error.
Some research reveals that the escape script doesn't seem to properly handle exclamation marks. Apparently they get parsed without respect for quotation marks. You can escape them with backslash, but then the backslash is not escaped either. More information here:
http://superuser.com/a/301330.
becomes
Tested this with echo and it all seemed to work. My newly formatted naming scheme became:
Code: Select all
{collection.replaceFirst(/\^(?i)(The)\\s(.+)/, /\$2, \$1/).replaceFirst(/\^(?i)(Collection of the)\\s(.+)/, /\$2 Collection/).replaceAll(/Saga Collection/, \"Saga\").replaceAll(/[\`´‘’ʻ\"\"“”]/, \"'\").replaceAll(/[:|]/, \" - \").replaceAll(/[?]/, \""'!'"\").replaceAll(/[*\\s]+/, \" \")}/{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() }).replaceFirst(/\^(?i)(The)\\s(.+)/, /\$2, \$1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/\^\\d+\$/, 'PG-\$0')})/{norm(n.space('.'))}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"}{'.(' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \".\") + ')'}{\".Part.\$pi\"}{\".[\$vf.\$vc.\$ac.\$af]\"}{'.'+lang}
However actually attempting to use it:
Code: Select all
filebot -script fn:amc --output "/mnt/user/Downloads" --action copy -non-strict "/mnt/user/Downloads/movies" --def excludeList=amc.txt --action test --def "movieFormat={collection.replaceFirst(/\^(?i)(The)\\s(.+)/, /\$2, \$1/).replaceFirst(/\^(?i)(Collection of the)\\s(.+)/, /\$2 Collection/).replaceAll(/Saga Collection/, \"Saga\").replaceAll(/[\`´‘’ʻ\"\"“”]/, \"'\").replaceAll(/[:|]/, \" - \").replaceAll(/[?]/, \""'!'"\").replaceAll(/[*\\s]+/, \" \")}/{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() }).replaceFirst(/\^(?i)(The)\\s(.+)/, /\$2, \$1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/\^\\d+\$/, 'PG-\$0')})/{norm(n.space('.'))}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"}{'.(' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \".\") + ')'}{\".Part.\$pi\"}{\".[\$vf.\$vc.\$ac.\$af]\"}{'.'+lang}"
gives me this error:
Code: Select all
/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `. /mnt/cache/.PhAzE-Common/Filebot/startcfg.sh; /usr/local/Filebot/filebot.sh -script fn:amc --output /mnt/user/Downloads --action copy -non-strict /mnt/user/Downloads/movies --def excludeList=amc.txt --action test --def movieFormat={collection.replaceFirst(/\^(?i)(The)\s(.+)/, /$2, $1/).replaceFirst(/\^(?i)(Collection of the)\s(.+)/, /$2 Collection/).replaceAll(/Saga Collection/, "Saga").replaceAll(/[`´‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ")}/{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() }).replaceFirst(/\^(?i)(The)\s(.+)/, /$2, $1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/\^\d+$/, 'PG-$0')})/{norm(n.space('.'))}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{'.(' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, ".") + ')'}{".Part.$pi"}{".[$vf.$vc.$ac.$af]"}{'.'+lang}'
I'm not sure why I can echo this command perfectly and yet trying to run it results in problems.