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

All your suggestions, requests and ideas for future development
Post Reply
vvwn2
Posts: 5
Joined: 01 Nov 2021, 10:24

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

Post 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.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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("/") }
:idea: Please read the FAQ and How to Request Help.
vvwn2
Posts: 5
Joined: 01 Nov 2021, 10:24

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

Post 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~
brokenwu
Posts: 6
Joined: 05 Jan 2018, 19:30

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

Post 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
vvwn2
Posts: 5
Joined: 01 Nov 2021, 10:24

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

Post 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
Post Reply