Error "Script5$_run_closure5"

Support for Windows users
Post Reply
Mp3Dragons
Posts: 1
Joined: 03 Mar 2022, 20:25

Error "Script5$_run_closure5"

Post by Mp3Dragons »

I'm using version 4.9.5 and when updating from version 4.9.4 that I have been using for quite some time. I get when renaming the following error:

Code: Select all

Script5$_run_closure5@2e645f31
the part of my preset that causes this output seems to be the following

Code: Select all

[{
    (hd == 'SD') ? {any{text.size()}{0} > 0 ? 'SD':'SD'} :
    (hd == 'UHD') ? ( (gigabytes > 10 && mbps >= 26 ? '4K UHDremux' : {any{text.size()}{0} > 0 ? '4K BDrip':'4K BDrip'})) :
    (hd == 'HD' && vf == '720p') ? {any{text.size()}{0} > 0 ? '720p':'720p'} :
    (hd == 'HD' && vf == '1080p' ? 
            (gigabytes > 15 && mbps >= 18 ) ? '1080p BDremux' : 
            (mbps >= 8 ) ? {any{text.size()}{0} > 0 ? '1080p BDrip':'1080p BDrip'} : {any{text.size()}{0} > 0 ? '1080p BRrip':'1080p BRrip'} :
            {any{text.size()}{0} > 0 ? '1080p BRrip':'1080p BRrip'})}
{' (' + fn.matchAll(/extended|uncensored|open.matte|noir.edition|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'}
{fn =~ /3D|3d/ ? ' 3D' : ''}
I would be very grateful if you can help me solve it because I have several presets for series, movies, anime, documentaries and they are all failing in that same section.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Error "Script5$_run_closure5"

Post by rednoah »

:?: Can you provide a simplest-possible-test case that can isolate and reproduce the problem? (i.e. remove bits and pieces of your format until only that part that doesn't work is left, it it's most simple form)


You're accidentally doing something like this, which is incorrect:

Code: Select all

{
	x = { 0 }
}
:!: You code must return a value, but your code seems to return a Closure instead. This is likely the result of incorrectly placed {...} in the Groovy code.


:arrow: viewtopic.php?t=13074




EDIT:

You seem to have copy & pasted some really bad code from somewhere. The code for what you're trying to do should look like this:
viewtopic.php?p=55848#p55848


:arrow: If you want to generate values for different file sizes and bit rates, then you'll want to write code like this:

Code: Select all

{
    if (hd == 'SD')
        if (bytes.MB >= 700 && bitrate.mbps >= 1.1)
            return 'DVDRip'
        else
            return 'TVRip'

    if (hd == 'HD')
        if (bytes.GB >= 1 && bitrate.mbps >= 18)
            return 'BDRemux'
        else if (bitrate.mbps >= 8)
            return 'BDRip'
        else if (bitrate.mbps >= 2.2)
            return 'MicroHD'
        else
            return 'HDRip'

    if (hd == 'UHD')
        if (bytes.GB >= 1 && bitrate.mbps >= 32)
            return 'UHDRemux'
        else if (bitrate.mbps >= 16)
            return 'UHDRip'
        else
            return 'MicroUHD'
}
:idea: Please read the FAQ and How to Request Help.
Post Reply