Page 1 of 1

Why does my custom format yield Script1$_run_closure1@632a2d0c and strange String values like that?

Posted: 25 Feb 2022, 13:44
by vvwn2

Code: Select all

{ 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/) } }
{ transl = { it.transliterate("Any-Latin; NFD; NFC; Title") }
  isLatin = { java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD)
                                  .replaceAll(/\p{InCombiningDiacriticalMarks}+/, "") ==~ /^\p{InBasicLatin}+$/ } }
{ allOf
  {'//Movies_3/Exchange'}
  // Movies directory
  {n.colon(" - ") + " ($y, $director, $omdb.rating,)"}

  // File name
  { allOf 
    { isLatin(primaryTitle) ? primaryTitle : transl(primaryTitle) }
    {" ( $y $omdb.rating)"}
    // tags + a few more variants
    { specials = { allOf 
                     {tags}
                     { fn.findAll(/(?i:alternate[ ._-]cut|limited|proper|repack)/)*.upperInitial()*.lowerTrail()*.replaceAll(/[._-]/, " ") }
                     .flatten().sort() }
      specials().size() > 0 ? specials().join(", ").replaceAll(/^/, " - ") : "" }
    {" PT $pi"}
    {" ["}
    { allOf
      // Video stream
      {[vf,vc].join(" ")}
      { allOf
        // Audio stream and language
        {[channels,ac].join(" ")}
        { def a = audioLanguages
          a.size() > 1 ? a.ISO3.join(", ").upperInitial() : a.name.first() }
        .join(" ") }
      {source}
      .join(" - ") }
    {"]"}
    {"-" + group}
    {subt}
    .join("") }
  .join("/") }

Code: Select all

 Script1$_run_closure1@632a2d0cScript2$_run_closure2@47633d78/Movies_3/Exchange/Avatar (2009, James Cameron, 7.8,)/Avatar ( 2009 7.8) PT 1 []

It used to be good, but there was a problem after the upgrade.

Re: Filebot 4.9.5 >There is a problem with the output path

Posted: 26 Feb 2022, 02:12
by rednoah
Can you simplify the format and remove everything that is unrelated to the problem so that we are working with the most simple format that can still reproduce the problem.


e.g. you're accidentally doing this, i.e. define a closure, and then return that closure because it's the last statement:

Code: Select all

{
	x = { 0 }
}

:arrow: You'll want to define your closures, and then use your closures and return some other value in a single {...} block like so:

Code: Select all

{
  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/) }
  transl = { it.transliterate("Any-Latin; NFD; NFC; Title") }
  isLatin = { java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD)
                                  .replaceAll(/\p{InCombiningDiacriticalMarks}+/, "") ==~ /^\p{InBasicLatin}+$/ }

  allOf
  {'//Movies_3/Exchange'}
  // Movies directory
  {n.colon(" - ") + " ($y, $director, $omdb.rating,)"}

  // File name
  { allOf 
    { isLatin(primaryTitle) ? primaryTitle : transl(primaryTitle) }
    {" ( $y $omdb.rating)"}
    // tags + a few more variants
    { specials = { allOf 
                     {tags}
                     { fn.findAll(/(?i:alternate[ ._-]cut|limited|proper|repack)/)*.upperInitial()*.lowerTrail()*.replaceAll(/[._-]/, " ") }
                     .flatten().sort() }
      specials().size() > 0 ? specials().join(", ").replaceAll(/^/, " - ") : "" }
    {" PT $pi"}
    {" ["}
    { allOf
      // Video stream
      {[vf,vc].join(" ")}
      { allOf
        // Audio stream and language
        {[channels,ac].join(" ")}
        { def a = audioLanguages
          a.size() > 1 ? a.ISO3.join(", ").upperInitial() : a.name.first() }
        .join(" ") }
      {source}
      .join(" - ") }
    {"]"}
    {"-" + group}
    {subt}
    .join("") }
  .join("/") }

Re: Why does my custom format yield Script1$_run_closure1@632a2d0c and strange String values like that?

Posted: 26 Feb 2022, 10:26
by vvwn2
Thank you.

I already know what the problem is.
I will pay attention to the way of asking questions in the future.
Thanks again~

Re: Why does my custom format yield Script1$_run_closure1@632a2d0c and strange String values like that?

Posted: 26 Feb 2022, 12:49
by brokenwu
vvwn2 wrote: 26 Feb 2022, 10:26 Thank you.

I already know what the problem is.
I will pay attention to the way of asking questions in the future.
Thanks again~
What was your solution?
Because I use the same format and face the same problem :D

Re: Why does my custom format yield Script1$_run_closure1@632a2d0c and strange String values like that?

Posted: 26 Feb 2022, 16:06
by vvwn2
Rednoah helped me delete several {

Then it's all right :D


Delete the red part
=================

{ 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/) } }
{
transl = { it.transliterate("Any-Latin; NFD; NFC; Title") }
isLatin = { java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD)
.replaceAll(/\p{InCombiningDiacriticalMarks}+/, "") ==~ /^\p{InBasicLatin}+$/ } }
{
allOf